-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Description
I'm linking our executable, and I get this error:
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'RhpCidResolve'; recompile with -fPIC
>>> defined in /tmp/job17052320106867802331/build/libExtensionCSharp_3.a(libExtensionCSharp_3.o)
>>> referenced by StubDispatch.S:114 (/__w/1/s/src/coreclr/nativeaot/Runtime/arm64/StubDispatch.S:114)
>>> StubDispatch.S.o:(RhpInterfaceDispatchSlow) in archive /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libRuntime.WorkstationGC.a
Reproduction Steps
I compile for android (linux-bionic-arm64), and link a shared library for android mobile.
The toolchain requires -fPIC to link a shared executable for android, which is supplied on the command line.
However, if the "-shared" flag is omitted, the command succeeds. So it's nothing wrong with our setup (our builds work for macOS/iOS/Windows).
/opt/platformsdk/android/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++ -fuse-ld=/opt/platformsdk/android/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld -O2 -g -isysroot=/opt/platformsdk/android/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot -static-libstdc++ build/main_tmp4.o -o build/libdmengine.so -Wl,-soname=libdmengine.so -DDLIB_LOG_DOMAIN="UNKNOWN" -DDDF_EXPOSE_DESCRIPTORS -DDM_PLATFORM_ANDROID -D__aarch64__ -DDM_RELEASE -Wl,--build-id=uuid -fpic /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libbootstrapperdll.o /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libRuntime.WorkstationGC.a /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libeventpipe-enabled.a /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libstandalonegc-enabled.a /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libSystem.IO.Compression.Native.a /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libSystem.Globalization.Native.a /tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libSystem.Native.a -Wl,--no-undefined -Wl,-z,noexecstack -landroid -z text -L/tmp/job17052320106867802331/build -L/dynamo_home//lib/arm64-android -L/dynamo_home//ext/lib/arm64-android -L/tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native -Wl,-Bstatic -Wl,--start-group -lc++_static -lengine_release -lengine_service_null -lprofile_null -lremotery_null -lprofilerext_null -lExtensionCSharp_3 -lExtensionCPP_2 -lmbedtls -lzip -lrecord_null -lgameobject -lddf -lresource -lgamesys -lgamesys_model -lgamesys_rig -lscript_box2d -lgraphics -lgraphics_transcoder_basisu -lbasis_transcoder -lphysics -lBulletDynamics -lBulletCollision -lplatform -lLinearMath -lBox2D -lrender -lscript -lluajit-5.1 -lextension -lhid -linput -lparticle -lrig -ldlib -limage -ldmglfw -lgui -lcrashext -lsound -ltremolo -lliveupdate -lunwind -Wl,--end-group -Wl,-Bdynamic -lEGL -lGLESv1_CM -lGLESv2 -lOpenSLES -lm -llog -lc -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared
Expected behavior
I expect to be able to link a shared executable (.so) for the Android poatform.
Actual behavior
I get a linker error complaining about the library not being built with -fPIC (/tmp/.nuget/microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64/9.0.0-rc.2.24473.5/runtimes/linux-bionic-arm64/native/libRuntime.WorkstationGC.a)
Regression?
No response
Known Workarounds
I don't know of a workaround unfortunately, so this is a blocker.
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status