Arama butonu
Bu konudaki kullanıcılar: 1 misafir
1
Cevap
593
Tıklama
0
Öne Çıkarma
/usr/bin/ld: cannot find -lnetcdf Bir türlü çözemiyorum.
Ç
4 yıl
Onbaşı
Konu Sahibi

Herkese merhabalar, genelde forumlar da bir şey paylaşan biri değilimdir ama artık hiç bir yöntemle sorunumu çözemediğim için sizleri rahatsız ediyorumhttps://stackoverflow.com/questions/62515709/usr-bin-ld-cannot-find-lnetcdf?noredirect=1#comment110588326_62515709,bu konunun muadilini öncesinde stackoverflow da açtım pek bir sonuç alamadım. Öncelikle linux sistemleri konusunda acemiyim. Anlatırken basit bir dille anlatırsanız çok sevinirim.Lütfen aklınıza gelen öneriyi yazmaktan çekinmeyin.

Öncelikle MMIF(User’s ManualTHE MESOSCALE MODELINTERFACE PROGRAM) adında bir yazılım var bunu kurmaya çalışıyorum. Program gfortran ihtiyaç duyuyor. Kurulumunu;
sudo apt-get update
sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin l****tcdff-dev
yaptım.

****Bu kısımda kütüphane için.****

export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS=-m64
export F77=gfortran
export FFLAGS=-m64
export NETCDF=/usr
export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"
export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include"

***nc-config --all***
This netCDF 4.6.0 has been built with the following features: 

 --cc    -> /usr/bin/cc
 --cflags  -> -I/usr/include -I/usr/include/hdf5/serial
 --libs   -> -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf -lhdf5_hl -lhdf5 -lpthread -lsz -lz -ldl -lm -lcurl

 --has-c++  -> no
 --cxx    -> 

 --has-c++4 -> no
 --cxx4   -> 

 --has-fortran-> yes
 --fc    -> gfortran
 --fflags  -> -I/usr/include
 --flibs   -> -L/usr/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf
 --has-f90  -> no
 --has-f03  -> yes

 --has-dap  -> yes
 --has-dap2 -> yes
 --has-dap4 -> yes
 --has-nc2  -> yes
 --has-nc4  -> yes
 --has-hdf5 -> yes
 --has-hdf4 -> no
 --has-logging-> no
 --has-pnetcdf-> no
 --has-szlib -> no
 --has-cdf5 -> no
 --has-parallel-> no

 --prefix  -> /usr
 --includedir-> /usr/include
 --libdir  -> /usr/lib/x86_64-linux-gnu
 --version  -> netCDF 4.6.0


***nf-config --all***

This netCDF-Fortran 4.4.4 has been built with the following features: 

 --cc    -> gcc
 --cflags  -> -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2

 --fc    -> gfortran
 --fflags  -> -I/usr/include
 --flibs   -> -L/usr/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf 
 --has-f90  -> no
 --has-f03  -> yes

 --has-nc2  -> yes
 --has-nc4  -> yes

 --prefix  -> /usr
 --includedir-> /usr/include
 --version  -> netCDF-Fortran 4.4.4

***MMIF makefile***

# GNU gfortran (Windows or Linux, just set NETCDF below correctly)
FC = gfortran
FFLAGS = -g -Wall
FFLAGS += -fbounds-check     # for bounds checking/debugging
FFLAGS += -static         # to use static libraries
NETCDF = /usr

# NETCDF values that are the same for all compilers
INCL = -I/usr/include
LIBS = -L/usr/bin/x86_64-linux-gnu -lnetcdff -lnetcdf

#LIBS = -L/usr/bin/x86_64-linux-gnu -L/usr/lib -lnetcdff -lnetcdf
# -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib

# sudo ln -s /usr/lib/x86_64-linux-gnu/l****tcdf.so /usr/lib/l****tcdf.so
# sudo ln -s /usr/local/cuda/lib64/libcudart.so /usr/lib/libcudart.so
PROGRAM = mmif

TODAY  = 2019-04-21
VERSION = 3.4.1
NEWTAG = 3.4.1 2019-03-11
OLDTAG = 3.4.1 2019-03-01

MODULES = met_fields.f90 functions.f90 module_llxy.f90 wrf_netcdf.f90   \
parse_control.f90

SOURCES = aggregate.f90 avg_zface.f90 cloud_cover.f90 interpolate.f90   \
landuse.f90 mmif.f90 output_aercoare.f90 output_aermet.f90    \
output_calmet.f90 output_onsite.f90 output_scichem.f90      \
pasquill_gifford.f90 pbl_height.f90 read_mm5.f90 read_wrf.f90   \
sfc_layer.f90 timesubs.f90 

OBJECTS = $(SOURCES:.f90=.o)
MODOBJS = $(MODULES:.f90=.o)
MODMODS = $(MODULES:.f90=.mod)

$(PROGRAM): $(MODOBJS) $(OBJECTS)
$(FC) $(FFLAGS) $(MODOBJS) $(OBJECTS) $(LIBS) -o $@

%.o : %.f90 
$(FC) $(FFLAGS) $(INCL) -c $< -o $@

