domoticz / domoticz

Open source Home Automation System
http://www.domoticz.com
GNU General Public License v3.0
3.47k stars 1.13k forks source link

Linking Error #3525

Closed Olivier6767 closed 5 years ago

Olivier6767 commented 5 years ago

I just updated open-zwave and Domoticz to the latest release. When linking Domoticz I now get the following error:

[100%] Linking CXX executable domoticz
/usr/bin/ld: /home/Services/domotique/open-zwave-read-only/libopenzwave.a(DNSImpl.o): undefined reference to symbol 'ns_initparse@@GLIBC_2.9'

/usr/lib/x86_64-linux-gnu/libresolv.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

CMakeFiles/domoticz.dir/build.make:3636: recipe for target 'domoticz' failed

make[2]: *** [domoticz] Error 1

CMakeFiles/Makefile2:77: recipe for target 'CMakeFiles/domoticz.dir/all' failed

make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2

Makefile:151: recipe for target 'all' failed

make: *** [all] Error 2
gizmocuz commented 5 years ago

Could you make sure there is no newer commit ? I recently added a check for the resolv library On what system are you building ?

Could you try adding -lresolv at line 741 of CMakeList.txt

gizmocuz commented 5 years ago

After a git pull, remove the CMakeFile/Cache folder/file

Olivier6767 commented 5 years ago

I'm building on Ubuntu 18.04. I just made a new Git Pull. I've a lto of files / folders in CMKaeFiles, which one do I need to remove ? In the meantime, I tried Make Clean / Make It is compiling now...

gizmocuz commented 5 years ago

Remove the folder CMakeFiles and the file CMakeCache.txt then issue

cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt -DUSE_OPENSSL_STATIC="NO"

then make

norrland1 commented 5 years ago

I'm also on Ubuntu and got same issue. Worked by adding -lresolv as you said.

Edit: Ran : cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt -DUSE_OPENSSL_STATIC="NO"

But did not delete old files first. Did not work.

gizmocuz commented 5 years ago

@norrland1 , if you do a 'git pull' it should already be added in the CMake file

norrland1 commented 5 years ago

Can't see it on line 741 but on line 691. Reset and building again.

$ git pull Already up to date.

IF-statement around line 741:

IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
  target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES})
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
  target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES} ${EXECINFO_LIBRARIES})
else()
  target_link_libraries(domoticz -lrt ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES} ${EXECINFO_LIBRARIES})
ENDIF()
gizmocuz commented 5 years ago

@norrland1 , yes thats ok... closing issue

gizmocuz commented 5 years ago

At least.. i hope it's solved..

gizmocuz commented 5 years ago

Maybe it is a combination of both... final build running here

norrland1 commented 5 years ago

Did a complete reset so build is taking some time, at 84% now....

gizmocuz commented 5 years ago

I think we only have to add it ~line 741 after -lrt ... building again...

Olivier6767 commented 5 years ago

Ok, I did git pull, removed CMakeFiles folder and CMakeCache.txt file, issued cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt -DUSE_OPENSSL_STATIC="NO" then make

I'm still having the error: [100%] Linking CXX executable domoticz /usr/bin/ld: /home/Services/domotique/open-zwave-read-only/libopenzwave.a(DNSImpl.o): undefined reference to symbol 'ns_initparse@@GLIBC_2.9' /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libresolv.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status CMakeFiles/domoticz.dir/build.make:3635: recipe for target 'domoticz' failed make[2]: *** [domoticz] Error 1 CMakeFiles/Makefile2:77: recipe for target 'CMakeFiles/domoticz.dir/all' failed make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2 Makefile:151: recipe for target 'all' failed make: *** [all] Error 2

norrland1 commented 5 years ago

Yes, got same issue now.

gizmocuz commented 5 years ago

Few minutes...

norrland1 commented 5 years ago

It does the trick, works fine if I add it to line 742.

target_link_libraries(domoticz -lresolv -lrt ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES} ${EXECINFO_LIBRARIES})

gizmocuz commented 5 years ago

Yep it's building... but does it work for OpenBSD/Darwin ? Time will tell... If you do a 'git pull' it should work correctly now...

norrland1 commented 5 years ago

Yes got it, looks good now, at least from my end ;)

Olivier6767 commented 5 years ago

Yes I confirm, git pull, then make. All good. Thanks!

petergebruers commented 5 years ago

but does it work for OpenBSD/Darwin ? Time will tell...

Darwin did not build, because of dependency on libresolv, but this PR fixes that: https://github.com/domoticz/domoticz/pull/3526

gizmocuz commented 5 years ago

Thanks all for the help ! I think it will have to be added for OpenBSD as well ;)

pipiche38 commented 5 years ago

Seems that I'm having the same on Fedora29

gizmocuz commented 5 years ago

@pipiche38 , could you explain a bit more... in the latest CMakeList.txt we added the resolv library Is it working now or does it now work ?

pipiche38 commented 5 years ago

Sorry for the confusion. I switch to an existing system, and no issue at link time. So problem on my end.

gizmocuz commented 5 years ago

Hope all works find... closing issue