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

NDK set_runtimes("c++_shared") not work as expected #5113

Open
19317362 opened this issue May 17, 2024 · 1 comment
Open

NDK set_runtimes("c++_shared") not work as expected #5113

19317362 opened this issue May 17, 2024 · 1 comment
Labels

Comments

@19317362
Copy link

19317362 commented May 17, 2024

Xmake Version

2.9.1

Operating System Version and Architecture

Windows

Describe Bug

I'm test a simple hello-world app with NDK R26D. I want use NDK c++_shared STL. So I use set_runtimes("c++_shared") in xmake.lua.

Expected Behavior

readelf -d hell-world | grep NEEDED to inspect the app, it use [libc++_shared.so]
But it was not.

And then, I tried config like rm -rf .xmake; rm -rf build;xmake f -y -p android --runtimes=c++_shared, than run fromelf to inspect the app, it shows as expectd.

 0x00000001 (NEEDED)                     Shared library: [libc++_shared.so]

Project Configuration

xmake f -y -p android

set_runtimes("c++_shared")
target("hello-world")
    set_kind("binary")
    add_files("src/*.cpp")

Additional Information and Error Logs

When use xmake -v to inspect the command line, it has -static-libstdc++ which is not as expected

android-ndk-r26d\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++
-o
build\android\armeabi-v7a\release\yca_app
build\.objs\yca_app\android\armeabi-v7a\release\yca\yca_app.cpp.o
-target
armv7-none-linux-androideabi33
-fPIE
-pie
-static-libstdc++
-mthumb
-Lbuild\android\armeabi-v7a\release
-Wl,-rpath=$ORIGIN
-s
-latomic
-rdynamic
-Wl,--hash-style=sysv

After config with rm -rf .xmake; rm -rf build;xmake f -y -p android --runtimes=c++_shared, the command line is OK without -static-libstdc++

android-ndk-r26d\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++
-o
build\android\armeabi-v7a\release\yca_app
build\.objs\yca_app\android\armeabi-v7a\release\yca\yca_app.cpp.o
-target
armv7-none-linux-androideabi33
-fPIE
-pie
-mthumb
-Lbuild\android\armeabi-v7a\release
-Wl,-rpath=$ORIGIN
-s
-latomic
-rdynamic
-Wl,--hash-style=sysv
@19317362 19317362 added the bug label May 17, 2024
@waruqi
Copy link
Member

waruqi commented May 17, 2024

ndk does not support set_runtimes() now.

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

No branches or pull requests

2 participants