0

Build AllJoyn c++11 osx

asked 2014-11-20 12:47:14 -0700

Escaladeur gravatar image

updated 2015-01-16 11:46:51 -0700

Nikhil Dabhade gravatar image

Hi,

I need to use AllJoyn library in a c++11 software on OSX, but alljoyn is build with libstdc++ (pre c++11) and I need to build this one with libc++ (post c++11).

Can anyone know the procedure to change the stdlib flags on the xcode/scons alljoyn project?

Thanks,

edit retag flag offensive close merge delete

Comments

Are you trying to build AllJoyn from source. Or are you using the pre-compiled libraries?

georgen ( 2014-12-11 09:06:13 -0700 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2015-01-15 10:06:09 -0700

jnbrunet gravatar image

Here what I have for compiling alljoyn with libc++. Note that this is not suggested as I have not yet tested if everything works as before the changes. But it will compile and you will be able to link your c++11 software with it.

  1. build_core/conf/darwin/x86/SConscript

Change

env.Append(CXXFLAGS=[
        '-fno-rtti',
        '-fno-exceptions',
        '-Wc++11-extensions'])

To

env.Append(CXXFLAGS=[
        '-frtti',
        '-fexceptions',
        '-std=c++11',
        '-stdlib=libc++'])

env.Append(LINKFLAGS=[
        '-stdlib=libc++'])
  1. alljoyn_core/router/RuleTable.cc

Change

rules.erase(range.first);

To

rules.erase(range.first->first);
  1. alljoyn_core/src/AboutDataInternal.h

Change

bool operator()(const char& lhs, const char& rhs)

To

bool operator()(const char& lhs, const char& rhs) const

And

bool operator()(const qcc::String& lhs, const qcc::String& rhs)

To

bool operator()(const qcc::String& lhs, const qcc::String& rhs) const
  1. common/inc/qcc/STLContainer.h

Change

#if (__cplusplus >= 201100L) && !defined(QCC_OS_DARWIN)

To

#if (__cplusplus >= 201103L)

Here you will have a bug if you switch back to an older version of c++. I don't know why, but the condition on __cplusplus is true even without the -std=c++11 flag.

Project->clean Project->build

You should now be able to link alljoyn with your c++11 software. Note that this temporary solution works with iOS too.

edit flag offensive delete publish link more
0

answered 2015-01-14 16:40:32 -0700

Nikhil Dabhade gravatar image

Hi Escaladeur,

If you look at alljoyn_objc/alljoyn_darwin.xcodeproj file --> target named alljoyn_core_osx --> Build settings it should give you the compiler options. More specifically it will give you the C++ language options. You could change that to libc++ and build the alljoyn_core_osx target again to get the required AllJoyn libraries.

Let me know if that does not solve your problem

Nikhil

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-11-20 12:47:14 -0700

Seen: 314 times

Last updated: Jan 15 '15