karastojko / mailio

mailio is a cross platform C++ library for MIME format and SMTP, POP3, IMAP protocols. It is based on the standard C++ 17 and Boost library.
Other
381 stars 102 forks source link

Tests fail to link: ld: error: undefined symbol: main #159

Open yurivict opened 7 months ago

yurivict commented 7 months ago
===>  Testing for mailio-0.23.0.59
-- Found Boost: /usr/local/include (found version "1.84.0") found components: system date_time regex url 
-- Found Boost: /usr/local/include (found version "1.84.0") found components: unit_test_framework 
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /usr/ports/mail/mailio/work/.build
[100% 1/1] : && /usr/local/libexec/ccache/c++ -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG -fstack-protector-strong test/CMakeFiles/test_message.dir/test_message.cpp.o -o test/test_message -L/usr/local/lib -Wl,-rpath,/usr/local/lib:/usr/ports/mail/mailio/work/.build:  /usr/local/lib/libboost_unit_test_framework.so  libmailio.so  -lpthread  /usr/local/lib/libboost_system.so  /usr/local/lib/libboost_date_time.so  /usr/local/lib/libboost_regex.so  /usr/local/lib/libboost_url.so  /usr/lib/libssl.so  /usr/lib/libcrypto.so && :
FAILED: test/test_message 
: && /usr/local/libexec/ccache/c++ -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG -fstack-protector-strong test/CMakeFiles/test_message.dir/test_message.cpp.o -o test/test_message -L/usr/local/lib -Wl,-rpath,/usr/local/lib:/usr/ports/mail/mailio/work/.build:  /usr/local/lib/libboost_unit_test_framework.so  libmailio.so  -lpthread  /usr/local/lib/libboost_system.so  /usr/local/lib/libboost_date_time.so  /usr/local/lib/libboost_regex.so  /usr/local/lib/libboost_url.so  /usr/lib/libssl.so  /usr/lib/libcrypto.so && :
ld: error: undefined symbol: main
>>> referenced by crt1_s.S:69 (/disk-samsung/freebsd-src/lib/csu/amd64/crt1_s.S:69)
>>>               /usr/lib/crt1.o:(_start)
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
*** Error code 1
karastojko commented 7 months ago

Can you please try with the option MAILIO_DYN_LINK_TESTS turned on and let me know about the result?

yurivict commented 7 months ago

-DMAILIO_DYN_LINK_TESTS=ON makes tests to build successfully.

karastojko commented 7 months ago

I will check whether I can put the dynamic linkage by default. I had problems with tests in general when deploying on Vcpkg.