Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22016

Libxml2: static or not static

$
0
0

My question is quite simple: Can we compile statically when using the libxml2?Actually, I spent an all day searching how it was possible to do that, but I clearly failed.When I run the following command line:

gcc -o exec `xml2-config --cflags` io1.c `xml2-config --libs` -static

I get a bunch of errors:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libxml2.a(nanohttp.o) : dans la fonction « xmlNanoHTTPConnectHost » :(.text+0xb3b): avertissement : Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking/usr/bin/ld: (.text+0x9ba): avertissement : Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking/usr/bin/ld : /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libxml2.a(xpath.o) : dans la fonction « xmlXPathStringEvalNumber.part.0 » :(.text+0x1f71) : référence indéfinie vers « pow »/usr/bin/ld : (.text+0x1ffb) : référence indéfinie vers « pow »...

When I use cmake it is stranger because I can compile but the executable does not work.

find_package(LibXml2 REQUIRED)include_directories(${LIBXML2_INCLUDE_DIRS})# create an executableadd_executable(conspiler ${SRCS} ${HEADERS})target_compile_options(conspiler PUBLIC -std=c++11 -Wall -lz -O3 -lgmpxx -lgmp)target_link_libraries (conspiler -lz -O3 -lgmpxx -lgmp libpatoh.a ${LIBXML2_LIBRARIES} -static)install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/conspilerDESTINATION binRENAME ${CMAKE_PROJECT_NAME}-conspiler)

I get (in french, but that means the executable cannot be found oO):

bash: ./conspiler: Aucun fichier ou dossier de ce type

Best regards,JM


Viewing all articles
Browse latest Browse all 22016

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>