Libxml2 manual installation

Hello people,

I want to install Libxml2 librairy v2.9.12 ( Index of /sources/libxml2/2.9/ ) with the SDK.

I use module manager so I select this package:
cuda/sdk_13/modulefiles/nvhpc-hpcx-cuda13/25.11

Then I configure like follow:
./configure --prefix=/usr/local/Modules/modulefiles/libxml2/2.9.12_nvidia

Then when I want to compile I have an issue I don’t have with gcc:
make[2] : on entre dans le répertoire « /home/lamn7/Documents/libxml2-2.9.12 »
CCLD xmllint
CCLD xmlcatalog
/usr/bin/ld: xmlcatalog.o: in function main': /home/lamn7/Documents/libxml2-2.9.12/xmlcatalog.c:341:(.text+0x29): undefined reference to xmlCheckVersion’
/usr/bin/ld: /home/lamn7/Documents/libxml2-2.9.12/xmlcatalog.c:352:(.text+0x4f): undefined reference to xmlCatalogSetDebug' /usr/bin/ld: /home/lamn7/Documents/libxml2-2.9.12/xmlcatalog.c:416:(.text+0x386): undefined reference to xmlInitializeCatalog’
/usr/bin/ld: /home/lamn7/Documents/libxml2-2.9.12/xmlcatalog.c:419:(.text+0x397): undefined reference to `xmlLoadCatalog’
….
….

It seems with nvcc, the link toward ./include/libxml don’t work anymore and I would like to know why.

If someone has any idea how to deal this problem…

Thanking you in advance.

Hi - I’ll pull this down and take a look at it. If I need anymore information from you, I’ll ping you. Thanks!

Hmm. This one is tricky. It definitely seems like something is going wrong with the linking line, and I’m not quite sure why. Everything looks like it should work, but it doesn’t. Definitely appears to be a compiler problem. I need to look at this a little longer before I can open an issue with engineering for it.

I did find a work around that worked for me - after make failed, I opened the libxml2.la file and added “-lxml2” to the “dependency_libs” section. Then make again will finish. That sorted out the linking line for me and got me to the end of the build.

Or, alternatively, if you run “make -n -j1 V=1”, you can find the command that gets executed to try to generate the xmllint exe that crashes during compilation. You should be able to run that line, take the resulting compilation line and recreate it with pointing to the right library. I had to pull the libxml2.so file out of the .libs directory into the working directory, but then I just manually changed the compilation line to include “-lxml2” and it worked fine.

When I have an issue open for this, I’ll come back and give you the issue number. Sorry for the problem here! Do you have a version of NVHPC that worked with this before? Or is this your first time building it with NVHPC?

Hello, firstly thank you very much for your help.

Ok I see what to do and again thank you. I was completely lost and believing it was a issue with libxml folder.

About my use of NVHPC, this is the first time I am using it as a tool to compile from scratch all my work librairies.

After test:

“I did find a work around that worked for me - after make failed, I opened the libxml2.la file and added “-lxml2” to the “dependency_libs” section. Then make again will finish. That sorted out the linking line for me and got me to the end of the build.”

I try that immediately after the fail of make command, insert -lxml2 to the dependency_libs section then make again and got:
CCLD xmllint
/usr/bin/ld: cannot find -lxml2: No such file or directory

So I pull out of .libs the libxml2.* files and it doesn’t work either.
I also tried to add the path to LD_LIBRARY_PATH but I got previous error link.

I removed this and try to include -lxml2 into the makefile like this:
xmllint$(EXEEXT): $(xmllint_OBJECTS) $(xmllint_DEPENDENCIES) $(EXTRA_xmllint_DEPENDENCIES)
@rm -f xmllint$(EXEEXT)
$(AM_V_CCLD)$(xmllint_LINK) $(xmllint_OBJECTS) $(xmllint_LDADD) $(LIBS) -lxml2

and got the same trouble as before with an error link.

I don’t know what is going on.

Update:

Just to try, I downloaded the new 2.16.0 version ( https://gitlab.gnome.org/GNOME/libxml2/-/tree/master ) then I did this:
./autogen.sh

In folder ./ open configure and at line:
113859
EXTRA_CFLAGS=“${EXTRA_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls”
replace by
EXTRA_CFLAGS="${EXTRA_CFLAGS} "

13861
EXTRA_CFLAGS=“${EXTRA_CFLAGS} -Wno-long-long -Wno-format-extra-args”
replace by
EXTRA_CFLAGS="${EXTRA_CFLAGS} "

./configure --prefix=/usr/local/Modules/modulefiles/libxml2/2.16.0_nvidia
make
sudo make install

And this time is works fine with nvc as proven by this line:
checking for gcc… /usr/local/Modules/modulefiles/cuda/sdk_13/Linux_x86_64/25.11/compilers/bin/nvc

Again thank you a lot for your help and I let you decide if you want to close this topic.

Best regards

Okay - if it’s working for you now, I’ll consider the matter good. I’ll probably privately investigate why we got such issues with the libraries and try to get those resolved. If we find it and fix it, I’ll ping you just so you know. :)

So I spent the day playing with the 2.9.12 builds - I think it has to do with the elfgcchack.h file changing some things. I emptied that file and everything built out of the box just fine with CC=nvc. I assume this is just another library build system issue like we saw with the libz issue you opened. Maybe your autoconfig of 2.16 avoided that somehow or another.

Thank you very very much for the time you spent on my issues. I try to learn at most and your help is very valuable.