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

- fix iconv detection for boost.locale on iOS #83

Merged
merged 3 commits into from
Sep 3, 2021

Conversation

SSE4
Copy link
Contributor

@SSE4 SSE4 commented Sep 2, 2021

  • clang-darwin doesn't need --start-group
  • clang-darwin doesn't need -lrt

Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

see bug reports:
conan-io/conan-center-index#6490
conan-io/conan-center-index#3992
boostorg/build#365
boostorg/build#678
boostorg/build#438

TLDR: building boost for iOS fails with the following error:

clang-darwin.link /Users/spaceim/.conan/data/boost/1.76.0/_/_/build/7ab220ce003d7c6ffe8c029987b8bf98cb7ba452/boost/bin.v2/standalone/ac/clng-drwn-12.0/rls/trgt-os-iphn/thrd-mlt/vsblt-hdn/bz2

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk" "-arch" "arm64" -stdlib=libc++ -L"/Users/spaceim/.conan/data/bzip2/1.0.8/_/_/package/402ac23a56db5265741eb8710725745ae6d028fa/lib" -o "/Users/spaceim/.conan/data/boost/1.76.0/_/_/build/7ab220ce003d7c6ffe8c029987b8bf98cb7ba452/boost/bin.v2/standalone/ac/clng-drwn-12.0/rls/trgt-os-iphn/thrd-mlt/vsblt-hdn/bz2" "/Users/spaceim/.conan/data/boost/1.76.0/_/_/build/7ab220ce003d7c6ffe8c029987b8bf98cb7ba452/boost/bin.v2/standalone/ac/clng-drwn-12.0/rls/trgt-os-iphn/thrd-mlt/vsblt-hdn/main-bz2.o"  -Wl,--start-group -Wl,-Bstatic  -Wl,-Bdynamic -lrt -lbz2 -Wl,--end-group -fPIC -pthread -fvisibility=hidden -fvisibility-inlines-hidden -L/Users/spaceim/.conan/data/libbacktrace/cci.20210118/_/_/package/108e68814533f28957889ee7075ad46a83968698/lib

ld: unknown option: --start-group
clang: error: linker command failed with exit code 1 (use -v to see invocation)

it's due to gcc.jam defining START_GROUP for everything except some while-listed targets. the list includes darwin (desktop macOS), but not iPhone (iOS). PR adds iOS to the white-list.

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Other (please describe):

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I searched the discussions
  • I searched the closed and open issues
  • I read the contribution guidelines
  • I added myself to the copyright attributions for significant changes
  • I checked that tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • I added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

* clang-darwin doesn't need --start-group
* clang-darwin doesn't need -lrt

Signed-off-by: SSE4 <tomskside@gmail.com>
`appletv` is another Xcode clang related platform that would have the same limitations.
@grafikrobot grafikrobot added the bug Something isn't working label Sep 2, 2021
@grafikrobot grafikrobot self-assigned this Sep 2, 2021
@Kojoley
Copy link
Contributor

Kojoley commented Sep 2, 2021

Is this actually a fix? You are disabling threading support for the platform because linker does not support library grouping. Since you use Clang, is not lld available for you?

@SSE4
Copy link
Contributor Author

SSE4 commented Sep 2, 2021

Is this actually a fix? You are disabling threading support for the platform because linker does not support library grouping. Since you use Clang, is not lld available for you?

it's a fix. I am not disabling threading, just don't link to librt (which doesn't exist for iOS anyway)
lld doesn't seem to be available:

xcrun -find lld
xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find lld 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument)
xcrun: error: unable to find utility "lld", not a developer tool or in PATH

@Kojoley
Copy link
Contributor

Kojoley commented Sep 2, 2021

I am not disabling threading, just don't link to librt (which doesn't exist for iOS anyway)

You are removing -pthread too.

lld doesn't seem to be available:

xcrun -find lld
xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find lld 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument)
xcrun: error: unable to find utility "lld", not a developer tool or in PATH

The executable usually named ld.lld, try to compile and link with clang -fuse-ld=lld, check if gold linker available if there no lld.

@SSE4
Copy link
Contributor Author

SSE4 commented Sep 2, 2021

You are removing -pthread too.

it doesn't appear to be needed per https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/pthread.3.html:

The default system libraries include pthread functions.  No additional
     libraries or CFLAGS are necessary to use this API.

The executable usually named ld.lld, try to compile and link with clang -fuse-ld=lld, check if gold linker available if there no lld.

$ clang -fuse-ld=lld /dev/null
clang: error: invalid linker name in argument '-fuse-ld=lld'
$ xcrun -find ld.lld
xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx -find ld.lld 2> /dev/null' failed with exit code 17664: (null) (errno=No such file or directory)
xcrun: error: unable to find utility "ld.lld", not a developer tool or in PATH
$ ld.lld
-bash: ld.lld: command not found

anyway, darwin (desktop macOS) is already excluded from the threading list, and I'd expect iphone/appletv to have the same behavior, as they share the same compiler/linker.

@Kojoley
Copy link
Contributor

Kojoley commented Sep 2, 2021

You are removing -pthread too.

it doesn't appear to be needed per developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/pthread.3.html:

The default system libraries include pthread functions.  No additional
     libraries or CFLAGS are necessary to use this API.

That should have been in the commit message, or better as a comment in the code.

src/tools/gcc.jam Show resolved Hide resolved
Co-authored-by: SSE4 <tomskside@gmail.com>
@grafikrobot grafikrobot merged commit b863465 into bfgroup:main Sep 3, 2021
psandana pushed a commit to psandana/b2 that referenced this pull request Feb 24, 2022
* - fix iconv detection for boost.locale on iOS
* clang-darwin doesn't need --start-group
* clang-darwin doesn't need -lrt
* Also need appletv to have the same exception. `appletv` is another Xcode clang related platform that would have the same limitations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants