[Solved] Build fail with undefned ffi references

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
lqfjun88
Posts: 3
Joined: Wed Jan 25, 2023 8:55 am

[Solved] Build fail with undefned ffi references

Post by lqfjun88 »

I try to manully compile Freecad from the latest github and have the following errors when I make:

/usr/bin/ld: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_closure_alloc@LIBFFI_CLOSURE_7.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_type_uint8@LIBFFI_BASE_7.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_prep_closure_loc@LIBFFI_CLOSURE_7.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_type_uint64@LIBFFI_BASE_7.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_type_pointer@LIBFFI_BASE_7.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_prep_cif@LIBFFI_BASE_7.0'
collect2: error: ld returned 1 exit status
make[2]: *** [tests/src/Base/CMakeFiles/Tests_Tools_run.dir/build.make:128: tests/src/Base/Tests_Tools_run] Error 1
make[1]: *** [CMakeFiles/Makefile2:7332: tests/src/Base/CMakeFiles/Tests_Tools_run.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I have installed libffi-dev on ubuntu 20.04 but i dont know why it fails to compile


-KP
Last edited by lqfjun88 on Fri Jan 27, 2023 1:13 pm, edited 1 time in total.
lqfjun88
Posts: 3
Joined: Wed Jan 25, 2023 8:55 am

Re: Build fail with undefned ffi references

Post by lqfjun88 »

Managed to solve this issue by making the following changes in 3 CMakeLists.txt by adding -lffi to link libffi library:

Replace CMakeLists.txt with the following files in the directory (remember to rename the files to CMakeLists.txt:
CMakeLists1.txt : tests/
CMakeLists2.txt : tests/src/Base
CMakeLists3.txt : src/Main
Attachments
CMakeLists3.txt
(4.43 KiB) Downloaded 344 times
CMakeLists2.txt
(324 Bytes) Downloaded 93 times
CMakeLists1.txt
(2.03 KiB) Downloaded 160 times
Post Reply