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

Undefined Symbol in relocation when building example on linux x86_64 #9

Open
Anton-4 opened this issue Nov 19, 2023 · 5 comments
Open

Comments

@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 19, 2023

❯ ./roc build ~/gitrepos/basic-webserver/examples/todos.roc 
πŸ”¨ Rebuilding platform...
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose
thread 'main' panicked at 'Undefined Symbol in relocation, (+1b97, Relocation { kind: PltRelative, encoding: Generic, size: +20, target: Symbol(SymbolIndex(+13d)), addend: +fffffffffffffffc, implicit_addend: false }): Ok(Symbol { name: "memset", address: +0, size: +0, kind: Label, section: Undefined, scope: Unknown, weak: false, flags: Elf { st_info: +10, st_other: +0 } })', crates/linker/src/elf.rs:1486:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is not specific to this example, and appears to happen for all of them.

The cause of this issue is: roc-lang/roc#3609

I think this only happens with export CARGO_BUILD_TARGET=x86_64-unknown-linux-musl. This is required for releases with good compatibility. I was also on the more-features branch, not on main.

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Nov 19, 2023

Temporary workaround:

roc build ~/gitrepos/basic-webserver/examples/todos.roc --linker=legacy

@RMailaender
Copy link
Contributor

this bug seems to block the git build pipeline. Should we, as a temporary workaround change the ci/all_tests.sh script, so it uses --linker=legacy until the bug is fiexed?

@bhansconnect
Copy link
Collaborator

bhansconnect commented Jan 25, 2024

This is not caused by roc-lang/roc#3609

It is probably caused by the compiler-rt related changes that got pulled into this PR: roc-lang/roc#6216

Zig should be automatically bundling the compiler-rt and libc related functions that we use in the builtins. That should include memcpy and memset. My guess is that it is still getting removed by DCE for some reason.

Need to circle back to this when I have more time, but first steps would be to double check the zig generated llvm ir actually has these functions and if it does, double check our llvm DCE related passes and such.

EDIT: If I don't circle back to this in like a week and no one else fixes it, can someone ping me?

@RMailaender
Copy link
Contributor

@bhansconnect Ping! :)

@bhansconnect
Copy link
Collaborator

This should fix for at least regular linux: roc-lang/roc#6515

I'm not sure what is going on with musl yet.

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

3 participants