Re: a new user's question

From: Xianghui Xue <xhxue_at_nyahnyahspammersnyahnyah>
Date: Fri, 17 Jul 2009 08:24:59 +0800

I try to install gfortran 4.1 and use command
 gfortran-4.1 -fPIC -fno-second-underscore -fno-range-check -O -o cpex08
cpexcc.f cpex08.f -L/usr/local/lib -L/usr/lib -lncarg -lncarg_gks -lncarg_c
-lX11 -lXext -lpng -lz -lgfortran

However the information is:
/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crt1.o: In function
`_start':
(.text+0x18): undefined reference to `main'
collect2: ld 返回 1
It seems _gfortran_copy_string thing is due to the fortran version, but this
problem is ?

---------------------------------------------------
Xianghui XUE
---------------------------------------------------

On Fri, Jul 17, 2009 at 12:20 AM, Mary Haley <haley_at_ucar.edu> wrote:

>
> On Thu, 16 Jul 2009, Xianghui Xue wrote:
>
> Hi Mary,
>> You are right, I check the ncl-ncarg src install direction, and I found
>> that I miss libpng, so I download it and installed, one prolem dealed, and
>> another coming up.
>>
>> Compiling and linking...
>> gfortran -fPIC -fno-second-underscore -fno-range-check -O -o cpex08
>> cpexcc.f
>> cpex08.f -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -lX11 -lXext -lpng
>> -lz
>> /usr/local/lib/libncarg.a(cpcldm.o): In function `cpcldm_':
>> cpcldm.f:(.text+0x8ab): undefined reference to `_gfortran_copy_string'
>> cpcldm.f:(.text+0xf36): undefined reference to `_gfortran_copy_string'
>> cpcldm.f:(.text+0xfc8): undefined reference to `_gfortran_copy_string'
>> cpcldm.f:(.text+0x10bd): undefined reference to `_gfortran_copy_string'
>> cpcldm.f:(.text+0x11c4): undefined reference to `_gfortran_copy_string'
>> /usr/local/lib/libncarg.a(cpcldm.o):cpcldm.f:(.text+0x127f): more
>> undefined
>> references to `_gfortran_copy_string' follow
>> collect2: ld return 1
>> The compile and link failed.
>>
>> I am so sorry for bring so much trouble for you!
>>
>
> You may need to include the gfortran system library:
>
> gfortran -fPIC -fno-second-underscore -fno-range-check -O -o cpex08
> cpexcc.f cpex08.f -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c
> -lX11 -lXext -lpng -lz -lgfortran
>
>
> --Mary
>
>
> ---------------------------------------------------
>> Xianghui XUE
>> On Thu, Jul 16, 2009 at 11:26 PM, Mary Haley <haley_at_ucar.edu> wrote:
>>
>> Xianghui,
>>>
>>> NCAR Graphics has an internal PNG writer, and hence you need to
>>> load the PNG library when compiling an NCAR Graphics program.
>>>
>>> If you only need to use NCL, I wouldn't worry about this.
>>>
>>> However, if you need to use NCAR Graphics, you will need to install
>>> the PNG library, which is pretty easy.
>>>
>>> - Go to: http://www.libpng.org/pub/png/libpng.html
>>>
>>> - Download the ".tar.gz" file on the "prdownloads.sourceforge.net"
>>> line under the "with config script" column.
>>>
>>> - Go to where the file is and type:
>>>
>>> gunzip libpng-1.2.37.tar.gz
>>> tar -xvf libpng-1.2.37.tar
>>> cd libpng-1.2.37
>>> ./configure --prefix=/path/for/software
>>> make all install
>>>
>>> Be sure to replace "/path/for/software" with whatever pathname
>>> you want for this software. It would be easiest if you put it in
>>> "/usr/local".
>>>
>>> If this is successful, you should be able to compile the "cpex08"
>>> example.
>>>
>>>
>>> --Mary
>>>
>>> On Thu, 16 Jul 2009, Xianghui Xue wrote:
>>>
>>> Hi Mary,
>>>
>>>> It does work!
>>>> When I try to ncl gsun01n.ncl, I see the figures. However when I try
>>>> ncargex cpex08, something is wrong as following:
>>>> -----------------------------------------------------------------
>>>> NCAR Graphics Fortran Example <cpex08>
>>>> Copying cpex08.f
>>>> Copying cpexcc.f
>>>> Compiling and linking...
>>>> gfortran -fPIC -fno-second-underscore -fno-range-check -O -o cpex08
>>>> cpexcc.f
>>>> cpex08.f -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -lX11 -lXext
>>>> -lpng
>>>> -lz
>>>> /usr/bin/ld: cannot find -lpng
>>>> collect2: ld 返回 1
>>>> The compile and link failed.
>>>> ----------------------------------------------------------
>>>>
>>>> How to deal with it ? Thank you for your help!
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------
>>>> Xianghui XUE
>>>>
>>>>
>>>> On Thu, Jul 16, 2009 at 10:46 PM, Mary Haley <haley_at_ucar.edu> wrote:
>>>>
>>>>
>>>> On Thu, 16 Jul 2009, Xianghui Xue wrote:
>>>>>
>>>>> Hi Mary,
>>>>>
>>>>> My gcc version is 4.2.4 and Linux version is i686, and there are two
>>>>>> files
>>>>>> NCL 5.1.1 32-bit binary for i686 chips for LINUX (compiled with gcc
>>>>>> 4.1.2)
>>>>>> NCL 5.1.1 32-bit binary for i686 chips for LINUX (compiled with gcc
>>>>>> 4.3.2)
>>>>>> So is the gcc lower version 4.1.2 is my best choice?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>>
>>>>>> Yes, that would be the best choice.
>>>>>
>>>>> --Mary
>>>>>
>>>>>
>>>>> ---------------------------------------------------
>>>>>
>>>>> Xianghui XUE
>>>>>>
>>>>>> On Thu, Jul 16, 2009 at 1:21 PM, Mary Haley <haley_at_ucar.edu> wrote:
>>>>>>
>>>>>> Xianghui,
>>>>>>
>>>>>>
>>>>>>> I highly recommend installing NCL from a precompiled binary and not
>>>>>>> source code. I believe there's a yum installation NCL that you can
>>>>>>> try.
>>>>>>>
>>>>>>> Otherwise, you have a Linux system, and we provide binaries for
>>>>>>> several Linux/compiler combinations. I recommend getting a
>>>>>>> non-OPeNDAP
>>>>>>> enabled binary.
>>>>>>>
>>>>>>> To determine which binary you need, on your Linux machine type:
>>>>>>>
>>>>>>> uname -m
>>>>>>> gcc --version
>>>>>>>
>>>>>>> If "uname -m" reports "x86_64", then you need a 64-bit version. If
>>>>>>> it
>>>>>>> reports something like "i386", then you need a 32-bit version.
>>>>>>>
>>>>>>> "gcc --version" will give you the gcc version.
>>>>>>>
>>>>>>> Here are the various binaries we provide. Hopefully one of them
>>>>>>> matches your system:
>>>>>>>
>>>>>>> 32-bit binary for i686 chips for LINUX (compiled with gcc 4.1.2)
>>>>>>> 32-bit binary for i686 chips for LINUX (compiled with gcc 4.3.2)
>>>>>>> 64-bit binary for IA64 chips for LINUX (compiled with gcc 4.1.2)
>>>>>>> 64-bit binary for x86_64 chips for LINUX (compiled with gcc 3.3.0)
>>>>>>> 64-bit binary for x86_64 chips for LINUX (compiled with gcc 4.1.2)
>>>>>>> 64-bit binary for x86_64 chips for LINUX (compiled with gcc 4.2.2)
>>>>>>> 64-bit binary for x86_64 chips for LINUX (compiled with gcc 4.3.2)
>>>>>>>
>>>>>>> Once you download the file, go to:
>>>>>>>
>>>>>>> http://www.ncl.ucar.edu/Download/install.shtml
>>>>>>>
>>>>>>> for instructions.
>>>>>>>
>>>>>>> --Mary
>>>>>>>
>>>>>>>
>>>>>>> On Thu, 16 Jul 2009, Xianghui Xue wrote:
>>>>>>>
>>>>>>> Hi, sorry for troubling you!
>>>>>>>
>>>>>>>
>>>>>>> I am a new user of NCL. I try to install ncl_ncarg-5.1.1 on Ubuntu
>>>>>>>> 7.10
>>>>>>>> according to the install direction of NCL. Before install NCL, I
>>>>>>>> installed the needed software and lib such as JPEG, Zlib, netcdf-4
>>>>>>>> (with
>>>>>>>> HDF5), and when I installed the HDF-4.0 (ver 4.2r4), problem
>>>>>>>> started:
>>>>>>>>
>>>>>>>> when typing:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -------------------------------------------------------------------------------------------------
>>>>>>>> ./configure --prefix=/usr/local --with-zlib=/usr/local \
>>>>>>>> --with-jpeg=/usr/local --includedir=/usr/local/include/hdf \
>>>>>>>> --disable-netcdf
>>>>>>>> make all install
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------------------------------------
>>>>>>>> and the result is :
>>>>>>>> .......
>>>>>>>> libtool: link: gcc -O3 -fomit-frame-pointer -o ncgen close.o
>>>>>>>> escapes.o
>>>>>>>> generate.o genlib.o getfill.o init.o load.o main.o ncgentab.o
>>>>>>>> -L/usr/local/lib ../libsrc/.libs/libmfhdf.a
>>>>>>>> ../../hdf/src/.libs/libdf.a
>>>>>>>> /usr/local/lib/libjpeg.so -lz -lm
>>>>>>>> ncgentab.o: In function `main':
>>>>>>>> ncgentab.c:(.text+0x0): multiple definition of `main'
>>>>>>>> main.o:main.c:(.text+0x30): first defined here
>>>>>>>> main.o: In function `main':
>>>>>>>> main.c:(.text+0x55): undefined reference to `yyin'
>>>>>>>> main.c:(.text+0x7d): undefined reference to `yyout'
>>>>>>>> main.c:(.text+0x1a9): undefined reference to `yyin'
>>>>>>>> ncgentab.o: In function `yyparse':
>>>>>>>> ncgentab.c:(.text+0x580): undefined reference to `yylex'
>>>>>>>> collect2: ld returned 1 exit status
>>>>>>>> make[2]: *** [ncgen] error 1
>>>>>>>> make[2]:Now leaving dir `/mnt/hgfs/NCAR/Linux/HDF4.2r4/mfhdf/ncgen'
>>>>>>>> make[1]: *** [all-recursive] error 1
>>>>>>>> make[1]:Now leaving dir `/mnt/hgfs/NCAR/Linux/HDF4.2r4/mfhdf'
>>>>>>>> make: *** [all-recursive] error 1
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -----------------------------------------------------------------------------------------------------
>>>>>>>>
>>>>>>>> I have installed the m4, flex and bison, I don't know how to figure
>>>>>>>> it
>>>>>>>> out!
>>>>>>>>
>>>>>>>> Can you give me some advice?
>>>>>>>>
>>>>>>>> Best wishes
>>>>>>>> ---------------------------------------------------
>>>>>>>> Xianghui XUE
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
Received on Thu Jul 16 2009 - 18:24:59 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 17 2009 - 15:27:02 MDT