Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update travis matrix to include clang compiler #283

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,50 @@
language: cpp
compiler:
- clang
- gcc
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-software-properties
- 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
Expand Down
50 changes: 38 additions & 12 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'))

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -235,7 +252,7 @@ env.Append(
['rt'] if not OSX else [] +\
[
'z'
]
]
)

# We prepend, in case there's another BOOST somewhere on the path
Expand All @@ -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.
#
Expand Down
7 changes: 5 additions & 2 deletions src/beast/beast/Atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ class Atomic
#define BEAST_64BIT_ATOMICS_UNAVAILABLE 1
#endif

#elif BEAST_CLANG && BEAST_LINUX
#define BEAST_ATOMICS_GCC 1

//==============================================================================
#elif BEAST_GCC
#define BEAST_ATOMICS_GCC 1 // GCC with intrinsics
Expand Down Expand Up @@ -323,7 +326,7 @@ inline Type Atomic<Type>::operator++() noexcept
return sizeof (Type) == 4 ? (Type) beast_InterlockedIncrement ((volatile long*) &value)
: (Type) beast_InterlockedIncrement64 ((volatile __int64*) &value);
#elif BEAST_ATOMICS_GCC
return (Type) __sync_add_and_fetch (&value, 1);
return (Type) __sync_add_and_fetch (&value, (Type) 1);
#endif
}

Expand All @@ -337,7 +340,7 @@ inline Type Atomic<Type>::operator--() noexcept
return sizeof (Type) == 4 ? (Type) beast_InterlockedDecrement ((volatile long*) &value)
: (Type) beast_InterlockedDecrement64 ((volatile __int64*) &value);
#elif BEAST_ATOMICS_GCC
return (Type) __sync_add_and_fetch (&value, -1);
return (Type) __sync_add_and_fetch (&value, (Type) -1);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/ripple_net/basics/impl/MultiSocketType.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class MultiSocketType
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);
}

Expand Down