Comments (16)
Passing ./b2
the
target-os=android
switch will prevent the -lrt flag from being passed.
from boost-for-android.
Stumbling into the same issues. Adding "crtbegin_so.o" as a linker library hasn't helped. Did you solve it?
from boost-for-android.
@moritz-wundke Would you know why we can't compile Boost as a shared library? You have forced static for some reason I suppose?
from boost-for-android.
@linqcan, I'm sorry I can't help with the "cannot find ..." linker issues, I do know I had the same problem some time ago but with a different library. Possibly try to change the order in which the libraries are linked. Or try to add -lc at the end of your library list (it seems the functionality from librt is in libc on android).
I think the reasoning behind using static libraries is just practical as you can't share these libraries across projects anyway and linking with static libraries could strip unneeded functions thus resulting in smaller size (though this is just my understanding about how it works, I might be completely wrong). Also, when using dynamic libraries, one has to create a separate android makefiles for it or ensure otherwise that the libraries are copied into the resulting apk (this is done automatically when using static libs).
from boost-for-android.
static is just easier to handle when I started and fitted my needs. Also
the resulting size is smaller, the best option would be trying to get it
work in both ways. My needs might not fit those of others :D We could try
to work on the static/shared lib stuff which seams a major issue for many.
I'll create the task this weekend and start investigating. We should also
organize the pull requests that are still to be integrated in the master
branch.
Once I got the tasks created would you guys be ok with getting some
assigned? :D
On Fri, Aug 9, 2013 at 5:27 PM, Peter Jankuliak [email protected]:
@linqcan https://github.com/linqcan, I'm sorry I can't help with the
"cannot find ..." linker issues, I do know I had the same problem some time
ago but with a different library. Possibly try to change the order in which
the libraries are linked. Or try to add -lc at the end of your library list
(it seems the functionality from librt is in libc on androidhttps://github.com/crystax/android-platform-ndk/blob/master/docs/system/libc/OVERVIEW.html
).I think the reasoning behind using static libraries is just practical as
you can't share these libraries across projects anyway and linking with
static libraries could strip unneeded functions thus resulting in smaller
size (though this is just my understanding about how it works, I might be
completely wrong). Also, when using dynamic libraries, one has to create a
separate android makefiles for it or ensure otherwise that the libraries
are copied into the resulting apk (this is done automatically when using
static libs).—
Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-22401741
.
Moritz Wundke
www.MysticTreeGames.com
www.DarkCultureGames.com http://www.darkculturegames.com/
from boost-for-android.
/cc @springmeyer as I'm helping on the sidelines with @linqcan effort at getting boost working for mapnik on android. He hit linker errors which looked to me like conflicting linking to different c++ standard libraries which I why I recommended going shared for boost (in order to use readelf on boost and other c++ based libs to ensure they are all using gnustl).
from boost-for-android.
A log file is available here [1] if someone wants a quick look. I added "linkfags" to point out the directory where "crtbegin_so" resides. No luck though, I might be doing it wrong?
"linkflags" is created as in #42 .
[1] https://gist.github.com/linqcan/fcc6fbe42d10b0064409
from boost-for-android.
@linqcan, I think I made some progress, try this new branch. It does produce shared libraries now, but I haven't tested it on a real app. Could you give it a go and let us know if it works? (or doesn't :-) )
from boost-for-android.
I applied your commit and as you stated bjam now produces a shared libary. However, Android does not support shared library versioning (i.e libfoo.so.3.0) so the "SONAME" of the library needs to be changed somehow to exclude versioning.
from boost-for-android.
Example of the dynamic info output:
Dynamic section at offset 0x3e88 contains 26 entries: Tag Type Name/Value 0x00000003 (PLTGOT) 0x4fac 0x00000002 (PLTRELSZ) 144 (bytes) 0x00000017 (JMPREL) 0xf6c 0x00000014 (PLTREL) REL 0x00000011 (REL) 0xdf4 0x00000012 (RELSZ) 376 (bytes) 0x00000013 (RELENT) 8 (bytes) 0x6ffffffa (RELCOUNT) 38 0x00000006 (SYMTAB) 0x114 0x0000000b (SYMENT) 16 (bytes) 0x00000005 (STRTAB) 0x594 0x0000000a (STRSZ) 1578 (bytes) 0x00000004 (HASH) 0xbc0 0x00000001 (NEEDED) Shared library: [libstdc++.so] 0x00000001 (NEEDED) Shared library: [libm.so] 0x00000001 (NEEDED) Shared library: [libc.so] 0x00000001 (NEEDED) Shared library: [libdl.so] 0x0000000e (SONAME) Library soname: [libboost_system-gcc-mt-1_53.so.1.53.0] 0x0000001a (FINI_ARRAY) 0x4dd0 0x0000001c (FINI_ARRAYSZ) 8 (bytes) 0x00000019 (INIT_ARRAY) 0x4dd8 0x0000001b (INIT_ARRAYSZ) 8 (bytes) 0x00000010 (SYMBOLIC) 0x0 0x0000001e (FLAGS) SYMBOLIC BIND_NOW 0x6ffffffb (FLAGS_1) Flags: NOW 0x00000000 (NULL) 0x0
Also, it might be worth compiling boost using "gnustl_shared" according to section 7.4 in "$(NDK_ROOT)docs/STANDALONE-TOOLCHAIN.html" also available here.
from boost-for-android.
If I understand it correctly there are three libraries on the table:
- the static one libstdc++.a
- the shared one libgnustl_shared.so
- and some "system's own minimal C++ runtime" libstdc++.so
My understanding is that the one listed in your dynamic info output is the third one and it is one that is required by both the first and second one (what do you think?).
If you add parameter -d2 to the bjam command (inside build-android.sh), among other things it will print the link commands. E.g.:
"arm-linux-androideabi-g++" -o "bin.v2/libs/date_time/build/gcc-androidR8e/release/threading-multi/libboost_date_time-gcc-mt-1_53.so.1.53.0" -Wl,-h -Wl,libboost_date_time-gcc-mt-1_53.so.1.53.0 -shared -Wl,--start-group "bin.v2/libs/date_time/build/gcc-androidR8e/release/threading-multi/gregorian/greg_month.o" "bin.v2/libs/date_time/build/gcc-androidR8e/release/threading-multi/gregorian/greg_weekday.o" "bin.v2/libs/date_time/build/gcc-androidR8e/release/threading-multi/gregorian/date_generators.o" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -L/home/peter/project/android/android-ndk-r8e/platforms/android-9/arch-arm/usr/lib -pthread
From which it doesn't look like it's explicitly requesting either (1) nor (2) library. But if you wish to try it, add a line
<linkflags>-lgnustl_shared
to file BOOST_FOR_ANDROID/configs/user-config-boost-1_53_0.jam in the appropriate section (there are two androidR8b and androidR8e).
For the SONAME, you're right about Android not supporting library versioning, unfortunately I don't know how to fix that. I would have to dig into the jam build system but I haven't yet grocked the language.
from boost-for-android.
I tried compiling using gnustl_shared as well but there was still a dependency against libstdc++ (guessing it is the minimal Android version). However, I don't know if that is a problem yet since the SONAME issue still gives my problems.
When I have modified libs before to chang ethe SONAME I have edited libtool.m4 or configure. I made a patch for libtool.m4 and configure for boost but it seems like the case-statement where I put my changes is not triggered. I used David Turner's libtool patch as an inspiration: https://code.google.com/p/android/issues/detail?id=55868
I will look into it again tomorrow (Monday CET).
Dynamic section at offset 0x1eb0 contains 27 entries: Tag Type Name/Value 0x00000003 (PLTGOT) 0x2fc0 0x00000002 (PLTRELSZ) 104 (bytes) 0x00000017 (JMPREL) 0x6c4 0x00000014 (PLTREL) REL 0x00000011 (REL) 0x584 0x00000012 (RELSZ) 320 (bytes) 0x00000013 (RELENT) 8 (bytes) 0x6ffffffa (RELCOUNT) 33 0x00000006 (SYMTAB) 0x114 0x0000000b (SYMENT) 16 (bytes) 0x00000005 (STRTAB) 0x2a4 0x0000000a (STRSZ) 560 (bytes) 0x00000004 (HASH) 0x4d4 0x00000001 (NEEDED) Shared library: [libgnustl_shared.so] 0x00000001 (NEEDED) Shared library: [libstdc++.so] 0x00000001 (NEEDED) Shared library: [libm.so] 0x00000001 (NEEDED) Shared library: [libc.so] 0x00000001 (NEEDED) Shared library: [libdl.so] 0x0000000e (SONAME) Library soname: [libboost_system-gcc-mt-1_53.so.1.53.0] 0x0000001a (FINI_ARRAY) 0x2df8 0x0000001c (FINI_ARRAYSZ) 8 (bytes) 0x00000019 (INIT_ARRAY) 0x2e00 0x0000001b (INIT_ARRAYSZ) 8 (bytes) 0x00000010 (SYMBOLIC) 0x0 0x0000001e (FLAGS) SYMBOLIC BIND_NOW 0x6ffffffb (FLAGS_1) Flags: NOW 0x00000000 (NULL) 0x0
from boost-for-android.
Hmm, the SONAME was not stopping me it seems (so far). However, I get the following reference error:
java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "_ZNSsC1EPKcRKSaIcE" referenced by "libboost_system-gcc-mt-1_53.so"...
Is this something you have seen while working with Boost on Android?
The symbol is hard/impossible to track I guess. The complete symbol tree can be found here.
Update: Google says it can be "std::string"...: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013478.html
Update2: Recompiled Boost with "-lgnustl_shared" and the above error is not visible, but instead I have problems with the SONAME (I don't know if this is a step forward or backward). Not having a clean SONAME makes everything a bit messy at the moment...
java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libboost_system-gcc-mt-1_53.so.1.53.0" needed by "libboost_filesystem-gcc-mt-1_53.so"; caused by load_library(linker.cpp:745): library "libboost_system-gcc-mt-1_53.so.1.53.0" not found
from boost-for-android.
Should I create a separate issue for the SONAME?
The problem with shared library is solved by the branch/fix created by @inetic .
from boost-for-android.
Any updates? Is it possible to build shared libraries of boost 1.55?
from boost-for-android.
Sorry about the delay, unfortunately, no one has successfully done it and let us know about it. It seems we can create/link the so files, but the resulting files have a version suffix which android can't handle. Also one can't just rename the binary because the file name is hardcoded in it.
From the google code link from @linqcan and the patch that is in the link, it seems that what needs to be done is to set the variable version_type to none (version_type=none) in the linux section of file
boost_1_55_0/tools/build/v2/engine/boehm_gc/libtool.m4
At least that is my understanding of the current situation.
from boost-for-android.
Related Issues (20)
- Please update the download link
- Could not find a suitable toolset. HOT 1
- Bump boost version to 1.77 and disable statx syscall HOT 1
- Error before patch, on windows, how to fix? HOT 1
- when Suppport 1.7.7?
- Fixed ndk[19,20,21,22] building failed bug.
- Can you update the shell of 1.77.0 version ,thanks
- Error: No best alternative for libs/context/build/asm_sources HOT 1
- i build boost success but i build project faild HOT 5
- build-boost-without-version-number-suffixes
- Boost 1.74.0 armv7a
- boost_version for 1.72.0
- windows does not compile HOT 3
- "Undefined or not supported Android NDK version: 23.2" on GitHub Actions HOT 2
- fail to identify Windows when using '--with-conv'
- Can't build NDK
- Open source license HOT 2
- How to generate shared libboost_xxxx.so without the version number such as .so.1.74.0 HOT 2
- Please stop requiring approvals for pull requests HOT 3
- Add NDK 26.1 and 26.2 to build-android.sh
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boost-for-android.