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] --no-rosegment not supported by ld.gold from linux64 NDK r22 #1426

Closed
mastakrishna opened this issue Jan 11, 2021 · 18 comments
Closed
Labels

Comments

@mastakrishna
Copy link


Description

ld.gold from linux64 NDK claims that --no-rosegment option (which was introduced in #1196) is not supported.
Cmd line output from armv7 build:

Error while executing process /home/ubuntu/Android/Sdk/cmake/3.10.2.4988404/bin/ninja with arguments {-C /home/ubuntu/_navico/mapbox-gl-native-android/MapboxGLAndroidSDK/.cxx/cmake/release/armeabi-v7a mapbox-gl}
ninja: Entering directory `/home/ubuntu/_navico/mapbox-gl-native-android/MapboxGLAndroidSDK/.cxx/cmake/release/armeabi-v7a'
[1/1] Linking CXX shared library /home/ubuntu/_navico/mapbox-gl-native-android/MapboxGLAndroidSDK/build/intermediates/cmake/release/obj/armeabi-v7a/libmapbox-gl.so
FAILED: /home/ubuntu/_navico/mapbox-gl-native-android/MapboxGLAndroidSDK/build/intermediates/cmake/release/obj/armeabi-v7a/libmapbox-gl.so 
: && /home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi16 --gcc-toolchain=/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -fexceptions -Qunused-arguments -Oz -DNDEBUG  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libmapbox-gl.so -o /home/ubuntu/_navico/mapbox-gl-native-android/MapboxGLAndroidSDK/build/intermediates/cmake/release/obj/armeabi-v7a/libmapbox-gl.so CMakeFiles/mapbox-gl.dir/platform/android/src/main.cpp.o  libmbgl-core.a libmbgl-core-android.a libmbgl-core.a libmbgl-vendor-csscolorparser.a libmbgl-vendor-parsedate.a -O2 -Wl,--icf=all -flto -fuse-ld=gold -lEGL -lGLESv2 -landroid -latomic -ljnigraphics -llog libmbgl-vendor-icu.a libmbgl-vendor-sqlite.a -lz -latomic -lm && :

/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold: --no-rosegment: unknown option

/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold: use the --help option for usage information

Same from armv8:

/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -Qunused-arguments -O2 -DNDEBUG  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libmapbox-gl.so -o /home/ubuntu/_navico/mapbox-gl-native-android/MapboxGLAndroidSDK/build/intermediates/cmake/release/obj/arm64-v8a/libmapbox-gl.so CMakeFiles/mapbox-gl.dir/platform/android/src/main.cpp.o  libmbgl-core.a libmbgl-core-android.a libmbgl-core.a libmbgl-vendor-csscolorparser.a libmbgl-vendor-parsedate.a -O2 -Wl,--icf=all -flto -fuse-ld=gold -lEGL -lGLESv2 -landroid -latomic -ljnigraphics -llog libmbgl-vendor-icu.a libmbgl-vendor-sqlite.a -lz -latomic -lm && :

/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: --no-rosegment: unknown option

/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: use the --help option for usage information

Environment Details

  • NDK Version: 22.0.7026061
  • Build system: CMake via gradle (but issue seems to be toolchain specific)
  • Host OS: Linux (Ubuntu x64 18.04.5)
  • ABI: armeabi-v7a and arm64-v8a for sure (possibly other too)
@mastakrishna
Copy link
Author

mastakrishna commented Jan 11, 2021

FYI: I tried simply running ld --no-rosegment on Windows' x64 NDK 22.0.7026061 and ran into the very same issue:

Android\Sdk\ndk\22.0.7026061\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\bin>aarch64-linux-android-ld.exe --no-rosegment
aarch64-linux-android-ld.exe: unrecognized option '--no-rosegment'
aarch64-linux-android-ld.exe: use the --help option for usage information

So most probably the issue is not host-platform-dependent.

The quick work-around is to add:

externalNativeBuild {
  cmake {
    arguments "-DANDROID_LD=deprecated"
  }

so android.toolchain.cmake doesn't add this option.
Snippet:

if(ANDROID_LD STREQUAL deprecated)
  list(APPEND ANDROID_LINKER_FLAGS -Wl,--build-id)
else()
  list(APPEND ANDROID_LINKER_FLAGS -Wl,--build-id=sha1)
  if(ANDROID_PLATFORM_LEVEL LESS 29)
    # https://github.com/android/ndk/issues/1196
    list(APPEND ANDROID_LINKER_FLAGS -Wl,--no-rosegment)
  endif()
endif()

@DanAlbert
Copy link
Member

ld.gold isn't present in the next release.

@remyjette
Copy link

Okay, but what are users on the current release supposed to do? Is everyone supposed to just set -DANDROID_LD=deprecated or remain on r21?

I'm not doing anything fancy here, no crazy arguments to externalNativeBuild or anything like that, and I'm getting a linker error when I upgrade to r22

@DanAlbert
Copy link
Member

Use LLD? The original problem you saw is the result of using ld.gold and not telling the toolchain file that you're doing so. Grep for -fuse-ld and delete any instances of it. The only correct way to change your linker when using the NDK with CMake is with -DANDROID_LD.

If you don't find it I'm not sure what to look for, but you're pretty clearly ending up with ld.gold and it sounds like that isn't what you want. I can't help any more than that with the information I have. If you could upload a repro case it would probably be pretty obvious (I'm guessing that just the exercise of making the repro case would show you where the bug is)

@mastakrishna
Copy link
Author

mastakrishna commented Jan 15, 2021

Sorry @DanAlbert , but to me it looks like the NDK team simply screwed the fix for issue #1196 for API levels under 29 and your response is a bit arrogant way not to admit that.
Would that be a surprise to you if I say that regular LLD from NDK r22 also doesn't support the option I'm referring to here? So why on Earth was it added to the android.toolchain.cmake?

Please try to be more humble and at least apologize for the fact the NDK r22 is broken by default for these API levels without -DANDROID-LD=deprecated

An ETA for r23 that would fix that (can be by removing ld.gold and affecting lines in android.toolchain.cmake) would be also a nice touch here.

@rprichard
Copy link
Collaborator

AFAICT, the LLD in r22 does support --no-rosegment:

  • Default output. (LLD is the new default in r22, so I don't need to pass -fuse-ld=lld.) The first PT_LOAD segment is read-only, which is bad for unwinding on old versions of Android:

    $ /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang hello.c && readelf -lW a.out | grep LOAD
      LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x00051c 0x00051c R   0x1000
      LOAD           0x00051c 0x000000000000151c 0x000000000000151c 0x000104 0x000104 R E 0x1000
      LOAD           0x000620 0x0000000000002620 0x0000000000002620 0x000250 0x000250 RW  0x1000
      LOAD           0x000870 0x0000000000003870 0x0000000000003870 0x000000 0x000008 RW  0x1000
    
  • Adding --no-rosegment fixes things. The first segment is read-execute:

    $ /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang hello.c -Wl,--no-rosegment && readelf -lW a.out | grep LOAD
      LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0005e0 0x0005e0 R E 0x1000
      LOAD           0x0005e0 0x00000000000015e0 0x00000000000015e0 0x000250 0x000250 RW  0x1000
      LOAD           0x000830 0x0000000000002830 0x0000000000002830 0x000000 0x000008 RW  0x1000
    
  • But --no-rosegment doesn't work with the NDK's version of gold:

    $ /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang hello.c -Wl,--no-rosegment -fuse-ld=gold && readelf -lW a.out | grep LOAD
    /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: --no-rosegment: unknown option
    /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: use the --help option for usage information
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
  • With gold, --no-rosegment isn't needed. The first PT_LOAD segment is read-execute by default:

    $ /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang hello.c -fuse-ld=gold && readelf -lW a.out | grep LOAD
      LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0005c4 0x0005c4 R E 0x1000
      LOAD           0x000d58 0x0000000000001d58 0x0000000000001d58 0x0002a8 0x0002b0 RW  0x1000
    

The build scripts in NDK r22 (ndk-build and the CMake toolchain script) automatically add --no-rosegment when they determine that LLD is in use (e.g. when ANDROID_LD is lld, or when ndk-build sees -fuse-ld=lld). When the CMake toolchain script is used, passing -fuse-ld=gold also requires -DANDROID-LD=deprecated. But instead of adding that option, maybe you could move to LLD?

It's unfortunate that it's easy to hit this problem, by using -fuse-ld=gold with CMake, or when using some other build system.

I think we could have modified the Clang driver to pass --no-rosegment to LLD, but it's tricky because the -fuse-ld= argument can be an arbitrary path, and then deciding whether the path means LLD would require a heuristic. (e.g. Does the path end in ld.lld[.exe]). Since #1196 was fixed, though, it looks like upstream LLVM has deprecated the idea of passing a path to -fuse-ld= (in favor of a new --ld-path= argument, https://reviews.llvm.org/D83015), and the driver recognizes -fuse-ld=lld and -fuse-ld=lld.darwinnew as LLD (https://reviews.llvm.org/D91884), and specifically, the version of LLD that matches the version of Clang. i.e. Even if we weren't planning to remove the binutils linkers for r23, I think we could push --no-rosegment into the driver.

@enh-google
Copy link
Collaborator

Would that be a surprise to you if I say that regular LLD from NDK r22 also doesn't support the option I'm referring to here? So why on Earth was it added to the android.cmake?

i think that would be a huge surprise to all concerned, yes:

~/Downloads/android-ndk-r22$ ./toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld --actually-unsupported-flag
ld.lld: error: unknown argument '--actually-unsupported-flag'
~/Downloads/android-ndk-r22$ ./toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld --no-rosegment 
ld.lld: error: no input files

i don't think anyone has doubted that you're seeing a problem with your build, but the NDK tests pass, the Studio tests pass, and so far only two people have reported that they're having build trouble, and no one has provided us with repro steps yet.

(it also didn't help that this bug was entitled "--no-rosegment not supported by ld.gold" which -- though true -- is neither a regression nor your actual issue. your issue, as i understand it, is that your build is using gold but you don't believe you asked for gold, and think you should be getting lld.)

if you won't/can't share actual repro steps with us, you're going to have to work out for yourselves why you're using gold rather than lld. -fuse-ld is a good place to start looking, as already mentioned. alternatively, you could try the other way: start from the HelloJNI sample and edit that to be more like your build until it stops working, and share that.

you can see clearly from the command line that you supplied that you're passing -fuse-ld=gold:

/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/ubuntu/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -Qunused-arguments -O2 -DNDEBUG -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libmapbox-gl.so -o /home/ubuntu/_navico/mapbox-gl-native-android/MapboxGLAndroidSDK/build/intermediates/cmake/release/obj/arm64-v8a/libmapbox-gl.so CMakeFiles/mapbox-gl.dir/platform/android/src/main.cpp.o libmbgl-core.a libmbgl-core-android.a libmbgl-core.a libmbgl-vendor-csscolorparser.a libmbgl-vendor-parsedate.a -O2 -Wl,--icf=all -flto -fuse-ld=gold -lEGL -lGLESv2 -landroid -latomic -ljnigraphics -llog libmbgl-vendor-icu.a libmbgl-vendor-sqlite.a -lz -latomic -lm && :

and if you read through the NDK cmake toolchain file, you can see that that's not where we would have added -fuse-ld=gold (which would have been up with the -Wl options instead). your -fuse-ld=gold is near -Wl,--icf=all though, so that might be another clue about where in your build this is coming from.

Please try to be more humble and at least apologize

don't worry --- we're more than happy to admit any mistakes, and more importantly to fix them, when NDK bugs are found!

right now, though, this still doesn't look like an NDK bug, it isn't reproducible for us, and all the evidence points to "you have inconsistent settings of -DANDROID_LD= and -fuse-ld= in your builds". we're all trying to help here, but you're not giving us what we need to help you...

@mastakrishna
Copy link
Author

mastakrishna commented Jan 15, 2021

@rprichard I admit I was a bit too emotional and planned to double check when I reach the office. I must have remembered bad / tested with LLD from r21 by mistake some days ago.
I know the project I tried to link is "guilty" of having -fuse-ld, however I don't remember seeing in the docs / changelog that adding -DANDROID_LD=deprecated is required to use ld.gold.

Please point me to the place where was it documented and I'll crawl back to my cave in humiliation :)

@DanAlbert
Copy link
Member

It's in the changelog:

LLD is now used by default. If your build is not yet compatible with LLD, you can continue using the deprecated linkers, set APP_LD=deprecated for ndk-build, ANDROID_LD=deprecated for CMake, or use an explicit -fuse-ld=gold or -fuse-ld=bfd in your custom build system.

@mastakrishna
Copy link
Author

mastakrishna commented Jan 15, 2021

@DanAlbert Cool, thank you. This part:

"or use an explicit -fuse-ld=gold or -fuse-ld=bfd"

was/is a bit misleading to me (though now I can see it applies to a custom build system only and not CMake).
Maybe it could be rephrased a bit to avoid confusion.

Thank you (I mean all Googlers / NDK contributors here) for your assistance here.
I hope the messages in this ticket (and maybe slightly changed changelog and hopefully some documentation too) will help other people stumbling upon the very same issue.

@mastakrishna
Copy link
Author

mastakrishna commented Jan 15, 2021

@DanAlbert I finally figured out why I was claiming that LLD doesn't support it.

Look at my msg from second post here:

Android\Sdk\ndk\22.0.7026061\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\bin>aarch64-linux-android-ld.exe --no-rosegment
aarch64-linux-android-ld.exe: unrecognized option '--no-rosegment'
aarch64-linux-android-ld.exe: use the --help option for usage information

I thought aarch64-linux-android-ld.exe is LLD, while it's BFD LD. I don't have any knowledge about the difference between BFD and GOLD version, but maybe I'll google it one day. For the LLD I can figure out that it comes from the LLVM and because LLVM's clang is the blessed compiler then LLD should become the blessed linker too.

I've found that the LLD resides in toolchains\llvm\prebuilt\windows-x86_64\bin\ld.exe (or corresponding folder on Linux) and that it indeed seems to support --no-rosegment - which I could figure out easily if I read @enh-google msg carefully.

Lesson learned - never reply on your phone, but rather read the msgs carefully while being at the machine where you can verify all the stuff :)

Thx again and have a great day!

@mastakrishna
Copy link
Author

@rprichard

Even if we weren't planning to remove the binutils linkers for r23, I think we could push --no-rosegment into the driver.

I think that would be highly appreciated. I think with stuff like NDK you really need to think to implement stuff in a not-so-toolchain-savvy-users-resistant way.
Otherwise you get "village idiots" like me asking stupid questions ;)

@enh-google
Copy link
Collaborator

Even if we weren't planning to remove the binutils linkers for r23, I think we could push --no-rosegment into the driver.

I think that would be highly appreciated. I think with stuff like NDK you really need to think to implement stuff in a not-so-toolchain-savvy-users-resistant way.

this was in the plan last time we talked about it, but it would have probably caused more trouble if we'd tried this before removing the other linkers, and it's a lot harder to understand or work around a problem hard-coded into the compiler than one that's in a cmake toolchain :-(

the good news is that -- come r23 -- the NDK will have exactly one linker again for the first time in, well, longer than anyone who currently works on the NDK has worked on the NDK, and configuration will be simple again!

Otherwise you get "village idiots" like me asking stupid questions ;)

in retrospect i think maybe we shouldn't have given the custom build system instructions inline, for fear of confusing the 99%. something like: "LLD is now used by default. If your build is not yet compatible with LLD, you can continue using the deprecated linkers, set APP_LD=deprecated for ndk-build or ANDROID_LD=deprecated for CMake. See $CUSTOM_BUILD_SYSTEM_DOCS_LINK for how to use a deprecated linker in your custom build system."

@mastakrishna
Copy link
Author

@enh-google Yep, that change to the Changelog would definitely work too.

Anyway, at least I'm a bit wiser now regarding linkers in NDK and in general.
I lost track of NDK since something like r12 (back in the days I used to use NDK extensively, both with ndk-build and custom build systems) and I'm only getting up to speed now due to project's necessity.

Seems like you've done pretty good progress on (more fully) migrating to LLVM/CMake, so I'm only looking forward to what the future will bring.

Thx again and keep up the good work!

@DanAlbert
Copy link
Member

DanAlbert commented Jan 15, 2021

Even if we weren't planning to remove the binutils linkers for r23, I think we could push --no-rosegment into the driver.

I think that would be highly appreciated. I think with stuff like NDK you really need to think to implement stuff in a not-so-toolchain-savvy-users-resistant way.

It wasn't possible to do this in r22, fwiw: #1196 (comment). We do make things like that easier when it's possible: #1294 (can subscribe for updates if you want to remove workarounds in the future)

@rprichard
Copy link
Collaborator

Even if we weren't planning to remove the binutils linkers for r23, I think we could push --no-rosegment into the driver.

I think that would be highly appreciated. I think with stuff like NDK you really need to think to implement stuff in a not-so-toolchain-savvy-users-resistant way.

It wasn't possible to do this in r22, fwiw: #1196 (comment). We do make things like that easier when it's possible: #1294 (can subscribe for updates if you want to remove workarounds in the future)

Yeah, I saw that comment, but I don't think I noticed #1294. I think it may have become more practical since then to fix this issue in the driver -- I commented on #1294.

@mastakrishna
Copy link
Author

mastakrishna commented Jan 16, 2021

@DanAlbert @rprichard @enh-google Other idea for improvement could be to simply print a (CAPS) warning (or even better throw an error) if anything is put as -fuse-ld= (or the new --ld-path=) and there's no valid ANDROID_LD defined in CMake or APP_LD in ndk-build.

I think that could solve most of the r21->r22 migration cases. My project was prepared for an older version of NDK/CMake and there was no ANDROID_LD defined anywhere while -fuse-ld=gold was there (probably to make it not link with BFD linker which could have been default, at least at some point).

This change (in theory) could be released as r22b, so less users would have issues before r23 comes.

@DanAlbert
Copy link
Member

Not possible. We can't do anything after the toolchain file is done running. That's the reason you have to use ANDROID_LD in the first place. If we could know that you set -fuse-ld we could just set the flags correctly.

echuraev added a commit to echuraev/tvm that referenced this issue Oct 18, 2022
With NDK>= 23 when we specify explicitly linker then we got the
following error:

```
ld.gold: --no-rosegment: unknown option
```

From the github repository of NDK, I found that the only one right way
to configure linker is using `-DANDROID_LD` variable:
android/ndk#1426 (comment)

Removed setting linker manually and by default `LLD` will be used.

Checked that it works on the following versions of NDK:
- 20.0.5594570
- 21.4.7075529
- 22.1.7171670
- 23.0.7599858
- 23.1.7779620
- 24.0.8215888
- 25.1.8937393
masahi pushed a commit to apache/tvm that referenced this issue Oct 20, 2022
With NDK>= 23 when we specify explicitly linker then we got the
following error:

```
ld.gold: --no-rosegment: unknown option
```

From the github repository of NDK, I found that the only one right way
to configure linker is using `-DANDROID_LD` variable:
android/ndk#1426 (comment)

Removed setting linker manually and by default `LLD` will be used.

Checked that it works on the following versions of NDK:
- 20.0.5594570
- 21.4.7075529
- 22.1.7171670
- 23.0.7599858
- 23.1.7779620
- 24.0.8215888
- 25.1.8937393
xinetzone pushed a commit to daobook/tvm that referenced this issue Nov 10, 2022
With NDK>= 23 when we specify explicitly linker then we got the
following error:

```
ld.gold: --no-rosegment: unknown option
```

From the github repository of NDK, I found that the only one right way
to configure linker is using `-DANDROID_LD` variable:
android/ndk#1426 (comment)

Removed setting linker manually and by default `LLD` will be used.

Checked that it works on the following versions of NDK:
- 20.0.5594570
- 21.4.7075529
- 22.1.7171670
- 23.0.7599858
- 23.1.7779620
- 24.0.8215888
- 25.1.8937393
xinetzone pushed a commit to daobook/tvm that referenced this issue Nov 25, 2022
With NDK>= 23 when we specify explicitly linker then we got the
following error:

```
ld.gold: --no-rosegment: unknown option
```

From the github repository of NDK, I found that the only one right way
to configure linker is using `-DANDROID_LD` variable:
android/ndk#1426 (comment)

Removed setting linker manually and by default `LLD` will be used.

Checked that it works on the following versions of NDK:
- 20.0.5594570
- 21.4.7075529
- 22.1.7171670
- 23.0.7599858
- 23.1.7779620
- 24.0.8215888
- 25.1.8937393
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

5 participants