-
Notifications
You must be signed in to change notification settings - Fork 479
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
no possible to build shared library #23
Comments
Stumbling into the same issues. Adding "crtbegin_so.o" as a linker library hasn't helped. Did you solve it? |
@moritz-wundke Would you know why we can't compile Boost as a shared library? You have forced static for some reason I suppose? |
@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). |
static is just easier to handle when I started and fitted my needs. Also I'll create the task this weekend and start investigating. We should also Once I got the tasks created would you guys be ok with getting some On Fri, Aug 9, 2013 at 5:27 PM, Peter Jankuliak notifications@github.comwrote:
Moritz Wundke |
/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). |
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? |
@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 :-) ) |
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. |
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. |
If I understand it correctly there are three libraries on the table:
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.:
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
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. |
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. 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 |
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? Update: Google says it can be "std::string"...: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013478.html 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 |
Should I create a separate issue for the SONAME? |
Any updates? Is it possible to build shared libraries of boost 1.55? |
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. |
Passing |
Hi !
I tried to build boost as shared library, but I get this kind of errors :
cannot find crtbegin_so.o
cannot find -lrt
Does anybody has a solution ?
I built static libraries using boost 1_49 and ndk8b without any problems.
Gabriel
The text was updated successfully, but these errors were encountered: