This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linking problem compiling FoX library


Hi,

I'm getting linker errors when trying to build the FoX library 
(http://www1.gly.bris.ac.uk/~walker/FoX/), specifically the version at:

http://www1.gly.bris.ac.uk/~walker/FoX/source/FoX-4.1.2-full.tar.gz

This is a library I've been compiling successfully with gfortran for several 
years. It compiles successfully with gfortran 4.7.2, and previously compiled 
OK with gfortran 4.8.0 (specifically, "gcc version 4.8.0 20120606 
(experimental) (GCC)"). However, using the latest gfortran 4.8.0 (r192265) it 
fails when trying to link an example code. I've pasted the output from a 
successful build with 4.7.2 and the failed build below.

--

# export FC=/usr/bin/gfortran
# $FC -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.7.2/lto-wrapper
Target: x86_64-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 --disable-build-with-cxx --disable-build-poststage1-with-cxx 
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --
enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu 
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin 
--enable-initfini-array --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_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC) 
# ./configure
.
. <no errors>
.
# make
.
. <no errors>
.

--

# export FC=/opt/gcc-4.8/bin/gfortran
# $FC -v
COLLECT_GCC=/opt/gcc-4.8/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/gcc-4.8/libexec/gcc/x86_64-unknown-linux-
gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8/configure --prefix=/opt/gcc-4.8 --enable-
languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.8.0 20121009 (experimental) (GCC) 
# ./configure
.
. <no errors>
.
# make
/opt/gcc-4.8/bin/gfortran -g -O2   -o  wxml_example wxml_example.o $(../FoX-
config --libs --wxml)
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_core.o): In function 
`__m_wxml_core_MOD_write_attributes':
m_wxml_core.F90:(.text+0x1a2): undefined reference to 
`__m_common_attrs_MOD_get_value_by_index_len'
m_wxml_core.F90:(.text+0x23a): undefined reference to 
`__m_common_attrs_MOD_get_key_len'
m_wxml_core.F90:(.text+0x283): undefined reference to 
`__m_common_attrs_MOD_get_value_by_index_len'
m_wxml_core.F90:(.text+0x328): undefined reference to 
`__m_common_attrs_MOD_get_key_len'
m_wxml_core.F90:(.text+0x3d1): undefined reference to 
`__m_common_attrs_MOD_get_value_by_index_len'
m_wxml_core.F90:(.text+0x431): undefined reference to 
`__m_common_attrs_MOD_get_value_by_index_len'
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_core.o): In function 
`__m_wxml_core_MOD_xml_addattribute_ch':
m_wxml_core.F90:(.text+0x27e3): undefined reference to 
`__m_common_namespaces_MOD_getprefixindex'
m_wxml_core.F90:(.text+0x2cf2): undefined reference to 
`__m_common_namespaces_MOD_getprefixindex'
m_wxml_core.F90:(.text+0x328f): undefined reference to 
`__m_common_namespaces_MOD_getprefixindex'
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_overloads.o): In 
function `__m_wxml_overloads_MOD_pseudoattributematrixch':
m_wxml_overloads.F90:(.text+0xc2): undefined reference to 
`__fox_m_fsys_format_MOD_str_string_matrix_len'
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_overloads.o): In 
function `__m_wxml_overloads_MOD_pseudoattributearraych':
m_wxml_overloads.F90:(.text+0xefb): undefined reference to 
`__fox_m_fsys_format_MOD_str_string_array_len'
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_overloads.o): In 
function `__m_wxml_overloads_MOD_attributematrixch':
m_wxml_overloads.F90:(.text+0x21e2): undefined reference to 
`__fox_m_fsys_format_MOD_str_string_matrix_len'
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_overloads.o): In 
function `__m_wxml_overloads_MOD_attributearraych':
m_wxml_overloads.F90:(.text+0x309b): undefined reference to 
`__fox_m_fsys_format_MOD_str_string_array_len'
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_overloads.o): In 
function `__m_wxml_overloads_MOD_charactersmatrixch':
m_wxml_overloads.F90:(.text+0x449e): undefined reference to 
`__fox_m_fsys_format_MOD_str_string_matrix_len'
/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a(m_wxml_overloads.o): In 
function `__m_wxml_overloads_MOD_charactersarraych':
m_wxml_overloads.F90:(.text+0x5088): undefined reference to 
`__fox_m_fsys_format_MOD_str_string_array_len'
/root/Install/FoX-4.1.2/objs/lib/libFoX_common.a(m_common_namespaces.o): In 
function `__m_common_namespaces_MOD_checknamespaces':
m_common_namespaces.F90:(.text+0x3969): undefined reference to 
`__m_common_attrs_MOD_get_key_len'
m_common_namespaces.F90:(.text+0x39fc): undefined reference to 
`__m_common_attrs_MOD_get_value_by_index_len'
m_common_namespaces.F90:(.text+0x3fe3): undefined reference to 
`__m_common_attrs_MOD_get_key_len'
m_common_namespaces.F90:(.text+0x4214): undefined reference to 
`__m_common_attrs_MOD_get_key_len'
m_common_namespaces.F90:(.text+0x42e0): undefined reference to 
`__m_common_attrs_MOD_get_value_by_index_len'
collect2: error: ld returned 1 exit status
make[1]: *** [wxml_example] Error 1
make[1]: Leaving directory `/root/Install/FoX-4.1.2/examples'
make: *** [examples_build] Error 2

--

The "../FoX-config --libs --wxml" in the above gfortran command expands to:

/root/Install/FoX-4.1.2/objs/lib/libFoX_wxml.a 
/root/Install/FoX-4.1.2/objs/lib/libFoX_common.a 
/root/Install/FoX-4.1.2/objs/lib/libFoX_utils.a 
/root/Install/FoX-4.1.2/objs/lib/libFoX_fsys.a

I know that the order of static libraries is important when linking under 
linux but I can't find an order which makes this problem go away (and, the 
same order used to work). Furthermore, some of the undefined reference errors 
appear to be to functions which are in the same library, so no change in 
ordering of libraries can fix that.

I don't know enough to figure out if this is a gfortran issue or a linker 
issue (so apologies if this isn't a gfortran issue - in which case I'll post 
the issue elsewhere). I'm also not too sure about how to make a more reduced 
test case here.

I should also note that, if I skip building the example case when building 
this library it will complete "make" successfully. But, when I try to link my 
own code against the library I get the same errors.

Thanks,
Andrew.

-- 

* Andrew Benson: http://users.obs.carnegiescience.edu/abenson/contact.html

* Galacticus: http://sites.google.com/site/galacticusmodel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]