libtool don't compile Fortran to shared library -
i need use libtool compile fortran library, because need static , shared version, compilation won't work in same way of c library.
in case of c library:
$ cat hello.c #include <stdio.h> int hello() { printf("hello\n"); return 0; } $ libtool --tag=cc --mode=compile gcc -c hello.c libtool: compile: gcc -c hello.c -fpic -dpic -o .libs/hello.o libtool: compile: gcc -c hello.c -o hello.o >/dev/null 2>&1 $ nm .libs/hello.o u _global_offset_table_ 0000000000000000 t hello u puts
as can see in example above libtool has add -fpic
, object has _global_offset_table_
.
in case of fortran library:
$ cat hello.f function hello () write (*,*) "hello" endfunction hello $ libtool --tag=fc --mode=compile gfortran -c hello.f libtool: compile: gfortran -c hello.f -o .libs/hello.o libtool: compile: gfortran -c hello.f >/dev/null 2>&1 $ nm .libs/hello.o u _gfortran_st_write u _gfortran_st_write_done u _gfortran_transfer_character_write 0000000000000000 t hello_
as can see in example above libtool hasn't add -fpic
, object hasn't _global_offset_table_
.
how can solve problem?
additional information
$ libtool --version libtool (gnu libtool) 2.4.2 $ gcc --version gcc (gcc) 4.8.2 20140206 (prerelease) $ gfortran --version gnu fortran (gcc) 4.8.2 20140206 (prerelease)
you can use gcc
> libtool --tag=fc --mode=compile gcc -c hello.f90 libtool: compile: gcc -c hello.f90 -fpic -o .libs/hello.o libtool: compile: gcc -c hello.f90 -o hello.o >/dev/null 2>&1 > nm .libs/hello.o u _gfortran_st_write u _gfortran_st_write_done u _gfortran_transfer_character_write u _global_offset_table_ 0000000000000000 t hello_
Comments
Post a Comment