Sample Header Ad - 728x90

Cannot find mqic library when compiling Mqueue-sending C program

0 votes
0 answers
55 views
On our linux dev server for an application at work, we have an in-house C program called sendFile to, well, send files to the Mqueue. The program has seemingly not been changed since its creation in 2011 and works well enough as is, but I recently tried to add something to it (a 3rd queue definition), and ran into issues when trying to compile it. The compiling command, which I assembled from the makefile, is as follows : gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer sendFile.c -o sendFile -I/opt/mqm/inc -L/opt/mqm/lib/ -lmqic The last part, -lmqic, is what's causing issues. Specifically, I get this : /bin/ld: skipping incompatible /opt/mqm/lib//libmqic.so when searching for -lmqic /bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/8/../../../libmqic.so when searching for -lmqic /bin/ld: skipping incompatible //lib/libmqic.so when searching for -lmqic /bin/ld: skipping incompatible //usr/lib/libmqic.so when searching for -lmqic /bin/ld: cannot find -lmqic collect2: error: ld returned 1 exit status And when I remove that argument, I get errors due to undefined reference to MQOPEN, MQCONN, MQCLOSE, etc. (functions of the mqic library, I presume). Per the ldd command, I was able to see which libraries are used by the program : linux-vdso.so.1 (0x00007ffcd63e9000) libmqic.so => /opt/mqm/lib64/libmqic.so (0x00007faf14597000) libc.so.6 => /usr/lib64/libc.so.6 (0x00007faf141d2000) libmqe.so => /opt/mqm/lib64/libmqe.so (0x00007faf135f6000) libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007faf133f2000) libm.so.6 => /usr/lib64/libm.so.6 (0x00007faf13070000) /lib64/ld-linux-x86-64.so.2 (0x00007faf1479b000) librt.so.1 => /usr/lib64/librt.so.1 (0x00007faf12e68000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007faf12ad3000) libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007faf128b3000) libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007faf1269b000) The /opt/mqm/lib64/libmqic.so library seems to be exactly what -lmqic refers to, and does exist on the server, so I'm rather puzzled as to why the compiler somehow can't find it. I did try to yum install mqic (in case the version on the server is incompatible as the error messages seem to suggest), but it didn't seem to exist under that name (though maybe I need to name it differently). Thanks in advance for any help! It's likely a very easy solution, and I'll be glad to be the fool if so.
Asked by Gael L (131 rep)
Sep 3, 2024, 06:27 PM