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

Compiling Boost.Locale #15

Closed
david-hoze opened this issue Jan 17, 2019 · 11 comments
Closed

Compiling Boost.Locale #15

david-hoze opened this issue Jan 17, 2019 · 11 comments

Comments

@david-hoze
Copy link

Hi, great work :)
Couldn't find the locale library (no libboost_log.so in the build directory), nor could I find a list to add the this library to.

Can you please help me compile the boost locale library as well?

@dec1
Copy link
Owner

dec1 commented Jan 18, 2019

Hello.

I take it you mean libboost_locale.so
Presumably the build skipped it because requirements icu or iconv are not satisfied.

You could try building them with this project.
Then add the ICU_PATH or ICONV_PATH to the run ./b2 command in my build_tools/build-boost.sh to tell boost where the libs you built are:

run ./b2 -d+2 -q -j$NUM_JOBS \
          .....
         -sICONV_PATH=path_to/libiconv-libicu-android/$ARCH \
         -sICU_PATH=path_to/libiconv-libicu-android/$ARCH \
         .........
install \

Possibly also add the --with-locale flag to ./b2

and/or try enabling exactly one of ICU/ICONV for b2 via
--with-locale boost.locale.iconv=off boost.locale.icu=on or vice versa

@david-hoze
Copy link
Author

Hi, thanks for your response!

I tried your suggestion (also --with-locale) but getting:

  • Boost.Locale needs either iconv or ICU library to be built.

You can reproduce it using my fork, checkout the icu branch:

git clone --recursive https://github.com/david-hoze/Boost-for-Android
cd Boost-for-Android
git checkout icu

I added a submodule for libiconv-libicu-android, that's why the recursive clone

On my fork you need to run doIt.sh with arguments (instead of the hardcoded BOOST_SRC_DIR and ANDROID_NDK_ROOT).
just run:

doIt.sh BOOST_SRC_DIR ANDROID_NDK_ROOT

It builds the libiconv-libicu-android automatically if it's not already built.

Will appreciate your help in the matter :)

@dec1
Copy link
Owner

dec1 commented Jan 22, 2019

Hi David.

Do the ICONV and ICU libraries get built properly?

Concentrate on ICU. Place this directly in a dir of formicu/$ICU_VERSION, where 'version' is the icu version you built (eg 63.1).

This dir should have structure like:

icu/63.1
            /include
                    .......
            /libs
                   /armeabi-v7a
                                  libicuio.so
                                  .....

Pass the build-boost.sh script the parameter --with-icu=<version>

Modify the path used to search for ICU in build-boost.sh. eg.

local ICU=$NDK_DIR/sources/icu/$ICU_VERSION

->

local ICU=where_you_have_icu/icu/1.63

Then try to (clean -- make sure nothing gets cached) build again.

Note: This might work without any modification of the call to ./b2

@dec1

This comment has been minimized.

@david-hoze
Copy link
Author

I can't seem to find the directory structure you illustrated..
Maybe the ICU is not being built, I am indeed getting a few errors in the build process, so I submitted an issue: pelya/libiconv-libicu-android#10.

@dec1
Copy link
Owner

dec1 commented Jan 29, 2019

Hello David.

I have been able to build boostlocale (with ndk 19) following the procedure I outlined above.

  • Build iconv/icu using my fork of the repo above (it includes a fix from me which hasnt been yet merged into the original).
    Note: you have to add the ndk dir to $PATH since it expects ndk-build to be callable - this is how you specify an ndk version: > export PATH=$PATH:<path_to_ndkdir>. And > export SHARED_ICU=1 from caller if you want to build a shared lib - recommended. And to sepecify an abi > export ARCHS=armeabi-v7a (choose from: arm64-v8a, armeabi-v7a, x86, x86_64)

  • Copy/move the libs/includes to a dir structure like the following:

icu/62.1
            /include
                    .......
            /libs
                   /armeabi-v7a
                                  libicuio.so
                                  .....

(This could be automated by a script .. feel free to add one :-)

  • Pass the build-boost.sh script the parameter --with-icu=<version> and export the variable ICU_DIR from doIt.sh (Youll need the latest version of Boost-for-Android for this)

Your doIt.sh should now look something like this:


ICU_VERSION=62.1   
export ICU_DIR=/home/declan/Documents/zone/low/icu

./build_tools/build-boost.sh --version=$BOOST_VERSION --stdlibs=$STD_LIBS --abis=$ABIS  --ndk-dir=$ANDROID_NDK_ROOT --linkage=$LINKAGE --verbose $BOOST_SRC_DIR --with-icu=$ICU_VERSION 2>&1 | tee -a $logFile

I get boostlocale and see that its dependent on libicudata.so, libicui18n.so, libicuuc.so, libiconv.so

Boost-for-Android/build/boost+icu/1.69.0/libs/llvm/armeabi-v7a> readelf -d libboost_locale.so | grep 'NEEDED'       

 0x00000001 (NEEDED)                     Shared library: [libboost_chrono.so]
 0x00000001 (NEEDED)                     Shared library: [libboost_thread.so]
 0x00000001 (NEEDED)                     Shared library: [libboost_system.so]
 0x00000001 (NEEDED)                     Shared library: [libicudata.so]
 0x00000001 (NEEDED)                     Shared library: [libicui18n.so]
 0x00000001 (NEEDED)                     Shared library: [libicuuc.so]
 0x00000001 (NEEDED)                     Shared library: [libiconv.so]
 0x00000001 (NEEDED)                     Shared library: [libc++_shared.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000001 (NEEDED)                     Shared library: [libdl.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so]

@david-hoze
Copy link
Author

david-hoze commented Feb 3, 2019

Thanks a lot, it compiles!!
My fork automates all that you suggested in the doIt.sh script BTW, including a submodule for libiconv-libicu-android.

@david-hoze
Copy link
Author

If you would like I'll be glad to submit a pull request, and add a --with-icu flag in the doIt.sh script.
let me know if you want me to.

@david-hoze
Copy link
Author

Hi, it does indeed compile, however.. When I run it I'm getting this exception:

2019-02-19 12:54:05.394 9778-9778/com.company.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.company.app, PID: 9778
    java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "UCNV_FROM_U_CALLBACK_STOP_62" referenced by "/data/app/com.company.app-CgT17mji5pIMXcahvcj2iA==/lib/x86/libboost_locale.so"...
        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
        at java.lang.System.loadLibrary(System.java:1657)
        at com.company.app.MainActivity.<clinit>(MainActivity.kt:181)
        at java.lang.Class.newInstance(Native Method)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Any ideas?

@dec1
Copy link
Owner

dec1 commented Mar 3, 2019

If you would like I'll be glad to submit a pull request, and add a --with-icu flag in the doIt.sh script.
let me know if you want me to.

Please add a pull request into the "boost_locale" branch.
Thanks

@dec1
Copy link
Owner

dec1 commented Mar 3, 2019

Hi, it does indeed compile, however.. When I run it I'm getting this exception:

2019-02-19 12:54:05.394 9778-9778/com.company.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.company.app, PID: 9778
    java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "UCNV_FROM_U_CALLBACK_STOP_62" referenced by "/data/app/com.company.app-CgT17mji5pIMXcahvcj2iA==/lib/x86/libboost_locale.so"...
        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
        at java.lang.System.loadLibrary(System.java:1657)
        at com.company.app.MainActivity.<clinit>(MainActivity.kt:181)
        at java.lang.Class.newInstance(Native Method)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Any ideas?

Would need to see your code.

Maybe you can create a repo with the app your trying to run

@dec1 dec1 closed this as completed Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants