"/usr/bin/ld: cannot find library"

97,733

Solution 1

As ../libanne4.0/lib is a relative path, you might try changing it into an absolute one.

Also you could check whether the linker process has the rights to access and read the libs.


Update: To have the linker find a library specified using the option -l<name> the name of the libray shall be lib<name>.[a|so] and the parameter to -L should point the path were the library is located.

-L needs to preceed it's -l option(s).

One could specify -l and/or -L multiple times.

Solution 2

There is something wrong with the name "adwdmlib.a". A linking flag "-l adwdm" will tell the compiler to expect a lib file with the name "libadwdm.a", not "adwdmlib.a". Is this helpful or relevant? If your library name is "adwdmlib.a", that is probably why your linker can't find it.

Share:
97,733
TTT
Author by

TTT

Updated on July 09, 2022

Comments

  • TTT
    TTT almost 2 years

    This is my first time trying to compile FORTRAN code using a makefile. The OS is Ubuntu 12.04 LTS 64 bit. I encountered the following errors:

    gfortran  -o przm3123.exe canopy.o chem.o cnfuns.o cropdate.o datemod.o debug.o debug_cn.o f2kcli.o floatcmp.o furrow.o general.o i_errchk.o infnan.o inivar.o ioluns.o iosubs.o lambertw.o m_readvars.o utils.o wind.o fcscnc.o przm3.o rsexec.o rsinp1.o rsinp2.o rsinp3.o rsmcar.o rsmisc.o rsprz1.o rsprz2.o rsprz3.o rsprzn.o rsutil.o rsvado.o -L ../libanne4.0/lib -lwdm -ladwdm -lutil
    /usr/bin/ld: cannot find -lwdm
    /usr/bin/ld: cannot find -ladwdm
    collect2: ld returned 1 exit status
    make: *** [przm3123.exe] Error 1
    

    The key element in the makefile is:

    przm2_LIBS = -L ../libanne4.0/lib -lwdm -ladwdm -lutil
    

    Is there anything I can do to fix this error? Should I try other compilers?