Does anybody know the underlying sorcery behind libgmp??

I am working on compiling a program (hires_ifr.c) on Red Hat Enterprise Linux 7.9 that previously had no issues. It is now failing to find the gmp library in the linking stage:

amitkus$ ifort -nofor_main -vec_report0 -prec_div  -i-dynamic -mcmodel=large 
-fp-model precise -fp-model no-except -Bstatic -O3  -openmp  -integer_size 32 
-real_size 64 -double_size 64 -align all    /data//obj/hires_ifr.o 
/data//obj/coord.o /data//obj/mycoeff.o /data//obj/cube_netcdf.o 
/data//obj/cube_read.o /data//obj/mvhd.o /data//obj/mask.o /data//obj/igrf.o 
/data//obj/elliptic_quad_gmp.o /data//obj/fftmethod.o /data//obj/alf.o 
/data//obj/alf_quad.o  /data//obj/magfast.o /data//obj/egm96.o 
/data//obj/utm_trans.o  /data//obj/TMLib.o  /data//obj/nad27_f.o 
/data//obj/nad83_f.o  /data//obj/etopo_file.o /data//obj/akima_760.o 
/data//obj/mainfield.o /data//obj/int-ext.o /data//obj/omni.o 
/data//obj/gsm2geo.o  /data//obj/sm2geo.o /data//obj/plmbar.o 
/data//obj/magfdz.o /data//obj/my_bggm.o /data//obj/my_bggm_read.o 
/data//obj/bggmc.o /data//obj/tmjd_C.o /data//obj/tjuda_C.o 
/data//obj/idbl_C.o /data//obj/dbl_C.o  /data//obj/calend_C.o 
/data//obj/totalg_grid.o /data//obj/egm_grid.o /data//obj/etopo_red.o  
/data//obj/libfftpack.a -L/usr/lib64 -lgmp -L/opt/GMT/netcdf-3.6.3/lib - 
lnetcdf -L/nfs/Geophysics/IFR-1/obj -lnag -o /data//exe/hires_ifr

compile ld error

I have confirmed that the .so library exists in that location: so library exists in specified location

I have also tried a test compilation (with gcc) of something else which makes use of the gmp library, and this one strangely compiles correctly no matter what I do. In fact, I can screw up the library location and it still works.

gcc -Wall -O3 randPi.c -L/usr/badpath/lib64 -lgmp -o randPi

-lgmp works elsewhere even with bad path

LD_LIBRARY_PATH does not have /usr/lib on it, but I have that being added to LD_LIBRARY_PATH in my ~/.bashrc, and my understanding is that just modifies it as an environmental variable for the compilation and then reverts back.

declare -x LD_LIBRARY_PATH=/home/ec2-user/lib
declare -x LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/:/opt/netcdf/lib64

declare -x LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64


I would be super grateful for any input, and am happy to provide any more needed context!

  • Welcome to the site. Please don't post screenshots of console output. They are often difficult to read, the content will not show up in search enginre results, and contributors trying to help will have to type-copy content when trying to analyze/reproduce your problem. Instead, paste it into the question using code formatting. – AdminBee Jan 22 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.