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

android-ndk: fix LD path #26255

Closed

Conversation

kambala-decapitator
Copy link
Contributor

Summary

Changes to recipe: android-ndk/all

Motivation

Fixes shared libiconv build. Now also uses the same logic as Conan v1 (where I never saw such issue).

Details

Shared libiconv build fails with a rather cryptic error:

...
cd lib && /Applications/Xcode-15.4.0.app/Contents/Developer/usr/bin/make install-lib libdir='/Users/andrey.filipenkov/.conan2/p/b/libica26957a837e7d/b/build-release/lib' includedir='/Users/andrey.filipenkov/.conan2/p/b/libica26957a837e7d/b/build-release/lib'
/bin/sh /Users/andrey.filipenkov/.conan2/p/b/libica26957a837e7d/b/src/libcharset/build-aux/mkinstalldirs /Users/andrey.filipenkov/.conan2/p/b/libica26957a837e7d/b/build-release/lib
/bin/sh ../libtool --mode=install /usr/bin/install -c libcharset.la /Users/andrey.filipenkov/.conan2/p/b/libica26957a837e7d/b/build-release/lib/libcharset.la
libtool: install: /usr/bin/install -c .libs/libcharset.so /Users/andrey.filipenkov/.conan2/p/b/libica26957a837e7d/b/build-release/lib/libcharset.so
install: .libs/libcharset.so: No such file or directory
make[2]: *** [install-lib] Error 71
make[1]: *** [install-lib] Error 2
make: *** [lib/localcharset.h] Error 2

The reason of that seems to be "naked" linker usage (see references in the end), this can be seen during configure step:

checking for ld... /Users/andrey.filipenkov/.conan2/p/androc439eef6aa9d6/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi21-clang++
checking if the linker (/Users/andrey.filipenkov/.conan2/p/androc439eef6aa9d6/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi21-clang++) is GNU ld... no

But clang's linker is definitely GNU ld. With this change linker becomes identified correctly and build succeeds.

checking for ld... /Users/andrey.filipenkov/.conan2/p/androc439eef6aa9d6/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/bin/ld
checking if the linker (/Users/andrey.filipenkov/.conan2/p/androc439eef6aa9d6/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/bin/ld) is GNU ld... yes

References:


@valgur
Copy link
Contributor

valgur commented Dec 23, 2024

@franramirez688 Perhaps it's relevant to you.

@kambala-decapitator
Copy link
Contributor Author

kambala-decapitator commented Dec 23, 2024

Marked as draft as I'm not fully sure this is correct yet. For example, this change breaks my wrapper for system zlib: ld can't find the lib via simple -lz, it also requires -L with path (which is inside ndk sysroot).

Maybe better to adjust LD just for iconv? At least that's what was done in a script that can be found in the reference link.

@franramirez688
Copy link
Contributor

franramirez688 commented Dec 24, 2024

@valgur thanks for the ping 😁

@kambala-decapitator thanks a lot for reporting this and trying to solve the issue. Since Conan v2.11.0, AutotoolsToolchain has better managed all the flags deduced by Conan, and now, it gives more priority to the user's VirtualBuildEnv variables. For more information:

So, I think it should be enough to define in your host profile something like:

[buildenv]
LD=ld

@kambala-decapitator
Copy link
Contributor Author

@franramirez688 thanks a lot!

Instead of modifying my profile I'd like to make the fix available to everyone (i.e. in the recipe), and this small change works:

env.define("LD", "ld")

will open PR shortly. Closing this one then.

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

Successfully merging this pull request may close these issues.

3 participants