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

[regression] Boost 1.70.0: iostreams can't detect ZLIB library on iOS #438

Open
ruslo opened this issue May 13, 2019 · 4 comments
Open

[regression] Boost 1.70.0: iostreams can't detect ZLIB library on iOS #438

ruslo opened this issue May 13, 2019 · 4 comments
Assignees
Labels
bug transition Transition to bfgroup/b2

Comments

@ruslo
Copy link

ruslo commented May 13, 2019

Xcode version:

> xcodebuild -version
Xcode 9.4.1
Build version 9F2000

boost.user.jam content:

> export TOPDIR=`pwd`
> cat $TOPDIR/boost.user.jam

using darwin : iphoneos
    : xcrun clang++  -arch armv7 -arch armv7s -arch arm64 -isysroot /Applications/develop/ide/xcode/9.4.1/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk
    : <striper> <root>/Applications/develop/ide/xcode/9.4.1/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
    : <architecture>arm <target-os>iphone
;

using darwin : iphonesimulator
    : xcrun clang++  -arch i386 -arch x86_64 -isysroot /Applications/develop/ide/xcode/9.4.1/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk
    : <striper> <root>/Applications/develop/ide/xcode/9.4.1/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
    : <architecture>x86 <target-os>iphone
;

Third party:

> ls $TOPDIR/third_party/include/{zlib.h,bzlib.h}

/.../third_party/include/bzlib.h
/.../third_party/include/zlib.h

> lipo -info $TOPDIR/third_party/lib/{libz.a,libbz2.a}

Architectures in the fat file: /.../third_party/lib/libz.a are: i386 armv7 armv7s x86_64 arm64 
Architectures in the fat file: /.../third_party/lib/libbz2.a are: i386 armv7 armv7s x86_64 arm64

Download and unpack:

> wget https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.bz2
> tar xf boost_1_70_0.tar.bz2
> cd boost_1_70_0/

Bootstrap and build:

> ./bootstrap.sh --with-libraries=iostreams --prefix=$TOPDIR/_install

> ./b2 \
    "-d+2 --debug-configuration" \
    toolset=darwin-iphoneos \
    target-os=iphone \
    architecture=arm \
    instruction-set=armv7 \
    -a \
    link=static \
    threading=multi \
    variant=release,debug \
    define=BOOST_SP_NO_SYNC \
    --layout=tagged \
    --user-config=$TOPDIR/boost.user.jam \
    -s NO_COMPRESSION=0 \
    -s NO_ZLIB=0 \
    -s NO_BZIP2=0 \
    -s ZLIB_INCLUDE=$TOPDIR/third_party/include \
    -s ZLIB_LIBPATH=$TOPDIR/third_party/lib \
    -s ZLIB_BINARY=z \
    -s BZIP2_INCLUDE=$TOPDIR/third_party/include \
    -s BZIP2_LIBPATH=$TOPDIR/third_party/lib \
    -s BZIP2_BINARY=bz2 \
    "cxxflags=-std=c++14 -miphoneos-version-min=9.3"

Output:

Performing configuration checks
    ...

Building the Boost C++ Libraries.

    - zlib                     : no
    - bzip2                    : no
    ...

Component configuration:

    ...
    - iostreams                : building
    ...

In file bin.v2/config.log:

"xcrun" "clang++" "-arch" "armv7" "-arch" "armv7s" "-arch" "arm64"
    "-isysroot" "/Applications/develop/ide/xcode/9.4.1/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk"
    -L"/.../third_party/lib"
    -o "bin.v2/standalone/ac/darwin-iphoneos/release/architecture-arm/instruction-set-armv7/link-static/target-os-iphone/threading-multi/visibility-hidden/z"
    "bin.v2/standalone/ac/darwin-iphoneos/release/architecture-arm/instruction-set-armv7/link-static/target-os-iphone/threading-multi/visibility-hidden/main-z.o"
    -lrt
    -lz
    -pthread -fvisibility=hidden -fvisibility-inlines-hidden -Wl,-dead_strip -no_dead_strip_inits_and_terms -arch armv7 

Error:

ld: library not found for -lrt

The same configuration worked fine with Boost 1.65.1. Since Boost 1.66.0 it is not working.

@mateuszzz88
Copy link

I also have this problem. Is there some workaround or fix?

@grafikrobot grafikrobot self-assigned this Feb 13, 2020
@mateuszzz88
Copy link

I worked it around by adding -L. in tools/build/src/user-config.jam and doing ln -s $(xcrun --sdk iphoneos --show-sdk-path)/usr/lib/libpkstart.a librt.a in sources dir. If script wants to link -lrt I will give it. I hoped that empty file would suffice, but it doesn't, so I linked random library that happens to really exist.
This is embarrassing but seems to work.

@limbolily
Copy link

I have the same problem. #678

@stale
Copy link

stale bot commented May 29, 2021

Thank you for your contributions. Main development of B2 has moved to https://github.com/bfgroup/b2
This issue has been automatically marked as "transition" to indicate the potential for needing transition to the new B2 development project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug transition Transition to bfgroup/b2
Projects
None yet
Development

No branches or pull requests

4 participants