Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gnutls-openssl instead of gnutls to fix build with CMake. #564

Merged
merged 2 commits into from Nov 12, 2014
Merged

Use gnutls-openssl instead of gnutls to fix build with CMake. #564

merged 2 commits into from Nov 12, 2014

Conversation

ghost
Copy link

@ghost ghost commented Nov 10, 2014

Hi again! [#562]

When I try compile Zoneminder with GnuTLS in Debian 7 I allways get this error:

libzm.a(zm_rtsp_auth.cpp.o): In function `Authenticator::computeDigestResponse(std::string&, std::string&)':
zm_rtsp_auth.cpp:(.text+0x24e6): undefined reference to `MD5'
zm_rtsp_auth.cpp:(.text+0x2594): undefined reference to `MD5'
zm_rtsp_auth.cpp:(.text+0x26d8): undefined reference to `MD5'
libzm.a(zm_user.cpp.o): In function `zmLoadAuthUser(char const*, bool)':
zm_user.cpp:(.text+0x1115): undefined reference to `MD5'
collect2: error: ld returned 1 exit status

I have libgnutls-openssl27 and of course, libgnutls-dev packages installed in my build machine. Also, I can build a ZoneMinder package with autotools without any issue.

It seems that CMake integration don't use '-lgnutls-openssl' on the C++ linker, only '-lgnutls'.

If we know that gnutls-openssl, as a wrapper, depends on gnutls...

root@debian:~/zm# ldd /usr/lib/i386-linux-gnu/libgnutls-openssl.so
    linux-gate.so.1 =>  (0xb76fb000)
    libtasn1.so.3 => /usr/lib/i386-linux-gnu/libtasn1.so.3 (0xb76d3000)
    libp11-kit.so.0 => /usr/lib/i386-linux-gnu/libp11-kit.so.0 (0xb76c1000)
    libgnutls.so.26 => /usr/lib/i386-linux-gnu/libgnutls.so.26 (0xb75f7000)
    libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb7492000)
    libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb748e000)
    libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb7475000)
    libgcrypt.so.11 => /lib/i386-linux-gnu/libgcrypt.so.11 (0xb73f0000)
    libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb73d6000)
    /lib/ld-linux.so.2 (0xb76fc000)
    libgpg-error.so.0 => /lib/i386-linux-gnu/libgpg-error.so.0 (0xb73d2000)

I think that this commit is just enough to fix the problem.

I tested in my build machine and works.

@knight-of-ni
Copy link
Member

Nice work. However, can you test the following change for me?

find_library(GNUTLS_LIBRARIES NAMES gnutls gnutls-openssl)

RPM based distros package things differently and do not have a gnutls-openssl package. Fortunately, cmake lets us easily search for multiple package names. This is why I really like cmake over autotools.

Don't know if you know this, but you can push changes against your open pull request and they will automatically show up. e.g. you don't have to close this and open a new pull request.

@ghost
Copy link
Author

ghost commented Nov 11, 2014

That change doesn't work at least for me. Compilation throws the same error.

@knight-of-ni
Copy link
Member

okay, we'll get this. I wonder if cmake stops searching after it finds the first match, in which case, it might be worth changing the order:

find_library(GNUTLS_LIBRARIES NAMES gnutls-openssl gnutls)

Try that, and in the meantime I'll come up with a "Plan B".

@knight-of-ni
Copy link
Member

That last suggestion doesn't work either. Here is plan B:

find_library(GNUTLS_LIBRARIES gnutls-openssl)
if(NOT GNUTLS_LIBRARIES)
    find_library(GNUTLS_LIBRARIES gnutls)
endif(NOT GNUTLS_LIBRARIES)

This works on CentOS. Let me know if Debian agrees.

@ghost
Copy link
Author

ghost commented Nov 12, 2014

Works without any problem.

Thanks for all!

knight-of-ni pushed a commit that referenced this pull request Nov 12, 2014
Use gnutls-openssl instead of gnutls to fix build with CMake.
@knight-of-ni knight-of-ni merged commit ae05563 into ZoneMinder:master Nov 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants