LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   gcc and gfortran (https://www.linuxquestions.org/questions/linux-general-1/gcc-and-gfortran-4175469251/)

fereshteh 07-11-2013 04:12 AM

gcc and gfortran
 
hi dear
how and where can i determine cc and fc compilers in my system (fedora 16)?
i know that my system has those compilers but i think that their paths have not been defined for system because i check env file in etc/bin/ and dont see
CC=gcc
FC=gfortran
in env file.
please tell me how i can set them?
thanks

knudfl 07-11-2013 04:42 PM

CC = gcc : CC is always /usr/bin/gcc(-4.6.x), unless you specify different.
FC : The various fortran's are checked. If you have gfortran only,
/usr/bin/gfortran(-4.6.x) will be used. Unless the program to compile
specifically requires pgf90, ifort, "old g77 / f77", etc.

There is no such thing as setting a PATH for the "4000" default executable'.
But : Your PATH / the system PATH is set to /bin:/usr/bin:/usr/local/bin: ? :?
→ → Please try out the command $ env | grep PATH
... to know the default system settings.

Installing the Fedora compilers :
# yum install gcc-c++ gfortran compat-gcc-34-c++ compat-gcc-g77

Setting a different compiler, examples :
gcc34 file.c ; g++34 file.cpp ; g77 file.f ;
export CC=gcc34 CXX=g++34 && ./configure

-

John VV 07-11-2013 08:47 PM

but be warned
Fedora 16 is past it's end of life
the mirrors will be disappearing

Fedora 16 and 17 are no longer supported
only fedora 18 and 19 are

also of note g77 and gfortran are not the same
the old g77 is deprecated , but around for all the old code that is still usable
and a lot of it is still being used

fereshteh 07-14-2013 09:02 AM

gcc and g fortran
 
dear
i check my labtop defaul paths. i set up my labtop like pc system. in ps system i see cc=gcc and fc=gfortran but in labtop those mention paths dont exist.
see below:

[fereshteh@localhost ~]$ env
XDG_VTNR=1
MKLROOT=/opt/intel/Compiler/11.1/080/mkl
MANPATH=/opt/intel/Compiler/11.1/080/man/en_US:/opt/intel/Compiler/11.1/080/mkl/man/en_US:/opt/intel/Compiler/11.1/080/mkl/../man/en_US:/opt/intel/Compiler/11.1/080/man/en_US:/opt/intel/Compiler/11.1/080/mkl/man/en_US:/opt/intel/Compiler/11.1/080/mkl/../man/en_US:/opt/intel/Compiler/11.1/080/man/en_US:/opt/intel/Compiler/11.1/080/mkl/man/en_US:/opt/intel/Compiler/11.1/080/mkl/../man/en_US:/opt/intel/Compiler/11.1/080/man/en_US:/opt/intel/Compiler/11.1/080/mkl/man/en_US:/opt/intel/Compiler/11.1/080/mkl/../man/en_US:/usr/local/share/man:/usr/share/man
XDG_SESSION_ID=2
LC_MONETARY=en_US.utf8
HOSTNAME=localhost.localdomain
IMSETTINGS_INTEGRATE_DESKTOP=yes
GPG_AGENT_INFO=/tmp/keyring-uq51Rs/gpg:0:1
IPPROOT=/opt/intel/Compiler/11.1/080/ipp/ia32
INTEL_LICENSE_FILE=/opt/intel/Compiler/11.1/080/licenses:/opt/intel/licenses:/home/fereshteh/intel/licenses:/opt/intel/Compiler/11.1/080/licenses:/opt/intel/licenses:/home/fereshteh/intel/licenses:/opt/intel/Compiler/11.1/080/licenses:/opt/intel/licenses:/home/fereshteh/intel/licenses:/opt/intel/Compiler/11.1/080/licenses:/opt/intel/licenses:/home/fereshteh/intel/licenses
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=040bd5238ad97d2d598bb0f300000018-1373809743.353869-2016389964
HISTSIZE=1000
LIBRARY_PATH=/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/lib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/lib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/lib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/lib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib
GJS_DEBUG_OUTPUT=stderr
WINDOWID=33554437
LC_NUMERIC=en_US.utf8
FPATH=/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/mkl/include
GNOME_KEYRING_CONTROL=/tmp/keyring-uq51Rs
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
IMSETTINGS_MODULE=none
USER=fereshteh
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;0 1:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01 ;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:* .Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31 :*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ac e=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01 ;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35 :*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:* .m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv =01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01; 35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.a nx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka= 01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36 :*.xspf=01;36:*.pdf=00;33:*.ps=00;33:*.ps.gz=00;33:*.txt=00;33:*.patch=00;33:*.diff=00;33:*.log=00;3 3:*.tex=00;33:*.xls=00;33:*.xlsx=00;33:*.ppt=00;33:*.pptx=00;33:*.rtf=00;33:*.doc=00;33:*.docx=00;33 :*.odt=00;33:*.ods=00;33:*.odp=00;33:*.xml=00;33:*.epub=00;33:*.abw=00;33:*.html=00;33:*.wpd=00;33:
LD_LIBRARY_PATH=/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/sharedlib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/sharedlib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/sharedlib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/lib/ia32:/opt/intel/Compiler/11.1/080/ipp/ia32/sharedlib:/opt/intel/Compiler/11.1/080/mkl/lib/32:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib
LIB=/opt/intel/Compiler/11.1/080/ipp/ia32/lib:/opt/intel/Compiler/11.1/080/ipp/ia32/lib:/opt/intel/Compiler/11.1/080/ipp/ia32/lib:/opt/intel/Compiler/11.1/080/ipp/ia32/lib:
CPATH=/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/tbb/include:/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/tbb/include:/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/tbb/include:/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/tbb/include
SSH_AUTH_SOCK=/tmp/keyring-uq51Rs/ssh
USERNAME=fereshteh
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/1528,unix/unix:/tmp/.ICE-unix/1528
NLSPATH=/opt/intel/Compiler/11.1/080/lib/ia32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/ipp/ia32/lib/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/mkl/lib/32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/idb/ia32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/lib/ia32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/ipp/ia32/lib/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/mkl/lib/32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/idb/ia32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/lib/ia32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/ipp/ia32/lib/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/mkl/lib/32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/idb/ia32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/lib/ia32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/ipp/ia32/lib/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/mkl/lib/32/locale/%l_%t/%N:/opt/intel/Compiler/11.1/080/idb/ia32/locale/%l_%t/%N
DESKTOP_SESSION=gnome
MAIL=/var/spool/mail/fereshteh
PATH=/opt/intel/Compiler/11.1/080/bin/ia32:/opt/intel/Compiler/11.1/080/bin/ia32:/opt/intel/Compiler/11.1/080/bin/ia32:/opt/intel/Compiler/11.1/080/bin/ia32:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/fereshteh/.local/bin:/home/fereshteh/bin
QT_IM_MODULE=xim
PWD=/home/fereshteh
XMODIFIERS=@im=none
GNOME_KEYRING_PID=1521
LANG=en_US.utf8
KDE_IS_PRELINKED=1
GDM_LANG=en_US.utf8
KDEDIRS=/usr
LC_MEASUREMENT=en_US.utf8
GDMSESSION=gnome
HISTCONTROL=ignoredups
SHLVL=2
HOME=/home/fereshteh
XDG_SEAT=seat0
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
DYLD_LIBRARY_PATH=/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib:/opt/intel/Compiler/11.1/080/tbb/ia32/cc4.1.0_libc2.4_kernel2.6.16.21/lib
LOGNAME=fereshteh
CVS_RSH=ssh
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-sYiZouu32t,guid=3376456f542ffae70bbb357e00000033
LESSOPEN=||/usr/bin/lesspipe.sh %s
WINDOWPATH=1
XDG_RUNTIME_DIR=/run/user/fereshteh
DISPLAY=:0
INCLUDE=/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include:/opt/intel/Compiler/11.1/080/ipp/ia32/include:/opt/intel/Compiler/11.1/080/mkl/include
LC_TIME=en_US.utf8
XAUTHORITY=/var/run/gdm/auth-for-fereshteh-t1XeY8/database
COLORTERM=gnome-terminal
_=/usr/local/bin/env

there are not compilers as gcc and gfortran there are intel compiler that i install separatly.
when i type
[fereshteh@localhost ~]$ gcc --version
gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
therefore my system has gcc as default compiler. in my pc system i have cc=gcc anf fc=gfortran by default in env.

John VV 07-14-2013 11:53 AM

fedora like rhel uses "links" in /usr/bin

and uses GFortran , part of the gcc compiler

in my case i have a few versions of the gcc group installed
gcc 3.3 , gcc 4.3 and gcc 4.7
-- i have not yet installed the ancient g77 for some code i use , i recently upgraded my OS and have not gotten to it yet .

for one of the "current " newer versions gcc 4.7
"/usr/bin/gfortran-4.7" is a symbolic link to "/usr/bin/gfortran"

if you try calling g77 or g95 in your build line you will get an error

on fedora ( mind you Fedora 16 is WELL past it's end of life ! And is NOT supported and has not been supported since 2013-02-12 - "Feb. 12 20123")

use yum to install gfortran ( the current will be installed by default
Code:

su -
yum search fortran
---- then from that list install it ----
yum install gcc-fortran

then to see the version it is
Code:

gfortran -v

please post the build line you are using
and where this code is from ( if possible )
and the errors you are getting

fereshteh 07-15-2013 01:54 AM

$ gcc --version
gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



$ gfortran -v
sing built-in specs.
COLLECT_GCC=gfortran
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC)
[fereshteh@localhost ~]$ gcc --version
gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



when i try to set up zlib 1.2.7 by:
[fereshteh@localhost zlib-1.2.7]$ ./configure --prefix=/home/fereshteh/NETCDF_4.2.1.1
Checking for gcc...
Checking for shared library support...
No shared library support.
Building static library libz.a version 1.2.7 with cc.
Checking for off64_t... No.
Checking for fseeko... No.
Checking for strerror... No.
Checking for unistd.h... No.
Checking for stdarg.h... No.
Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf().
Checking for snprintf() in stdio.h... No.
WARNING: snprintf() not found, falling back to sprintf(). zlib
can build but will be open to possible buffer-overflow security
vulnerabilities.
Checking for return value of sprintf()... No.
WARNING: apparently sprintf() does not return a value. zlib
can build but will be open to possible string-format security
vulnerabilities.
Looking for a four-byte integer type... Not found.

this error arises in labtop system but when i use this in pc that has same fedora version i did not have error like this.
please help me to solve it

John VV 07-15-2013 03:04 AM

might ask "why ?" are you trying to build zlib ?

libz is installed by default
and the devel rpm is in the base fedora repo
Code:

yum install zlib-devel
in the very LAST update that fedora 16 got is
-- 32 bit --
zlib-1.2.5-7.fc16.i686.rpm
zlib-devel-1.2.5-7.fc16.i686.rpm

building zlib 1.2.7 from source will REPLACE the default version that is installed and that the Fedora 16 NEEDS!!!

from the error warnings
you are missing some basic development source code
you might want to install the "development group"
Code:

su -
yum grouplist
---- then from that long list install the development tools and libraries
yum groupinstall "Development Tools"


fereshteh 07-16-2013 02:30 AM

gcc and gfortran
 
dear i did both of comment that you say
1-yum install zlib-devel
2-yum grouplist...
but again by using ./configure -- prefix=/home/user/netcdf4.2.1 for zlib installation same error has appeared.
i need to install zlib by source (not rpm) becuase i need to install netcdf with zlib in same location by ./configure --with-zlib=/home/user/netcdf4.2.1 -- prefix=/home/user/netcdf4.2.1
now what is your recommendation
thanks

John VV 07-16-2013 11:31 AM

seeing as "unistd.h" is in the kernel-devel.rpm
stdarg.h is in the libstdc++ rpm


Did you install the software development libraries and tools listed in the output of "grouplist "

again WHY do you need a different version of libz than the GCC compiler and autotools and the Operating System will use in the build folder of some program

Quote:

becuase i need to install netcdf with zlib in same location by
then just copy/past the version that IS already installed

if it can not find libz.so.???? add it to the linker line
things like that are VERY common with fedora ( even a version that is not supported any longer )
somethings -- like Gcc-- are going to be WAY WAY too new to build a lot of programs without hacking that source code TO build with very new versions of programs


http://www.unidata.ucar.edu/software/netcdf
netcdf-4.3.0.tar.gz is the current , not the old 4.2.1

4.2.1 is listed in the OLD section on the page
http://www.unidata.ucar.edu/download..._2_1/index.jsp

netcdf-4.2.1.tar.gz dated July of 2012
from the INSTALL text file
Quote:

Then you build HDF5, specifying the location of the zlib library:

./configure --with-zlib=/home/ed/local --prefix=/home/ed/local
make check install
autotools should automatically pick up zlib
it is installed in /usr/lib or /usr/lib64 the default location
just use "--with-zlib"

there is NO NEED to have a different version( than the operating system is using ) in the build folder

i just ran
Code:

./configure
in the "/netcdf-4.2.1" folder without any options and "-lz" was auto found and auto used

fereshteh 07-17-2013 01:54 AM

quesions
 
Dear
1- i install software development libraries and tools by typing:
[code]yum grouplist
yum groupinstall "Development Tools
as you tooled. I have several questions that become so appreciate to receiving answer.
2- how can i find version of zlip which is already installed ?
3- you mean that i should make a folder as NETCDF for installing netcdf and then what i should copy/ past in that folder?
4-what is linker line and how i can add it ?
5-after coping what i need for zlib (quesion 3), for installing hdf5, i should dressed NETCDF folder (that i make it) in
[code]
./configure –with-zlib=/home/usr/NETCDF –prefix=/home/usr/NETCDF
make check install
6- and also for installing netcdf do
[code]
CPPFLAGS=-I/home/usr/NETCD/ include
LDFLAGS=L/home/usr/NETCD /lib
./configure –prefix=/home/usr/NETCD4
make check install

Thanks so much

John VV 07-17-2013 02:51 AM

this is a VERY big problem with "university code"
it is often made by students that are NOT software developers and software engineers
Geology writing code for geology programs
Math majors writing code for a function
Physics students writing astronomy software with help from the Geology students
and so on

some is good , some is GREAT, and some is a very messy bit of "spaghetti code"


the "directions" are often a bit wrong
or relate to 20+ year old instructions ( even if the software is new )
-- i build and use a lot of this stuff and " reading the code" is often better than trying to fallow the included instructions

to have the OLD version of netcdf build " netcdf-4.2.1" is a OLD VERSION !
netcdf-4.3 is the current

there is NO NEED to put libz.so in the netcdf-4.2.1 folder
no need at all , you do NOT need to do that !
"./configure" will auto find it on the fedora 16 system using "autotools"
that is WHY you run "configure"
to set up a build script FOR YOUR SYSTEM

setting "CPPFLAGS" and "LDFLAGS" in the terminal are not needed for almost ALL normal builds
"configure" should auto take care of this
yes way back in 1999 to 2003 they were NEEDED , but not today in 2013
-- sometimes for some "special" builds they are , but not 99.99999% of the time
-- "university code" documentation -- sometimes it is VERY VERY OLD ,some of it dating from 1996 for netcdf

Quote:

how can i find version of zlip which is already installed ?
use yum
yum is the package manager
Code:

su -
yum info libz
-- or --
yum info zlib

-- there are some name changes in the zip compression library


Quote:

you mean that i should make a folder as NETCDF for installing netcdf and then what i should copy/ past in that folder?
in "file-roller" the default GUI archive manager on fedora 16
it auto made a folder( called /netcdf-4.2.1 ) when you extracted the gziped tarball "netcdf-4.2.1.tar.gz"
also you DO NOT
100% DO NOT install the software to the build folder
almost all older code , and a lot of new also , will AUTO configure to install to "/usr/local"
fedora DOSE NOT , repeat dose NOT use that Debian default location
it uses " /usr " by default

you need to set that using "--prefix" in the configure line
have a look at the default settings for netcdf-4.2.1
in that folder run this
Code:

./configure --help
--- a quote from the output of this
Quote:


By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
also for netcdf-4.2.1 there is NO need to manually set the zlib option
it is AUTO tested for and auto set to "yes" if needed

Quote:

what is linker line and how i can add it
if needed that would all depend on the error -- if any
and the version of gcc that this program was DESIGNED for
it is very likely that even on the now unsupported and old Fedora 16 that the version of gcc might be WAY too new
-- just tested it on a fairly current gcc 4.7 , and it builds without an error

PS. I just ONLY ran this and it build without any problems

Code:

./configure
make -j3

the "-j3" told the compiler to use 3 of the 4 CPU's on my computer
-- for faster build times on a i5 or i7 or better CPU

if you want to install it to "/home/usr/NETCDF
well REPLACE "usr" with your REAL name -- the name on your home folder
Code:

./configure --prefix=/home/fereshteh/NETCDF
make
make install

you should see this if there are no errors
Code:


+-------------------------------------------------------------+
| Congratulations! You have successfully installed netCDF!    |
|                                                            |
| You can use script "nc-config" to find out the relevant    |
| compiler options to build your application. Enter          |
|                                                            |
|    nc-config --help                                        |
|                                                            |
| for additional information.                                |
|                                                            |
| CAUTION:                                                    |
|                                                            |
| If you have not already run "make check", then we strongly  |
| recommend you do so. It does not take very long.            |
|                                                            |
| Before using netCDF to store important data, test your      |
| build with "make check".                                    |
|                                                            |
| NetCDF is tested nightly on many platforms at Unidata      |
| but your platform is probably different in some ways.      |
|                                                            |
| If any tests fail, please see the netCDF web site:          |
| http://www.unidata.ucar.edu/software/netcdf/                |
|                                                            |
| NetCDF is developed and maintained at the Unidata Program  |
| Center. Unidata provides a broad array of data and software |
| tools for use in geoscience education and research.        |
| http://www.unidata.ucar.edu                                |
+-------------------------------------------------------------+

mind you the folder /NETCDF is NOT in the system or user $PATH
you will likely need to add that in the .bash_profile text file ( it is a hidden system file in your home folder


run "make check" before you use it to check if there are problems or not

all the tests should pass

TobiSGD 07-17-2013 06:23 AM

Moved: This thread is more suitable in Linux - General and has been moved accordingly to help your thread/question get the exposure it deserves.

Please use code-tags for output of commands and scripts.

fereshteh 07-18-2013 06:37 AM

zlib
 
dear
thanks for your attention. i decide to use yum install zlib-devel (base on your recommendation)
now how can i find its path to put in ./configure --with-zlib= ???? -prefix=/ / / netcdf for installing HDF5 and also netcdf.
thanke so mush ;)

knudfl 07-18-2013 07:32 AM

# 13 :

zlib will be found automatically by applications that require zlib files.
The same is valid for other libraries installed with yum.

Why are you trying to build hdf5 and netcdf ? ?

This will do for 99% of all applications :
# yum install hdf5-devel netcdf-devel


*** Which application is it that require hdf5 and netcdf ? ?

-

fereshteh 07-20-2013 01:00 AM

hdf5 and netcdf
 
actually ROMS model need hdf5 and netcdf libraries to determined in .bashrc file and roms bouild file too.
for this model it is need that i install netcdf with hdf5 and zlib too.
and becouse i am newbie with roms and linux i try to install cmpeletly coincide with usergiude. in netcdf4 INSTALL guide write that i should install it with zlib and hdf5 by
[code]
Cd /home/fkomijani/zlib 1.2.7
./configure --prefix=/home/fkomijani/NETCD4.2.1.1
make check install
cd /home/fkomijani/HDF5 1.8.9
./configure --with-zlib=/home/fkomijani/NETCD4.2.1.1 --prefix=//home/fkomijani/NETCD4.2.1.1
make check install
and then
cd /home/fkomijani/netcdf4.2.1.1
CPPFLAGS=-I/home/fkomijani/NETCD4.2.1.1/ include LDFLAGS=L/home/fkomijani/NETCD4.2.1.1 /lib ./configure --prefix=/home/fkomijani/NETCD4.2.1.1
make check install
[code]
i try to use it step by step (with out applying yum for installation) and now i install zlib by
[code] yum install zlib-devel
and i need guide for puting zlib path in --withzlib=.... part

John VV 07-20-2013 01:14 AM

Are you trying to build a "static" version ?

if so then you will need to build zlib.a and use all NON dynamically linked libs

fereshteh 07-24-2013 06:21 AM

dear my problem have not been sollved. i used
[code]
yum install zlib
yum install zlib-devel
then with regard your answer that configure find zlib for installing hdf5 i use
[code]
[fereshteh@localhost ~]$ cd /home/fereshteh/hdf5-1.8.9
[fereshteh@localhost hdf5-1.8.9]$ ./configure --prefix=/home/fereshteh/HDF5
./configure: line 2818: config.log: Permission denied
./configure: line 2828: config.log: Permission denied
but as you can see those errors arised. what can i do now?
thanks

fereshteh 07-24-2013 06:23 AM

dont solved
 
dear my problem have not been sollved. i used
[code]
yum install zlib
yum install zlib-devel
then with regard your answer that configure find zlib for installing hdf5 i use
[code]
[fereshteh@localhost ~]$ cd /home/fereshteh/hdf5-1.8.9
[fereshteh@localhost hdf5-1.8.9]$ ./configure --prefix=/home/fereshteh/HDF5
./configure: line 2818: config.log: Permission denied
./configure: line 2828: config.log: Permission denied
but as you can see those errors arised. what can i do now?
also i like to say that i should not install hdf5 and netcdf with yum because my model (roms) need some setting that i should set their include and bin directories in different places. please help me without using yum
thanks

John VV 07-24-2013 01:56 PM

Quote:

and i need guide for puting zlib path in --withzlib=.... part
there is no need for that line
autotools will auto find it it is is installed ( and it is already installed )

Quote:

./configure: line 2828: config.log: Permission denied
it looks like at some point you ran "configure" as ROOT
that is not a good idea , it causes all kinds of problems

delete the folder ( you might need to be root to do it )
then re extract the tar ball

Also you have not answerer WHY you are trying to build from source a OLD VERSION
1.8.9 was released in May of 2012
the current 1.8.11 was released thin may (2013-05-08)

and not the current version

also WHY are you truing to build it ???

it should be in the fedora repos
Code:

su -
yum search netcdf
----- it should be listed ----
yum install netcdf netcdf-devel

and be done with it

Quote:

because my model (roms) need some setting that i should set their include and bin directories in different places
so from this
" --prefix=/home/fereshteh/HDF5 "
you MUST set the "bin" folder to
"/home/fereshteh/HDF5/bin"
and the include folder to
"/home/fereshteh/HDF5/include"

that is very "odd"

the software default is the Debian "/usr/local "
and fedora uses "/usr" instead

so just where must you ? place? these bin and include folders

fedora's default is
/usr/bin
/usr/include

fereshteh 07-27-2013 02:38 AM

cc1
 
finally i use yum for installating zlib, hdf5 and netcdf, their versions are 1.2.6, 1.8.7 and 4.1.3 respectively. i know That netcdf include directory have to contains netcdf.mod, typesizes.mod , ncvalues.h, netcdf,h etc. But with yum installation first two files are set in /usr/lib/gfortran/modules path not in /usr/include, why ?in roms model i have to set NETCDF_INDIR that should set to one place for example /usr/include but as you can see 2 files are in /usr/lib/gfortran/modules? for this what is your recommendation. can i copy/paste those file to /usr/include?
Also when i compile roms with ./build.bash command this error arise
[code]
rm -f -r core *.ipo /home/fereshteh/projects/upwelling9/Build /home/fereshteh/make_macros.mk
cpp: error trying to exec 'cc1': execvp: No such file or directory
[code]

i know that is about gcc compiler . When i type
[code]
[fereshteh@localhost upwelling9]$ whereis cc1
cc1:
nothing replied.
Would you please tell me how i can fix this error.
Cheers
fereshte

John VV 07-27-2013 05:42 PM

usr/lib/gfortran/modules

is the correct install location
the current autotools will find the modules if needed
ldconf and pkgconfig will find them

the instructions you might be fallowing are likely for the OLD folder and file system layout from 8 to 10 years ago for the older gcc tools .

/usr/include
is for the header files ( *.h )
these are in the devel rpms

you really do not want to "copy / past" the
usr/lib/gfortran/modules
into
/usr/include


edit the makefile's in the project and NOT the operating system
make_macros.mk
m4 macros , a PHD theses can be done in trying to explain these

but the upshot is the current macros used in the gcc 4 version is WAY better than the old versions in the old gcc3 tools

"build.bash"
edit the build files
makefile projects REQUIRE you to manually edit the build files for your system

fereshteh 07-29-2013 04:31 AM

cc1
 
thanks so mush for your answer.

for resolving my previous error (cpp: error trying to exec 'cc1': execvp: No such file or directory), i think that i should install another version of gcc (are you agree with me?).my current gcc version is 4.6.2 20111027(red hat 4.6.2-1)that have installed in my system by
yum install gcc
now would you please tell me how i can insall new version on fedora 16?
and after installing i should changed default system setup to use new version of gcc?
thanks in advance

John VV 07-29-2013 12:26 PM

with out seeing the makefile for this makefile project

Quote:

/home/fereshteh/projects/upwelling9
where did you get the program "upwelling9"that you are trying to build

-- i am assumming it is some project related to netcdf
a search on that site shows this
http://www.unidata.ucar.edu/googlere...df%2Findex.jsp


cc1 is likely a alias

for "makefile" projects you have to edit the makefile for YOUR system
the autotools are not used

this "make_macros.mk" is likely a hand wrote file


how exactly did you install the whole gcc tool chain

the way recommended by fedora has been to install the group
Code:

su -
yum groupinstall "Development Tools"

as to "installing a different gcc"

fedora dose not really support that , there is the old gcc34 -compat
a compatibility version

but for say gcc 4.1

you must build that tool chain from source and take extreme care NOT to replace the currently installed
gcc is designed to be installed "side by side" with other versions

but take a month ( 30 days) and read up and study the subject first





you might want to talk to your Prof. in this class about building this software
or fallow the "contact us " link
http://www.unidata.ucar.edu/about/index.html#contact

the documentation i can find is for the CURRENT netcdf 4.3
http://www.unidata.ucar.edu/software.../building.html
and is NOT for the old 4.2 you are using
-- it might not apply to the old 4.2 version


All times are GMT -5. The time now is 01:35 AM.