Page 1 of 5 123 ... LastLast
Results 1 to 10 of 45

Thread: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

  1. #1
    Join Date
    Apr 2009
    Beans
    28

    Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    After struggling for a while, I managed to install garfield (With important help of dinofelis) and decided to share my experince on compiling garfield on Ubuntu 10.04.

    For information of garfield: http://garfield.web.cern.ch/garfield/

    If you don't have it yet, install gfortran

    Code:
    sudo apt-get install gfortran
    install cernlib,libgsl from repositories

    Code:
    sudo apt-get install cernlib libgsl0-dev nypatchy
    Create a directory (lets say /home/username/garfield/) and copy all necessary files from website to this directory:

    Code:
    garfield-7.car
    garfadd-9.cra
    garfield-9.cra
    garfield.hlp
    heed101garf.car
    magboltz-7.car
    patchy_step (It is defined as "Script to run Patchy" in the website)
    (If you want another version of garfield you should download the corresponding .cra files.

    Get NeBem from either its website, or the afs folders:

    Code:
    /afs/cern.ch/user/r/rjd/Garfield/Files/neBEM/V1.7e
    For ease, copy this folder directly to your working folder as

    Code:
    ./neBEM/V1.7e/
    Now the essential thing: Normaly program is written to be compiled in g77, when you use gfortran, you get an error like:

    Code:
    undefined reference to `iargc_'
    In gfortran, instead of iargc_() there is _gfortran_iargc() function. So you need to make your compiler
    recognize iargc_() as _gfortran_iargc(). To do this paste this little code into a file named

    Code:
    gfortran_iargc.c
    and save it somewhere in your working directory, for example: ./extras/iarg.d/gfortran_iargc.c

    Code:
    extern int _gfortran_iargc(void);
    int iargc_()
    {
    return _gfortran_iargc();
    }
    go to this directory and compile the code as:

    Code:
    gfortran -c _gfortran_iargc.c
    It will create the file "_gfortran_iargc.o". Note that in the makefile you'll need to set variable $DUMMYIARGCOBJ
    to the location of this file.(see: makefile)

    Now you are ready to compile garfield, you can use a sample makefile and modify your folder names. To compile simply write

    Code:
    make garfield-9
    The sample makefile is attached. YOu should change the name to makefile after downloading
    Attached Files Attached Files
    Last edited by Cenko; June 27th, 2011 at 09:08 AM. Reason: Added installation of package nypatchy

  2. #2
    Join Date
    Dec 2010
    Beans
    1

    Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    First of all, thanks for your post! The Makefile and especially the gfortran_iargc part are very helpful.

    I'm currently trying to build garfield-9 on a 32-bit Ubuntu 10.10 system. All the fortran files compile fine but at the final linking stage I run into this error:

    Code:
    gfortran  -o ~/garfield/garfield-9/bin/garfield-9 *.o ~/garfield/garfield-9/extras/gfortran_iargc.o \
            ./neBEM/V1.7.2/obj/GarfieldInterface.o ./neBEM/V1.7.2/obj/neBEMInterface.o \
            ./neBEM/V1.7.2/obj/ReTriM.o ./neBEM/V1.7.2/obj/ComputeProperties.o \
            ./neBEM/V1.7.2/obj/neBEM.o \
            -Wl,-static -lgraflib -lgrafX11 -lmathlib -Wl,-dy -lX11 -lkernlib -llapack -lm -lpacklib -lnsl -lcrypt -ldl -lgfortran -std=c99 \
            -Iinclude -L./neBEM/V1.7.2/lib \
            -lNR -lVector -lIsles  -L/usr/local/lib -lgslcblas -lgsl -lm -lgfortran
    celcal.o: In function `celcal_':
    celcal.f:(.text+0x17f5): undefined reference to `bemvoq_'
    celspr.o: In function `celspr_':
    celspr.f:(.text+0x1307): undefined reference to `bemvoq_'
    celspr.f:(.text+0x2177): undefined reference to `bemvoq_'
    celspr.f:(.text+0x2df6): undefined reference to `bemvoq_'
    celspr.f:(.text+0x365e): undefined reference to `bemvoq_'
    celspr.o:celspr.f:(.text+0x427e): more undefined references to `bemvoq_' follow
    collect2: ld returned 1 exit status
    make: *** [garfield-9] Error 1
    I'm not sure whether `bemvoq_` should be part of libneBEM or if the definition is just missing from garfield-7.car. Note: I was only able to get versions 1.7.1 and 1.7.2 of neBEM, not version 1.7e which you used to build garfield.

    Any help or suggestions would be much appreciated.
    Last edited by flueke; December 29th, 2010 at 02:24 PM. Reason: garfield-7.car, not garfield-9.car

  3. #3
    Join Date
    Dec 2010
    Beans
    2

    Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    To install garfield on Ubuntu 10.04 LTS - the Lucid Lynx for a 64 bit machine some minor modifications have to be applied to Cenk's installation method

    1/ install all lib32 via synaptic or sudo apt-get install ia32-libs

    2/ some other libraries have to be added (I copied it from my 32bit desktop which is also working with Lucid Lynx)

    libgraflib.a
    libgraflib.so.1_gfortran.2006
    libgraflib.so.1_gfortran
    libgraflib.so
    libkernlib.a
    libkernlib.so.1_gfortran.2006
    libkernlib.so.1_gfortran
    libkernlib.so
    libmathlib.a
    libmathlib.so.2_gfortran.2006
    libmathlib.so.2_gfortran
    libmathlib.so
    libpacklib1-gfortran
    libpacklib.so.1_gfortran.2006
    libpacklib.so.1_gfortran -> libpacklib.so.1_gfortran.2006
    libpacklib.so -> libpacklib.so.1_gfortran.2006
    libpacklib-lesstif.so.1_gfortran.2006
    libpacklib-lesstif.so.1_gfortran -> libpacklib-lesstif.so.1_gfortran.2006
    libpacklib-lesstif.so -> libpacklib-lesstif.so.1_gfortran.2006
    libpacklib-lesstif.a
    libpacklib.a
    libgrafX11.a
    libgrafX11.so.1_gfortran.2006
    libgrafX11.so.1_gfortran
    libgrafX11.so
    liblapack.a
    liblapackgf-3.a
    liblapackgf-3.so
    liblapack.so
    liblapack.so.3gf.0
    liblapack.so.3gf
    libblas.so.3gf.0
    libblas.so.3gf

    3/
    gfortran -c _gfortran_iargc.c becomes gfortran -m32 -c _gfortran_iargc.c

  4. #4
    Join Date
    Dec 2010
    Beans
    2

    Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    4/ compile neBEM with -m32 flag

    G77=gfortran -m32 # on more recent versions of linux

    CFLAGS=-Wall -std=c99 -O3 -m32 # last option necessary for Garfield

    5/ in neBEM/V1.7e/lib
    cp libIsles32.a libIsles.a

    6/ compile garfield with -m32 flag and forcing to read the lib32 by -L/usr/lib32

    FC = gfortran -m32
    #LF=-Wl,-static -lgraflib -lgrafX11 -lmathlib -Wl,-dy -lX11 -lkernlib -llapack -lm \
    #-lpacklib -lnsl -lcrypt -ldl -lgfortran
    LF=-Wl,-static -L/usr/lib32 -lgraflib -lgrafX11 -lmathlib -Wl,-dy -lX11 -lkernlib -llapack -lm \
    -lpacklib -lnsl -lcrypt -ldl -lgfortran

  5. #5
    Join Date
    Jan 2011
    Location
    Hungary
    Beans
    10

    Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    I am trying to install Garfield on a 64 bit Ubuntu 10.10 recently, but so far without any succes.

    Following Cenko's and igal's advices, I get this:

    Code:
    gfortran -m32  -o ~/garfield/bin//garfield-9 *.o ~/garfield//extras/iarg.d/gfortran_iargc.o \
        ./neBEM/V1.7.2/obj/GarfieldInterface.o ./neBEM/V1.7.2/obj/neBEMInterface.o \
        ./neBEM/V1.7.2/obj/ReTriM.o ./neBEM/V1.7.2/obj/ComputeProperties.o \
        ./neBEM/V1.7.2/obj/neBEM.o \
        -Wl,-static -L/usr/lib32 -lgraflib -lgrafX11 -lmathlib -Wl, -dy -lX11 -lkernlib -llapack -lm -lpacklib -lnsl -lcrypt -ldl -lgfortran -std=c99 \
        -Iinclude -L./neBEM/V1.7.2/lib \
        -lNR -lVector -lIsles  -L/usr/local/lib -lgslcblas -lgsl -lm -lgfortran
    /usr/bin/ld: cannot find : No such file or directory
    /usr/lib32/libX11.a(CrGlCur.o): In function `open_library':
    (.text+0x3b): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/bin/ld: cannot find -lgcc_s
    /usr/lib/gcc/x86_64-linux-gnu/4.4.5/32/libgfortran.a(getlog.o): In function `_gfortran_getlog':
    (.text+0x32): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib32/libX11.a(xim_trans.o): In function `_XimXTransSocketUNIXConnect':
    (.text+0xe23): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/bin/ld: cannot find -lgcc_s
    collect2: ld returned 1 exit status
    make: *** [garfield-9] Error 1
    By the way /usr/bin/ld exists. Does anyone have a clue what is wrong?

    BTW I have put a 32 bit Ubuntu 10.10 on VirtualBox just in order to install Garfield. With the above mentioned method, it works for me too.
    Last edited by psyentist88; July 6th, 2011 at 03:31 PM.

  6. #6
    Join Date
    May 2011
    Beans
    1

    Thumbs down Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    thanks for the post, i have a problem here,
    huang_sun@huang:~/garfield$ make garfield-9
    rm *.f *.o
    rm: 无法删除"*.f": 没有那个文件或目录 (can't delete '*.f',no such file or dir)
    rm: 无法删除"*.o": 没有那个文件或目录
    make: [garfield-9.f] 错误 1 (忽略) (err 1, ignor)
    ./patchy_step garfield-9

    Nypatchy executing with files / options
    .........
    73 + +USE,P=SIGNAL,D=SIGADM,T=I.
    74 + +USE,P=SIGNAL,D=SIGFLS,T=I.
    75 + +USE,P=SIGNAL,D=SIGWRT,T=I.

    76 + +PAM,LUN=11,T=a,C. garfield-7.car

    ***!!! OPEN fails for file: garfield-7.car
    Perror has: Illegal seek

    ***!!! Kill the run for: OPEN failure !!!***
    : not foundep: 3:
    make: *** [garfield-9.f] 错误 127 (err 127)
    ,

    could anyeone give me some help

  7. #7
    Join Date
    Jun 2011
    Beans
    3

    Angry Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    Thanks to you all. The discussion is very helpful. But i have a problem. Just like h010410225:

    [yanqiang@localhost garfield]$ make garfield-9
    rm *.f *.o
    rm: cannot remove `*.f': No such file or directory
    rm: cannot remove `*.o': No such file or directory
    make: [garfield-9.f] Error 1 (ignored)
    ./patchy_step garfield-9
    ./patchy_step: line 1: nypatchy: command not found
    make: *** [garfield-9.f] Error 127

    what this message means? I have checked the content of patchy_step, it only have two lines: nypatchy - $1 $1 - - - - - - - - - :GO
    # less y.lis
    What the command nypatchy means?
    Any help will be most welcomed!!

  8. #8
    Join Date
    Apr 2009
    Beans
    28

    Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    What the command nypatchy means?
    Any help will be most welcomed!!
    Sorry for not including that, it is part of CERNLIB, that you can download from ubuntu repositories.I'm adding it to main post. You can simply install it as follows before compiling garfield:

    Code:
    sudo apt-get install nypatchy

  9. #9
    Join Date
    Jun 2011
    Beans
    3

    Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    Thank you very much, Cenko! This problem has been solved by using your method. And another command fcaplit could be solved in the same way. Thank you !! Best wishes!!

  10. #10
    Join Date
    Jun 2011
    Beans
    3

    Re: Installing garfield to Ubuntu 10.04 Lucid Lynx - gfortran

    Dear all, thank you for your post!After some problems were solved, more problems occured. Now a problem I encountered is about libpacklib.a. When the gfortran tried to link the program, an error appeared like this:

    ........
    dzbkhd.F:(.text+0x1fb): undefined reference to `do_fio'
    /home/yanqiang/cern/2006/lib/libpacklib.a(dzbkhd.o):dzbkhd.F:(.text+0x24d): more undefined references to `do_fio' follow
    /home/yanqiang/cern/2006/lib/libpacklib.a(dzbkhd.o): In function `dzbkhd_':
    dzbkhd.F:(.text+0x3e6): undefined reference to `e_wsfi'
    dzbkhd.F:(.text+0x429): undefined reference to `s_copy'
    /home/yanqiang/cern/2006/lib/libpacklib.a(dziopr.o): In function `dziopr_':
    dziopr.F:(.text+0x1a): undefined reference to `s_copy'
    dziopr.F:(.text+0x2d): undefined reference to `s_copy'
    dziopr.F:(.text+0xa7): undefined reference to `s_wsfi'
    dziopr.F:(.text+0xbb): undefined reference to `do_fio'
    dziopr.F:(.text+0xcf): undefined reference to `do_fio'
    dziopr.F:(.text+0xe3): undefined reference to `do_fio'
    dziopr.F:(.text+0x105): undefined reference to `do_fio'
    dziopr.F:(.text+0x10a): undefined reference to `e_wsfi'
    dziopr.F:(.text+0x164): undefined reference to `s_copy'
    /home/yanqiang/cern/2006/lib/libpacklib.a(fzialn.o): In function `fzialn_':
    fzialn.F:(.text+0x6a): undefined reference to `s_rsfe'
    fzialn.F:(.text+0x8e): undefined reference to `do_fio'
    fzialn.F:(.text+0xa3): undefined reference to `e_rsfe'
    fzialn.F:(.text+0x1db): undefined reference to `s_rsfe'
    fzialn.F:(.text+0x1fb): undefined reference to `do_fio'
    fzialn.F:(.text+0x20c): undefined reference to `e_rsfe'
    /home/yanqiang/cern/2006/lib/libpacklib.a(fzoaln.o): In function `fzoaln_':
    fzoaln.F:(.text+0x81): undefined reference to `s_wsfe'
    fzoaln.F:(.text+0xa1): undefined reference to `do_fio'
    fzoaln.F:(.text+0xb2): undefined reference to `e_wsfe'
    /home/yanqiang/cern/2006/lib/libpacklib.a(uh1toc.o): In function `uh1toc_':
    uh1toc.F:(.text+0x49): undefined reference to `s_copy'
    /home/yanqiang/cern/2006/lib/libpacklib.a(dziopd.o): In function `dziopd_':
    dziopd.F:(.text+0x1b): undefined reference to `s_copy'
    dziopd.F:(.text+0x2e): undefined reference to `s_copy'
    dziopd.F:(.text+0xa4): undefined reference to `s_copy'
    dziopd.F:(.text+0xe5): undefined reference to `s_copy'
    /home/yanqiang/cern/2006/lib/libpacklib.a(dziopd.o):dziopd.F:(.text+0xfb): more undefined references to `s_copy' follow
    /home/yanqiang/cern/2006/lib/libpacklib.a(dziopd.o): In function `dziopd_':
    dziopd.F:(.text+0x288): undefined reference to `s_wsfi'
    dziopd.F:(.text+0x29c): undefined reference to `do_fio'
    dziopd.F:(.text+0x2c0): undefined reference to `do_fio'
    dziopd.F:(.text+0x2d4): undefined reference to `do_fio'
    dziopd.F:(.text+0x2d9): undefined reference to `e_wsfi'
    dziopd.F:(.text+0x3cd): undefined reference to `s_copy'
    dziopd.F:(.text+0x50e): undefined reference to `s_wsfi'
    dziopd.F:(.text+0x52b): undefined reference to `do_fio'
    dziopd.F:(.text+0x53f): undefined reference to `do_fio'
    dziopd.F:(.text+0x544): undefined reference to `e_wsfi'
    dziopd.F:(.text+0x596): undefined reference to `s_wsfi'
    dziopd.F:(.text+0x5f0): undefined reference to `s_wsfi'
    dziopd.F:(.text+0x64b): undefined reference to `s_wsfi'
    dziopd.F:(.text+0x6b0): undefined reference to `s_wsfi'
    dziopd.F:(.text+0x6c4): undefined reference to `do_fio'
    dziopd.F:(.text+0x6c9): undefined reference to `e_wsfi'
    dziopd.F:(.text+0x702): undefined reference to `s_wsfi'
    ........
    collect2: ld returned 1 exit status
    make: *** [garfield-9] Error 1

    Nearly every *.o file of libpacklib.a has this kind of error. I have tried the cernlibs of version 2003 , following the guide from http://www.icepp.s.u-tokyo.ac.jp/~nanjyo /html/garfield.html, and the cernlibs of version 2006 compiled from the source, but all effort failed.I don't know where the problem lies, the cernlib(libpacklib.a) or other place?

    The make file I used was modified from what provided by Cenko, and I post it as attachment. Could anyone help me?
    Attached Files Attached Files
    Last edited by yankang; July 1st, 2011 at 04:28 AM.

Page 1 of 5 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •