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

[OCaml] build on freebsd x64 fails with "recompile with -fPIC" #422

Open
fogti opened this issue Jul 28, 2023 · 3 comments
Open

[OCaml] build on freebsd x64 fails with "recompile with -fPIC" #422

fogti opened this issue Jul 28, 2023 · 3 comments
Labels
build 🔨 help wanted Extra attention is needed

Comments

@fogti
Copy link

fogti commented Jul 28, 2023

https://gist.github.com/fogti/be2b57e38a2d0180b4bec9936bfa60f4

[ 60%] Linking C shared library libhacl.so
ld: error: relocation R_X86_64_PC32 cannot be used against symbol 'Hacl_Impl_Chacha20_Vec_chacha20_constants'; recompile with -fPIC
>>> defined in CMakeFiles/hacl.dir/src/Hacl_Chacha20.c.o
>>> referenced by Hacl_Chacha20_Vec128.c
>>>               CMakeFiles/hacl_vec128.dir/src/Hacl_Chacha20_Vec128.c.o:(Hacl_Chacha20_Vec128_chacha20_encrypt_128)
[...]
cc: error: linker command failed with exit code 1 (use -v to see invocation)

uname -a: FreeBSD burton 13.2-RELEASE-p1 [...] GENERIC amd64

@franziskuskiefer franziskuskiefer added help wanted Extra attention is needed build 🔨 labels Jul 31, 2023
@franziskuskiefer
Copy link
Member

This is an issue in the C library that's bundled by OCaml where -fPIC is missing.

FreeBSD is currently not supported. But I'm happy to take a patch that fixes the build for FreeBSD.

@fogti
Copy link
Author

fogti commented Aug 3, 2023

if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
add_compile_options(
-fPIC
)
endif(${CMAKE_SYSTEM_NAME} MATCHES Linux)

should be extended to also match on ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD. I think that should be able to fix this, but I'm not exactly sure how to test that (because idk how it is packaged for opam)

@franziskuskiefer
Copy link
Member

because idk how it is packaged for opam

You can test by cloning this repo and then running

./opam.sh
cd opam
opam install . --verbose --with-test --yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build 🔨 help wanted Extra attention is needed
Projects
Status: Todo
Development

No branches or pull requests

2 participants