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

Fix libgsoap linking in src/CMakeLists.txt #4175

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

0xB0D
Copy link
Contributor

@0xB0D 0xB0D commented Oct 13, 2024

libgsoap supplies both libgsoap++.a and libgsoapssl++.a however an application should link to one of those libraries not both.

An example from gsoap-2.8 samples:

With SSL:
/usr/bin/clang++ -DLINUX -g -O2 -o json-GitHub json_GitHub-json-GitHub.o json_GitHub-xml-rpc.o json_GitHub-json.o json_GitHub-soapC.o ../../../gsoap/libgsoapssl++.a -lm -lssl -lcrypto -lz

Without SSL:
/usr/bin/clang++ -DLINUX -g -O2 -o json-currentTimeServer json-currentTimeServer.o xml-rpc.o json.o soapC.o ../../../gsoap/libgsoap++.a -lm -lpthread

Right now src/CMakeLists.txt is try to link to both libgsoap++ and libgsoapssl++.

/usr/bin/ld: /lib/libgsoapssl++.a(libgsoapssl___a-stdsoap2_ssl_cpp.o): in function soap_query': (.text+0x1880): multiple definition of soap_query'; /lib/libgsoap++.a(libgsoap___a-stdsoap2_cpp.o):(.text+0x1890): first defined here
/usr/bin/ld: /lib/libgsoapssl++.a(libgsoapssl___a-stdsoap2_ssl_cpp.o): in function soap_query_decode': (.text+0x18a0): multiple definition of soap_query_decode'; /lib/libgsoap++.a(libgsoap___a-stdsoap2_cpp.o):(.text+0x18b0): first defined here
/usr/bin/ld: /lib/libgsoapssl++.a(libgsoapssl___a-stdsoap2_ssl_cpp.o): in function soap_query_key': (.text+0x1a50): multiple definition of soap_query_key'; /lib/libgsoap++.a(libgsoap___a-stdsoap2_cpp.o):(.text+0x1a60): first defined here

Change src/CMakeLists.txt so that

  1. libgsoap++ is the default library to link
  2. libgsoapssl++ is linked to instead if HAVE_OPENSSL is true

This means that if openssl is not detected libgsoap++ will be linked otherwise libgsoapssl++ will be linked.

libgsoap supplies both libgsoap++.a and libgsoapssl++.a however an
application should link to one of those libraries not both.

An example from gsoap-2.8 samples:

With SSL:
/usr/bin/clang++ -DLINUX -g -O2   -o json-GitHub json_GitHub-json-GitHub.o json_GitHub-xml-rpc.o json_GitHub-json.o  json_GitHub-soapC.o ../../../gsoap/libgsoapssl++.a -lm -lssl -lcrypto -lz

Without SSL:
/usr/bin/clang++ -DLINUX -g -O2   -o json-currentTimeServer json-currentTimeServer.o xml-rpc.o json.o  soapC.o ../../../gsoap/libgsoap++.a -lm -lpthread

Right now src/CMakeLists.txt is try to link to both libgsoap++ and
libgsoapssl++.

/usr/bin/ld: /lib/libgsoapssl++.a(libgsoapssl___a-stdsoap2_ssl_cpp.o): in function `soap_query':
(.text+0x1880): multiple definition of `soap_query'; /lib/libgsoap++.a(libgsoap___a-stdsoap2_cpp.o):(.text+0x1890): first defined here
/usr/bin/ld: /lib/libgsoapssl++.a(libgsoapssl___a-stdsoap2_ssl_cpp.o): in function `soap_query_decode':
(.text+0x18a0): multiple definition of `soap_query_decode'; /lib/libgsoap++.a(libgsoap___a-stdsoap2_cpp.o):(.text+0x18b0): first defined here
/usr/bin/ld: /lib/libgsoapssl++.a(libgsoapssl___a-stdsoap2_ssl_cpp.o): in function `soap_query_key':
(.text+0x1a50): multiple definition of `soap_query_key'; /lib/libgsoap++.a(libgsoap___a-stdsoap2_cpp.o):(.text+0x1a60): first defined here

Change src/CMakeLists.txt so that

1. libgsoap++ is the default library to link
2. libgsoapssl++ is linked to instead if HAVE_OPENSSL is true

This means that if openssl is not detected libgsoap++ will be linked
otherwise libgsoapssl++ will be linked.

Signed-off-by: Bryan O'Donoghue <[email protected]>
@connortechnology connortechnology merged commit 75cd5e6 into ZoneMinder:master Oct 13, 2024
15 of 18 checks passed
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.

2 participants