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

Cross compiling using arm-linux-gnueabihf toolchain does not work with LTO on macOS #1185

Closed
ttc0419 opened this issue Feb 1, 2024 · 1 comment

Comments

@ttc0419
Copy link

ttc0419 commented Feb 1, 2024

Source:

int main(void)
{
    return 0;
}

Without LTO, it works: arm-linux-gnueabihf-gcc -fuse-ld=mold conftest.c
However, if I enable LTO, it fails:

[u@h d](master)% arm-linux-gnueabihf-gcc -flto=auto -fuse-ld=mold conftest.c 
libc++abi: terminating due to uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in read_symlink: No such file or directory ["/proc/self/exe"]
mold: aborted
mold: If mold failed due to a spurious failure of pthread_create, it's likely because of https://github.com/oneapi-src/oneTBB/pull/824. You should ensure that you are using 2021.9.0 or newer version of libtbb.
collect2: error: ld returned 1 exit status
@ttc0419 ttc0419 closed this as completed Feb 1, 2024
@ttc0419 ttc0419 changed the title Segmentation fault: 11 on macOS using arm-linux-gnueabihf cross compiler Cross compiling using arm-linux-gnueabihf toolchain does not work on macOS Feb 1, 2024
@ttc0419 ttc0419 changed the title Cross compiling using arm-linux-gnueabihf toolchain does not work on macOS Cross compiling using arm-linux-gnueabihf toolchain does not work with LTO on macOS Feb 1, 2024
@ttc0419 ttc0419 reopened this Feb 1, 2024
@rui314
Copy link
Owner

rui314 commented Feb 1, 2024

/proc/self/exe does not exist on macOS. It seems calling _NSGetExecutablePath is the right way to get the current executable's pathname (https://chat.openai.com/share/89b40115-9778-49d0-b159-705995a3d25e). I'll make that change accordingly.

@rui314 rui314 closed this as completed in 206fe85 Feb 1, 2024
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

No branches or pull requests

2 participants