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

clang requires libgcc from the gcc package to compile anything #72

Closed
joakim-noah opened this issue Nov 30, 2015 · 4 comments
Closed

clang requires libgcc from the gcc package to compile anything #72

joakim-noah opened this issue Nov 30, 2015 · 4 comments

Comments

@joakim-noah
Copy link
Contributor

Consider packaging libgcc or llvm's replacement, compiler-rt, as a standalone package that clang could install as a dependency instead, spun off from #63.

@fornwall
Copy link
Member

fornwall commented Jan 5, 2016

It seems that compiler-rt only supports i386 and x86_64 when cross compiling, from this section in make/platform/clang_linux.mk:

# We don't currently have any general purpose way to target architectures other
# than the compiler defaults (because there is no generalized way to invoke
# cross compilers). For now, we just find the target architecture of the
# compiler and only define configurations we know that compiler can generate.
CompilerTargetTriple := $(shell \
        LANG=C $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2)
ifeq ($(CompilerTargetTriple),)
$(error "unable to infer compiler target triple for $(CC)")
endif

# Only define configs if we detected a linux target.
ifneq ($(findstring -linux-,$(CompilerTargetTriple)),)

# Define configs only if arch in triple is i386 or x86_64
CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple)))
ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true)```

@joakim-noah
Copy link
Contributor Author

OK, I never tried building compiler-rt, just knew it was the llvm equivalent. I see that there's one in the Android source tree, maybe that one can be used? Or maybe compiler-rt is already available on Android devices somewhere and can be linked against?

@fornwall
Copy link
Member

This has now been fixed in the 3.8.0-1 version of the clang package, which depends on the new libgcc package which just contains $PREFIX/lib/libgcc.a taken from the NDK.

If I read the structure right the clang used in the NDK itself uses libgcc, so it's probably the best way forward for now.

@joakim-noah
Copy link
Contributor Author

Thanks, verified that this works for a medium-size C++ codebase.

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants