[Nix-dev] gfortran and does not know the path to the glibc.

Nicolas Pierron nicolas.b.pierron at gmail.com
Fri Sep 5 11:00:26 CEST 2008


Apparently the gfortan compiler does not know the path to the glibc, I
have tried to set LD_LIBRARY_PATH and LD_RUN_PATH without success.  As
display with the '-v' option the gcc compiler does know this path and
correctly link to the glibc for files like crt1.o.

Does anyone have an idea to solve this problem ?

I have tried to recompile gfortran with "langC = true" without success.

$ cat hw.f90

program HelloWorld
  write(*,*) "Hello World"
end program HelloWorld

$ gfortran -c hw.f90

$ gfortran -v hw.o -o hw
Driving: gfortran -v hw.o -o hw -lgfortranbegin -lgfortran -lm -shared-libgcc
Utilisation des specs internes.
Target: i686-pc-linux-gnu
Configuré avec: ../gcc-4.2.4/configure
--prefix=/nix/store/14ixlwk217qdr1743hyffgsw8k9jag13-gcc-4.2.4
--disable-multilib --disable-libstdcxx-pch --with-system-zlib
--enable-languages=fortran --with-arch=i686
--with-gmp=/nix/store/xmdacdazf1krb9jsvjli0jqfspg98b0l-gmp-4.2.2
--with-mpfr=/nix/store/0hkra9dhh3qkmfhg3im7vr9fn672x6yj-mpfr-2.3.1
Modèle de thread: posix
version gcc 4.2.4
 /nix/store/14ixlwk217qdr1743hyffgsw8k9jag13-gcc-4.2.4/libexec/gcc/i686-pc-linux-gnu/4.2.4/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hw
crt1.o crti.o /nix/store/14ixlwk217qdr1743hyffgsw8k9jag13-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4/crtbegin.o
-L/nix/store/14ixlwk217qdr1743hyffgsw8k9jag13-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4
-L/nix/store/14ixlwk217qdr1743hyffgsw8k9jag13-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4/../../..
hw.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/nix/store/14ixlwk217qdr1743hyffgsw8k9jag13-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4/crtend.o
crtn.o
/home/nicolas/.nix-profile/i686-pc-linux-gnu/bin/ld: crt1.o: No such
file: No such file or directory
collect2: ld a retourné 1 code d'état d'exécution

$ gcc -v hw.o -o hw
Utilisation des specs internes.
Target: i686-pc-linux-gnu
Configuré avec: ../gcc-4.2.4/configure
--prefix=/nix/store/18cjrw11vwmpx0jkk6mdwfc4caj99714-gcc-4.2.4
--disable-multilib --disable-libstdcxx-pch --with-system-zlib
--enable-languages=c,c++ --with-arch=i686
Modèle de thread: posix
version gcc 4.2.4
 /nix/store/18cjrw11vwmpx0jkk6mdwfc4caj99714-gcc-4.2.4/libexec/gcc/i686-pc-linux-gnu/4.2.4/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hw
/nix/store/b2gmgy8y6nidjj7n34jx4sanrjdaxrw3-glibc-2.7/lib/crt1.o
/nix/store/b2gmgy8y6nidjj7n34jx4sanrjdaxrw3-glibc-2.7/lib/crti.o
/nix/store/18cjrw11vwmpx0jkk6mdwfc4caj99714-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4/crtbegin.o
-L/nix/store/18cjrw11vwmpx0jkk6mdwfc4caj99714-gcc-4.2.4/lib
-L/nix/store/b2gmgy8y6nidjj7n34jx4sanrjdaxrw3-glibc-2.7/lib
-L/nix/store/b2gmgy8y6nidjj7n34jx4sanrjdaxrw3-glibc-2.7/lib
-L/nix/store/ylbjk3gsrbnbbcapx2rqhbjs40sw57c0-gcc-4.2.4/bin
-L/nix/store/18cjrw11vwmpx0jkk6mdwfc4caj99714-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4
-L/nix/store/18cjrw11vwmpx0jkk6mdwfc4caj99714-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4/../../..
-dynamic-linker
/nix/store/b2gmgy8y6nidjj7n34jx4sanrjdaxrw3-glibc-2.7/lib/ld-linux.so.2
hw.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed
-lgcc_s --no-as-needed
/nix/store/18cjrw11vwmpx0jkk6mdwfc4caj99714-gcc-4.2.4/lib/gcc/i686-pc-linux-gnu/4.2.4/crtend.o
/nix/store/b2gmgy8y6nidjj7n34jx4sanrjdaxrw3-glibc-2.7/lib/crtn.o
/nix/store/b2gmgy8y6nidjj7n34jx4sanrjdaxrw3-glibc-2.7/lib/crt1.o: In
function `_start':
(.text+0x18): undefined reference to `main'
hw.o: In function `MAIN__':
hw.f90:(.text+0x21): undefined reference to `_gfortran_set_std'
hw.f90:(.text+0x57): undefined reference to `_gfortran_st_write'
hw.f90:(.text+0x75): undefined reference to `_gfortran_transfer_character'
hw.f90:(.text+0x83): undefined reference to `_gfortran_st_write_done'
collect2: ld a retourné 1 code d'état d'exécution

-- 
Nicolas Pierron
- If you are doing something twice then you should try to do it once.



More information about the nix-dev mailing list