cybertextron
cybertextron

Reputation: 10981

linking g++ and lib in the make file not working

I'm compiling with g++, but when I run make, I get the following error:

    ./libnbmdt.so: undefined reference to `inflateInit2_'
    ./libnbmdt.so: undefined reference to `zlibVersion'
    ./libnbmdt.so: undefined reference to `inflate'
    ./libnbmdt.so: undefined reference to `inflateInit_'
    ./libnbmdt.so: undefined reference to `inflateEnd'
    collect2: ld returned 1 exit status
    make[2]: *** [nbbid2md] Error 1
    make[1]: *** [all] Error 2
    make: *** [nb/nbmdt] Error 1

Has anyone seen this before? I guess -l<somelibrary> is needed, but I don't know which one ... it's a c++ program by the way. I guess zlib is missing when g++ tries to link them? some of the libraries being used are:

MT_VLIBS = \
libjansson.a \
libnbI18N.a \
libnbslidlC.a \
libnbslidlS.a \
libcurl.a \
libVdb \
libnborb \
libnbbase \
-lvxul \
-lvxssl \
-lvxcrypto

I can't share the makefile unfortunately. Thanks

Upvotes: 1

Views: 2988

Answers (2)

cybertextron
cybertextron

Reputation: 10981

I solved the problem today by adding a $if condition on my makefile in other to use -lz flag. It's sort of complicated, but I got it solved.

Upvotes: 1

Viktor Latypov
Viktor Latypov

Reputation: 14467

You are right - the "-lz" flag is the one to be used. The ZLib is not linked thus not "inflate" functions.

Mind the following: "-lz" must be after "-lnb*" stuff, because the linking order is important with GCC toolchain.

Upvotes: 1

Related Questions