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

[Bug]: qt6-qtdeclarative 6.8.0 fails to build for non-aarch64 architectures #21733

Closed
Biswa96 opened this issue Oct 9, 2024 · 7 comments · Fixed by #21739
Closed

[Bug]: qt6-qtdeclarative 6.8.0 fails to build for non-aarch64 architectures #21733

Biswa96 opened this issue Oct 9, 2024 · 7 comments · Fixed by #21739
Labels
bug report Something is not working properly qt6

Comments

@Biswa96
Copy link
Member

Biswa96 commented Oct 9, 2024

Problem description

qt6-qtdeclarative 6.8.0 fails to build for non-aarch64 architectures. Here is the linker error.

ld.lld: error: undefined symbol: __tls_get_addr
>>> referenced by tasktree.cpp
>>>               lto.tmp:(Tasking::ExecutionContextActivator::activateTaskTree(Tasking::RuntimeContainer*))
>>> referenced by tasktree.cpp
>>>               lto.tmp:(Tasking::ExecutionContextActivator::activateTaskTree(Tasking::RuntimeContainer*))
>>> referenced by tasktree.cpp
>>>               lto.tmp:(Tasking::ExecutionContextActivator::activateTaskTree(Tasking::RuntimeContainer*))
>>> referenced 20 more times
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Full log can be found in https://github.com/termux/termux-packages/actions/runs/11242534272

What steps will reproduce the bug?

build it.

What is the expected behavior?

should build.

System information

n/a
@Biswa96 Biswa96 added bug report Something is not working properly untriaged labels Oct 9, 2024
@fornwall
Copy link
Member

fornwall commented Oct 9, 2024

Possibly related: android/ndk#2069

@twaik
Copy link
Member

twaik commented Oct 9, 2024

Adding -femulated-tls to build and link flags did not work, having the same error.

@twaik
Copy link
Member

twaik commented Oct 9, 2024

tasktree.cpp is a part of $PREFIX/lib/libQt6ExamplesAssetDownloader.a which is a part of qt6-qtbase. Probably it should be rebuilt with -femulated-tls but I am not so sure about this. I am even not sure if femulated-tls should be applied to CFLAGS/CXXFLAGS, LDFLAGS or both.

@truboxl
Copy link
Contributor

truboxl commented Oct 9, 2024

I feel that somewhere injected -flto. Try add -flto in LDFLAGS.

@Biswa96 Biswa96 added qt6 and removed untriaged labels Oct 9, 2024
@twaik
Copy link
Member

twaik commented Oct 9, 2024

Seems like injecting flto to ldflags works locally, but I tried only x86_64 build

@fornwall
Copy link
Member

fornwall commented Oct 9, 2024

I am even not sure if femulated-tls should be applied to CFLAGS/CXXFLAGS, LDFLAGS or both.

Agreed, I don't think femulated-tls should be used. My current understanding is that NDK should take care of using emulated TLS when targeting API level 28 or lower, https://android.googlesource.com/platform/bionic/+/HEAD/android-changes-for-ndk-developers.md#elf-tls-available-for-api-level-29:

Android supports ELF TLS starting at API level 29. Since NDK r26, clang will automatically enable ELF TLS for minSdkVersion 29 or higher. Otherwise, the existing emutls implementation (which uses pthread_key_create() behind the scenes) will continue to be used. This means that convenient C/C++ thread-local syntax is available at any API level; at worst it will perform similarly to “roll your own” thread locals using pthread_key_create() but at best you'll get the performance benefit of ELF TLS, and the NDK will take care of the details.

And indeed, as indicated above, the issue might be that flto needs to be used both when compiling and linking for the above to work (having it only for compilation was the issue in android/ndk#2069, and might be the issue here as well).

@fornwall
Copy link
Member

fornwall commented Oct 9, 2024

Seems like injecting flto to ldflags works locally, but I tried only x86_64 build

Verified a 32-bit arm build as well locally. Created the #21739 PR with it, let's see a complete CI run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something is not working properly qt6
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants