Skip to content

[Bug]: NDK 27 fails when enabling INTERPROCEDURAL_OPTIMIZATION with LLVMgold.so: cannot open shared object file: No such file or directory #2138

Closed as not planned
@cortinico

Description

@cortinico

Description

Hey all,
Nicola from React Native here,

I'm trying to enable INTERPROCEDURAL_OPTIMIZATION in the React Native build. The project is open source so you can see our setup here:

I'm able to succesfully build on MacOS but the build fails on CI which is running on ubuntu-latest on GitHub Action.

The failure (see here: https://github.com/facebook/react-native/actions/runs/14343628016/job/40208717552) is happening due to missing LLVMgold.so file:

  /usr/bin/ld.gold: error: /opt/android/ndk/27.1.12297006/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/LLVMgold.so: could not load plugin library: /opt/android/ndk/27.1.12297006/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
  /usr/bin/ld.gold: fatal error: /opt/android/ndk/27.1.12297006/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/24/crtbegin_so.o: unsupported ELF machine number 183

What is the reccomended approach to enable here? I've read through other issues and the only similar I found is this one:

However in the NDK 27 distribution, it seems like also the llvmgold.dylib

What is the reccomended way to enable link-time optimization with the latest NDK?

Upstream bug

N/A

Commit to cherry-pick

N/A

I am using a supported NDK

  • I have checked and the NDK I'm using is currently supported

Affected versions

r27

Host OS

Linux

Host OS version

ubuntu 22.04 (from this Dockerfile https://github.com/react-native-community/docker-android/blob/main/Dockerfile)

Affected ABIs

armeabi-v7a, arm64-v8a, x86, x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions