dec1/Boost-for-Android

Not able to build boost with bzip2 android prebuilt library

Closed this issue · 15 comments

I am trying to add bzip2 dependency to boost for iostreams using BZIP2_NAME, BZIP2_LIBRARY_PATH AND BZIP2_INCLUDE but when i build boost it says bzip2 : no. Not sure whether i am doing something wrong any help would be appreciated.

Thanks in advance.

dec1 commented

Hello.
Sounds like you don't have bzip installed (or at least boost can't find it). Try doing so, and if after you are still having problems, please describe exactly what you are doing.
Best Wishes

Hello,
First sorry for the late response, but i have done all the steps mentioned in your docker file even then b2 build was not able to find bzip. Then i tried doing the steps mentioned in https://www.boost.org/doc/libs/1_81_0/tools/build/doc/html/index.html#bbv2.reference.tools that also did not work.
But will again investigate as to why b2 is not able to find bzip. Meanwhile if you have any points kindly provide.
And i am not an expert in buils(JFYI).

dec1 commented

Hello.
Many features are are not enabled by default, but are optional and need to be configured and/or found on your system when the boost build is happening.

Please ensure you download and build bzip, and then tell boost where it is.
See for example here

Hello,
Yes i tried this, out of these 2 approaches described in that answer only building from source(Option 1 (straight from source)) includes the bzip2 but then in runtime, when using the boost_iostreams library it throws a different error saying its not able to locate BZ2_bzCompressEnd but libboost_bzip2 is present. So then i tried to use the prebuilt inclusion method for bzip2 but that did not work. Mainly i wanted to check with you about this point because your pre-built boost libraries does not cause this issue so i wanted to find whats going wrong in my build.

dec1 commented

Im afraid I cant really help you unless I know exactly what you are doing.
How/where you are providing bzip, configuring (boost) to use it, build outupt, example code that reproduces the problem under which circumstances etc

Ok, i modify your __build.sh file and add the -s BZIP2_SOURCE parameter to the .b2 execution. When this is executed the bzip2 source is picked by boost build and a corresponding libboost_bzip2.so is generated. But in runtime the libboost_iostreams is not able to find a symbol inside this libboost_bzip2.so i believe(i will have to investigate this futher).
Since this is causing a runtime issue i tried including my own bzip2 library(pre-built for android) by adding these params (-s BZIP2_BINARY=libbz2 -s BZIP2_INCLUDE=C:/Sys/bzip2-1.0.6 -s BZIP2_LIBPATH) to your __build.sh file's .b2 execution but this does not take the bzip2 libs (i am saying this because when boost build is invoked it says bzip2 : no).
So this is where i am actually stuck and i am trying to figure out the issue here.

If my explanation is not clear do let me know what more is required.

dec1 commented

But in runtime the libboost_iostreams is not able to find a symbol inside this libboost_bzip2.so i believe(i will have to investigate this futher).

Please do, and give me the details of what youre calling and what exactly the output is

I was able to find the issue with boost b2 build (BZIP2_SOURCE - this approach). Basically the visibility of all libs generated by boost is set to hidden and boost-iostreams depends on boost-bzip2 libs symbols and because the visibility is set to hidden it was not able to obtain reference to the symbol in runtime.
Changing the visibility of boost build to global (parameter name is - visibility value is global ; reference - https://www.boost.org/doc/libs/1_81_0/tools/build/doc/html/index.html#bbv2.builtin.features.visibility) solved the issue.

@dec1 Thanks for your support :)

dec1 commented

Very glad it worked for you.

It would be very nice if you could create a branch where you make any changes needed (and only those needed) to get this working (including any explanations in comments), and open a pull request (on the dev branch).

Cheers

Sure will commit the changes and provide doc for the same.

@dec1 Can you grant me permission to this repository, so that i can create a branch and raise a PR.

dec1 commented

Hello.

The best is if you

  • create a fork of my repo.
  • in your fork create a branch called bzip_support (based on dev)
  • make the (minimal but sufficient) changes in bzip_support
  • open a pull request from you bzip_support to my dev

Thanks in advance.

Created PR - #29

dec1 commented

Thank you!

Thank you!

Welcome :)