tklab-tud / uscxml

SCXML interpreter and transformer/compiler written in C/C++ with bindings to Java, C#, Python and Lua
Other
106 stars 54 forks source link

Install fails to link (to zlib?) #184

Open Phrogz opened 6 years ago

Phrogz commented 6 years ago

At the end of my build:

[ 47%] Linking CXX executable bin/uscxml-browser
lib/libuscxml.so.2.0.0: undefined reference to `inflateInit2_'
lib/libuscxml.so.2.0.0: undefined reference to `zlibVersion'
lib/libuscxml.so.2.0.0: undefined reference to `inflate'
lib/libuscxml.so.2.0.0: undefined reference to `inflateInit_'
lib/libuscxml.so.2.0.0: undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
CMakeFiles/uscxml-browser.dir/build.make:132: recipe for target 'bin/uscxml-browser' failed
make[2]: *** [bin/uscxml-browser] Error 1
CMakeFiles/Makefile2:179: recipe for target 'CMakeFiles/uscxml-browser.dir/all' failed
make[1]: *** [CMakeFiles/uscxml-browser.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Is there a specific version of zlib that I need to install first?

ventoneicapelli commented 5 years ago

Same problem building ee0a17cc63316edd83388a2f8f93b48cdcc6913c on Ubuntu 18.04 with zlib v1.2.11. Any clue? Thanks, pz

alexzhornyak commented 3 years ago

Hi, I've got the same error on Ubuntu 20.

Solution:

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    target_link_libraries(uscxml-browser uscxml "-lz")
else()
    target_link_libraries(uscxml-browser uscxml)
endif()