Giter Site home page Giter Site logo

Linker issues about boost-for-android HOT 4 CLOSED

moritz-wundke avatar moritz-wundke commented on August 17, 2024
Linker issues

from boost-for-android.

Comments (4)

jauhien avatar jauhien commented on August 17, 2024

Not sure if understand your problem correctly, but to solve problems with undefined references to STL I use this ugly hack in our project:

LOCAL_LDLIBS := -lboost_filesystem-$(GCC_POSTFIX) -lboost_system-$(GCC_POSTFIX) -lboost_regex-$(GCC_POSTFIX) -lboost_thread-$(GCC_POSTFIX) -lgnustl_static
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/boost/lib/ 
LOCAL_LDFLAGS += -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(GCC_VERSION)/libs/armeabi-v7a/ 

It means, I add -lgnustl_static at the end of LDLIBS and path to it to LDFLAGS. Usualy problem is caused by having linking with stl mentioned before libraries that use it in the linker call. To see actual calls ndk-build does you can run it with -n option. Hope this helps.

from boost-for-android.

 avatar commented on August 17, 2024

Thank you for the answer.

I'm building the app by using bjam, I wrote Jamroot and Jamfiles for my projects.
I added path to stl /lib and stl library file name explicitly as linker option via <linkflags> when
defining toolset in user-config.jam:

using gcc : android4.8 :
: <linkflags>-L$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi
<linkflags>-lgnustl_static
<linkflags>--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-9arh-arm
<compileflags>--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-9arh-arm
...
;

I also added sysroot to linker too. It did the trick (no unresolved extrnals). But the only one problem left. I see '-lrt' in linker command line. I can't realize where it comes from. I tried to copy the g++ command line bjam provides on link failure and remove -lrt, app builded.
How to get rid of librt.a (-lrt)? It seems boost.build includes this option. I will investigate. If you had any idea on this, I would be really apprecited to hear it.

Regards.

from boost-for-android.

inetic avatar inetic commented on August 17, 2024

Hi, I remember looking for that flag as well some time ago. But for a different reason I think.

Try the file: BOOST_DIR/tools/build/v2/tools/gcc.jam

Line: 1071 (depends on boost version I guess, do a search for "setup-threading" in that file)

EDIT: My solution was to comment out the line "libs = rt ;", see this commit.

from boost-for-android.

 avatar commented on August 17, 2024

Thank you, that is I looked for!

from boost-for-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.