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

Xcode 8 build error when archiving product #261

Closed
olivierkorner opened this issue Oct 4, 2016 · 22 comments
Closed

Xcode 8 build error when archiving product #261

olivierkorner opened this issue Oct 4, 2016 · 22 comments

Comments

@olivierkorner
Copy link
Contributor

olivierkorner commented Oct 4, 2016

This issue is a Bug

Related issue(s) and/or pull request(s)

#257
#260

Expected Behaviour

Xcode should build an archive file that you can upload to AppStore for validation

Observed behaviour

Archive process fails with error:

Strip /Users/olivierk/Library/Developer/Xcode/DerivedData/Lisa-bltmqvbwimjvbxauonpwachzptwl/Build/Intermediates/ArchiveIntermediates/Lisa/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libePub3-iOS.a
    cd /Users/olivierk/Projets/lisa/Lisa/readium-sdk/Platform/Apple
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -S /Users/olivierk/Library/Developer/Xcode/DerivedData/Lisa-bltmqvbwimjvbxauonpwachzptwl/Build/Intermediates/ArchiveIntermediates/Lisa/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libePub3-iOS.a

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: input object file stripped: /Users/olivierk/Library/Developer/Xcode/DerivedData/Lisa-bltmqvbwimjvbxauonpwachzptwl/Build/Intermediates/ArchiveIntermediates/Lisa/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libePub3-iOS.a(CPUCacheUtils_i386.o) (for architecture armv7)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: input object file stripped: /Users/olivierk/Library/Developer/Xcode/DerivedData/Lisa-bltmqvbwimjvbxauonpwachzptwl/Build/Intermediates/ArchiveIntermediates/Lisa/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libePub3-iOS.a(CPUCacheUtils_x64.o) (for architecture armv7)
0  0x10ffa35cc  __assert_rtn + 144
1  0x110000fd9  ld::tool::SectionRelocationsAtom<arm64>::encodeSectionReloc(ld::Internal::FinalSection*, ld::tool::SectionRelocationsAtom<arm64>::Entry const&, std::__1::vector<macho_relocation_info<Pointer64<LittleEndian> >, std::__1::allocator<macho_relocation_info<Pointer64<LittleEndian> > > >&) + 1609
2  0x11003030e  ld::tool::SectionRelocationsAtom<arm64>::encode() + 62
3  0x110007e5d  ld::tool::OutputFile::updateLINKEDITAddresses(ld::Internal&) + 413
4  0x1100014cb  ld::tool::OutputFile::write(ld::Internal&) + 167
5  0x10ffa469e  main + 1421
A linker snapshot was created at:
    /tmp/strip.IzSI5R-2016-09-04-183645.ld-snapshot
ld: Assertion failed: (0 && "need to handle arm64 -r reloc"), function encodeSectionReloc, file /Library/Caches/com.apple.xbs/Sources/ld64/ld64-274.1/src/ld/LinkEditClassic.hpp, line 1921.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: internal link edit command failed
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip failed with exit code 1

Steps to reproduce

In Xcode, choose Archive in the Product menu.

Product

  • Native application (Readium SDK C++)
    • iOS

Additional information

A workaround is to set Strip Linked Product to NO in the Build Settings, but there might be yet unknown side effects.

@olivierkorner
Copy link
Contributor Author

olivierkorner commented Oct 5, 2016

As suspected, the workaround has a serious downside:
Setting the Strip Linked Product setting to NO creates an archive that will not validate when uploaded to iTunes Connect for validation by Apple.
I got a message saying the binary had issues:

Non-public API usage:
The app references non-public symbols in Lisa: __tlv_atexit

I advise you to keep a copy of Xcode 7 if you need to submit a new binary to iTunes Connect!

@rkwright
Copy link
Member

rkwright commented Oct 5, 2016

But surely this can't have been overlooked by Apple, so what is the right answer? I.e. what is wrong with our project that we get into this state/problem?

@olivierkorner
Copy link
Contributor Author

I submitted a bug report to Apple.

@rkwright
Copy link
Member

rkwright commented Oct 9, 2016

@olivierkorner Thanks, Olivier? Did you get a bug reference or pointer back? If and when you do, could you please post it here?

@olivierkorner
Copy link
Contributor Author

