[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #YWM-423085]: NetCDF: linking libraries



Hello,

No worries at all; I will try my best to help you figure out what's going on.  
I also work on OSX, but I'm not very familiar with XCode.  What you've 
described *should* work, although I have one quick question: what is the 
purpose of the following line?

    LIBS="-L$/Users/user/netcdf-4.4.0/lib -lnetcdf 
-L$/Users/user/hdf5-1.8.16/lib -lhdf5_hl -lhdf5 -L$/Users/user/zlib-1.2.8/lib 
-lz -lm”

You've already built netCDF, so these are not used when building netCDF, HDF5, 
etc.  The syntax is also a little bit funny, with the "$/Users"; I would 
typically say you should drop the '$' characters from that line, but again I'm 
not sure what it is being used for.  "LIBS" in this instance is a bash 
environmental variable, and will not be visible from XCode (I believe).

I note you mention that you are adding "usr/local/libnetcdf.a" to the Xcode 
project.  That *should* read '/usr/local/libnetcdf.a', note the leading '/' 
character.  Was this a typo on your part in the email, or is the leading slash 
also missing in Xcode? If it is missing, try adding it and let me know what 
happens.  The missing '/' would explain the issue you are seeing.

Since I have XCode, and if the above fix doesn't correct the issue (or is 
indeed just a typo in your email), can you provide the XCode project you are 
working with?  I can open it locally and see if anything leaps out at me.

Thanks, I hope this helps,

-Ward


> Hi,
> 
> Sorry for what is probably a really obvious question.
> 
> I’ve been successfully using the Anaconda NetCDF with Xcode 7 as my C IDE 
> (with OS X Yosemite).  Since Anaconda was incompatible with some other 
> software I’m working with, I uninstalled it and installed netCDF 4.4.0 as 
> described here: 
> http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html#build_default
> 
> After installing lib and hdf5, I installed netcdf as follows:
> CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
> ./configure --prefix=/usr/local
> make check
> sudo make install
> cd ..
> LIBS="-L$/Users/user/netcdf-4.4.0/lib -lnetcdf -L$/Users/user/hdf5-1.8.16/lib 
> -lhdf5_hl -lhdf5 -L$/Users/user/zlib-1.2.8/lib -lz -lm”
> 
> I then add /usr/local/netcdf.h and usr/local/libnetcdf.a to the Xcode 
> project, but get a linker error ( ld: library not found for -lnetcdf
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)).
> 
> 
> Do you know what I might be doing wrong or how I can successfully link the 
> libraries?  Any insight you could provide would be a great help.
> 
> 
> Thanks,
> 
> Bernice
> 
> 

Ticket Details
===================
Ticket ID: YWM-423085
Department: Support netCDF
Priority: Normal
Status: Closed