Closed levyfan closed 1 year ago
I guess the cmake build might be broken. When I build mcl by makefile, the output libmcl.a is OK.
Q4T9J22DT6:lib levyfan$ nm libmcl.a | grep mcl_fpDbl_add
U _mcl_fpDbl_add3L
U _mcl_fpDbl_add4L
U _mcl_fpDbl_add6L
U _mcl_fpDbl_add8L
0000000000000c00 T _mcl_fpDbl_add3L
0000000000001740 T _mcl_fpDbl_add4L
0000000000002cc8 T _mcl_fpDbl_add6L
0000000000005338 T _mcl_fpDbl_add8L
Thank you for the report. I verified the results.
mcl_fpDbl*
are in ${BASE_OBJ}
and mclb_*
are in ${BINT_OBJ}
.
I use target_link_libraries(mcl_st PUBLIC ${BINT_OBJ})
and target_link_libraries(mcl_st PUBLIC ${BASE_OBJ})
but they are not linked.
If you know, could you please tell me what to do?
I have checked 2 link.txt produced by cmake and mcl_st seems not be linked with bint64.o base64.o
$ cat CMakeFiles/mcl.dir/link.txt
/Library/Developer/CommandLineTools/usr/bin/c++ -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 1.0.0 -current_version 1.74.0 -o lib/libmcl.1.74.dylib -install_name @rpath/libmcl.1.dylib CMakeFiles/mcl.dir/src/fp.cpp.o bint64.o base64.o
$ cat CMakeFiles/mcl_st.dir/link.txt
/Library/Developer/CommandLineTools/usr/bin/ar qc lib/libmcl.a CMakeFiles/mcl_st.dir/src/fp.cpp.o
/Library/Developer/CommandLineTools/usr/bin/ranlib lib/libmcl.a
but no idea how to make it work.
Yes, I know that mcl.dir/link.txt
links bint64.o and base64.o but mcl_st.dir/link.txt
does not.
I don't know why target_link_libraries
works for a shared library but does not for a static library.
Using target_sources
seems to be good. Could you try it?
https://github.com/herumi/mcl/commit/ade06eac68ee3d8f897885e0c8c16d8a241d52b0
Yes that is ok
Thank you for the quick response.
Hi, I come with Undefined symbols error when including mcl static libs in my project.
I find that these symbols is defined in libmcl.dylib but not in libmcl.a
I include mcl by cmake ExternalProject_Add just as:
I would like to only build with mcl static libs. Any ideas?