@rkwright Yes but I think access to Apple bug reports are private.
Just in case, it's filed with ID 28684153.

Here's the information:

Summary:
After upgrading to Xcode 8, I'm unable to archive the project.
Archiving fails with a fatal error from strip when building a static library archive in a subproject.

Steps to Reproduce:
1. Open project in Xcode
2. Set active scheme to "Generic iOS Device"
3. In menu "Product", select "Archive"


Expected Results:
Archive builds without error

Actual Results:
The archive process fails when build a static library in a subproject with a fatail error in strip:
The error message says:
ld: Assertion failed: (0 && "need to handle arm64 -r reloc"), function encodeSectionReloc, file /Library/Caches/com.apple.xbs/Sources/ld64/ld64-274.1/src/ld/LinkEditClassic.hpp, line 1921.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: internal link edit command failed
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip failed with exit code 1


Version:
Xcode Version 8.0 (8A218a)
OX X 10.11.6 (15G1004)

Notes:
The archive is built succesfully when the "Strip Linked Product" is set to NO, but when I upload it to iTunesConnect, I get an email saying there's an issue: "Non-public API usage: The app references non-public symbols in Lisa: __tlv_atexit".

@dhavalshah
Copy link

Any update on this one? We are facing the same issue

@feihuang89
Copy link

setting the library's 'Strip Linked Product' to NO may be helpful!

@rkwright
Copy link
Member

rkwright commented Oct 28, 2016

@Africa802916 That has been tried, see @olivierkorner comment above. If you do that it creates the archive, but Apple then rejects the archive in the store.

So far, we have not found a solution and Apple has not responded to our "bug report"

@dhavalshah
Copy link

Yes 'Strip Linked Product' to NO does work but as rkwright mentioned not a permanent solution

@olivierkorner
Copy link
Contributor Author

My Apple bug report has been closed:

Engineering has determined that your bug report (28684153) is a duplicate of another issue (29057575) and will be closed.

@danielweck
Copy link
Member

danielweck commented Nov 11, 2016

The CPUCacheUtils / assembly code is really not that critical (and can therefore be removed), in fact it normally is disabled via a preprocessor / compiler directive, see:

#264 (comment)

@olivierkorner
Copy link
Contributor Author

Maybe related:
openframeworks/openFrameworks#5317

Indeed, when I upload an archive to iTunes Connect, I get an email from Apple saying:

Non-public API usage:

The app references non-public symbols in XXX: __tlv_atexit

Indeed I see an occurence of thread_local in future.cpp.
I'm going to try to disable it on iOS and see how it goes.

@danielweck
Copy link
Member

in the LCP/LSD implementation, we disabled Future/Promise entirely, and we removed the pthread-related dependencies which were not necessary and were making life more complicated with some compilers (NDK, Pepper)

@olivierkorner
Copy link
Contributor Author

Indeed, I was able to successfully archive and upload it to iTunes Connect after disabling thread_local for iOS!

@danielweck
Copy link
Member

How did you disable thread_local? (code removal, or compiler option?)

@olivierkorner
Copy link
Contributor Author

@danielweck I disabled it for iOS with a compiler option:

#if EPUB_COMPILER_SUPPORTS(CXX_THREAD_LOCAL)

#if EPUB_COMPILER_SUPPORTS(CXX_THREAD_LOCAL) && !EPUB_OS(IOS)

I wanted to add this to the pull request but looks like I'm too late :)

@danielweck
Copy link
Member

@olivierkorner but in this case, there should be a compile-time error, right?


# error No TLS implementation for this OS/Compiler

@olivierkorner
Copy link
Contributor Author

@danielweck No, because EPUB_OS(UNIX) is true

@danielweck
Copy link
Member

oh, Darwin is included in this macro too, of course.

@danielweck
Copy link
Member

Related / duplicate?
#267

@danielweck
Copy link
Member

@olivierkorner are you also experiencing #267 ?

...this should be a satisfactory solution, right?

#if EPUB_COMPILER_SUPPORTS(CXX_THREAD_LOCAL) && !EPUB_OS(IOS)

#if EPUB_COMPILER_SUPPORTS(CXX_THREAD_LOCAL)

If so, could you please create a Pull Request, so we can close this issue?

@danielweck
Copy link
Member

Fixed by: #268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants