diff --git a/.travis.yml b/.travis.yml index c68e20451b..8bd3f7e170 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: cpp compiler: + - clang - gcc before_install: - sudo apt-get update -qq @@ -7,14 +8,43 @@ before_install: - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo add-apt-repository -y ppa:boost-latest/ppa - sudo apt-get update -qq - - sudo apt-get install -qq libboost1.55-all-dev protobuf-compiler libprotobuf-dev libssl-dev exuberant-ctags - - sudo apt-get install -qq gcc-4.8 - sudo apt-get install -qq g++-4.8 + - sudo apt-get install -qq libboost1.55-all-dev + # We want debug symbols for boost as we install gdb later + - sudo apt-get install -qq libboost1.55-dbg + - sudo apt-get install -qq mlocate + - sudo updatedb + - sudo locate libboost | grep /lib | grep -e ".a$" + - sudo apt-get install -qq protobuf-compiler libprotobuf-dev libssl-dev exuberant-ctags + # We need gcc >= 4.8 for some c++11 features + - sudo apt-get install -qq gcc-4.8 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 - sudo update-alternatives --set gcc /usr/bin/gcc-4.8 + # Stuff is gold. Nuff said ;) + - sudo apt-get -y install binutils-gold + # We can get a backtrace if the guy crashes + - sudo apt-get -y install gdb + # What versions are we ACTUALLY running? - g++ -v + - clang -v -script: scons && ./build/rippled --unittest && npm install && npm test +script: + # Set so any failing command will abort the build + - set -e + # If only we could do -j12 ;) + - scons + # See what we've actually built + - ldd ./build/rippled + # Run unittests (under gdb) + - | # create gdb script + echo "set env MALLOC_CHECK_=3" > script.gdb + echo "run" >> script.gdb + echo "backtrace full" >> script.gdb + # gdb --help + - cat script.gdb | gdb --return-child-result --args ./build/rippled --unittest + # Run integration tests + - npm install + - npm test notifications: email: false diff --git a/SConstruct b/SConstruct index cfcec345d3..92e48e19be 100644 --- a/SConstruct +++ b/SConstruct @@ -17,12 +17,12 @@ Ubuntu = bool(Linux and 'Ubuntu' == platform.linux_distribution()[0]) Debian = bool(Linux and 'debian' == platform.linux_distribution()[0]) Archlinux = bool(Linux and ('','','') == platform.linux_distribution()) #Arch still has issues with the platform module -USING_CLANG = OSX +USING_CLANG = OSX or os.environ.get('CC', None) == 'clang' # # We expect this to be set -# -BOOST_HOME = os.environ.get("RIPPLED_BOOST_HOME", None) +# +BOOST_HOME = os.environ.get("RIPPLED_BOOST_HOME", None) if OSX or Ubuntu or Debian or Archlinux: @@ -51,12 +51,18 @@ if FreeBSD: env.Append(CCFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46']) env.Append(LINKFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46']) -if OSX: +if USING_CLANG: env.Replace(CC= 'clang') env.Replace(CXX= 'clang++') - env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libc++']) - env.Append(LINKFLAGS='-stdlib=libc++') - env['FRAMEWORKS'] = ['AppKit','Foundation'] + + if Linux: + env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libstdc++']) + env.Append(LINKFLAGS='-stdlib=libstdc++') + + if OSX: + env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libc++']) + env.Append(LINKFLAGS='-stdlib=libc++') + env['FRAMEWORKS'] = ['AppKit','Foundation'] GCC_VERSION = re.split('\.', commands.getoutput(env['CXX'] + ' -dumpversion')) @@ -105,12 +111,23 @@ BOOST_LIBS = [ # We whitelist platforms where the non -mt version is linked with pthreads. This # can be verified with: ldd libboost_filesystem.* If a threading library is # included the platform can be whitelisted. -if FreeBSD or Ubuntu or Archlinux: -# if FreeBSD or Ubuntu or Archlinux or OSX: +# if FreeBSD or Ubuntu or Archlinux: + +if not (USING_CLANG and Linux) and (FreeBSD or Ubuntu or Archlinux or OSX): # non-mt libs do link with pthreads. env.Append( LIBS = BOOST_LIBS ) +elif Linux and USING_CLANG and Ubuntu: + # It's likely going to be here if using boost 1.55 + boost_statics = [ ("/usr/lib/x86_64-linux-gnu/lib%s.a" % a) for a in + BOOST_LIBS ] + + if not all(os.path.exists(f) for f in boost_statics): + # Else here + boost_statics = [("/usr/lib/lib%s.a" % a) for a in BOOST_LIBS] + + env.Append(LIBS = [File(f) for f in boost_statics]) else: env.Append( LIBS = [l + '-mt' for l in BOOST_LIBS] @@ -235,7 +252,7 @@ env.Append( ['rt'] if not OSX else [] +\ [ 'z' - ] + ] ) # We prepend, in case there's another BOOST somewhere on the path @@ -246,14 +263,23 @@ if BOOST_HOME is not None: if not OSX: env.Append(LINKFLAGS = [ - '-rdynamic', '-pthread', + '-rdynamic', + '-pthread', ]) DEBUGFLAGS = ['-g', '-DDEBUG', '-D_DEBUG'] env.Append(CCFLAGS = ['-pthread', '-Wall', '-Wno-sign-compare', '-Wno-char-subscripts']+DEBUGFLAGS) -env.Append(CXXFLAGS = ['-O1', '-pthread', '-Wno-unused-local-typedefs', '-Wno-invalid-offsetof', '-Wformat']+DEBUGFLAGS) +if not USING_CLANG: + more_warnings = ['-Wno-unused-local-typedefs'] +else: + # This disables the "You said it was a struct AND a class, wth is going on + # warnings" + more_warnings = ['-Wno-mismatched-tags'] + # This needs to be a CCFLAGS not a CXXFLAGS + env.Append(CCFLAGS = more_warnings) +env.Append(CXXFLAGS = ['-O1','-pthread', '-Wno-invalid-offsetof', '-Wformat']+more_warnings+DEBUGFLAGS) # RTTI is required for Beast and CountedObject. # diff --git a/src/ripple_net/basics/impl/MultiSocketType.h b/src/ripple_net/basics/impl/MultiSocketType.h index 03de8ad7e3..a63e0c1086 100644 --- a/src/ripple_net/basics/impl/MultiSocketType.h +++ b/src/ripple_net/basics/impl/MultiSocketType.h @@ -106,7 +106,7 @@ protected: m_proxyInfo.destAddress.value [0], m_proxyInfo.destAddress.value [1], m_proxyInfo.destAddress.value [2], - m_proxyInfo.destAddress.value [4]) + m_proxyInfo.destAddress.value [3]) , m_proxyInfo.destPort); }