install: $(PROGRAM)
cp $(PROGRAM) /usr/local/bin

update_version: 
sed -i "s|VERSION $(OLDTAG)|VERSION $(NEWTAG)|g" \
*.f90 README.txt makefile makefile.windows mmif_change_log.txt

distro: 
mmif --sample > mmif.inp
unix2dos *.f90 *.sh makefile.windows old_compile.bat README*.txt mmif.inp
zip -j MMIFv$(VERSION)_$(TODAY).zip \
mmif.exe mmif mmif.inp *.f90 *.sh makefile \
makefile.windows old_compile.bat README*.txt \
MMIFv$(VERSION)_Users_Manual.pdf \
mmif_change_log.txt test_problems/*/*.inp
dos2unix *.f90

test_pkg: 
zip -r MMIFv$(VERSION)_test_problems.zip \
test_problems -x \*/wrf/\* \*/mm5/\*

test_pkg_mm5+wrf:
zip -r MMIF_test_problems_mm5+wrf.zip \
test_problems/wrf \
test_problems/mm5

clean:
rm $(MODMODS) $(MODOBJS) $(OBJECTS) $(PROGRAM)

***Bu düzenlemeler sonrası "Make" yapıyorum ve çıkan hata..***

gfortran -g -Wall -fbounds-check      -static         met_fields.o functions.o module_llxy.o wrf_netcdf.o parse_control.o aggregate.o avg_zface.o cloud_cover.o interpolate.o landuse.o mmif.o output_aercoare.o output_aermet.o output_calmet.o output_onsite.o output_scichem.o pasquill_gifford.o pbl_height.o read_mm5.o read_wrf.o sfc_layer.o timesubs.o -L/usr/bin/x86_64-linux-gnu -lnetcdff -lnetcdf -o mmif
/usr/bin/ld: cannot find -lnetcdf
collect2: error: ld returned 1 exit status
makefile:67: recipe for target 'mmif' failed
make: *** [mmif] Error 1

***LD_DEBUG=all make***

   3133:
   3132: symbol=strchr; lookup in file=/usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0]
   3132: symbol=strchr; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3132: binding file /usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `strchr' [GLIBC_2.2.5]
   3132: symbol=__sprintf_chk; lookup in file=/usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0]
   3132: symbol=__sprintf_chk; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3132: binding file /usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `__sprintf_chk' [GLIBC_2.3.4]
   3132: symbol=strtoul; lookup in file=/usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0]
   3132: symbol=strtoul; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3132: binding file /usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `strtoul' [GLIBC_2.2.5]
   3132: symbol=__vsprintf_chk; lookup in file=/usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0]
   3132: symbol=__vsprintf_chk; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3132: binding file /usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `__vsprintf_chk' [GLIBC_2.3.4]
collect2: error: ld returned 1 exit status
   3132: symbol=exit; lookup in file=/usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0]
   3132: symbol=exit; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3132: binding file /usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `exit' [GLIBC_2.2.5]
   3132: symbol=__lxstat; lookup in file=/usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0]
   3132: symbol=__lxstat; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3132: binding file /usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `__lxstat' [GLIBC_2.2.5]
   3132:
   3132: calling fini: /usr/lib/gcc/x86_64-linux-gnu/7/collect2 [0]
   3132:
   3131: symbol=unlink; lookup in file=gfortran [0]
   3131: symbol=unlink; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3131: binding file gfortran [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `unlink' [GLIBC_2.2.5]
   3131:
   3131: calling fini: gfortran [0]
   3131:
   3130: symbol=realloc; lookup in file=make [0]
   3130: symbol=realloc; lookup in file=/lib/x86_64-linux-gnu/libdl.so.2 [0]
   3130: symbol=realloc; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0]
   3130: binding file /lib/x86_64-linux-gnu/libc.so.6 [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `realloc' [GLIBC_2.2.5]
makefile:67: recipe for target 'mmif' failed
make: *** [mmif] Error 1
   3130:
   3130: calling fini: make [0]
   3130:
   3130:
   3130: calling fini: /lib/x86_64-linux-gnu/libdl.so.2 [0]
   3130:

***ld -lnetcdf --verbose***
attempt to open //usr/lib/x86_64-linux-gnu/libfakeroot/libcrypt.so.1 failed
attempt to open //usr/local/lib/libcrypt.so.1 failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libcrypt.so.1 failed
found libcrypt.so.1 at //lib/x86_64-linux-gnu/libcrypt.so.1
ld: warning: cannot find entry symbol _start; not setting start address


Ne yaparsam yapayım /usr/bin/ld -netcdf sorunu çözemedim. en ufak bir yardımınız bile benim için önemlidir. Teşekkür ederim.





< Bu mesaj bu kişi tarafından değiştirildi ÇevreciMühendis -- 13 Ekim 2020; 19:11:53 >

I
4 yıl
Binbaşı

Biraz araştırma ile sorunun çözümü kolayca bulunabilir. Sorununuz eksik bir library sorunu gibi görünüyor. Eksik veya ilgili dosyanın ismi farklı bir şekilde olmalı

Burdan ilgili paketi derledinizmi
https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.