undefined reference error while using FOX library

43 views
Skip to first unread message

surajit nandi

unread,
Dec 22, 2018, 12:23:33 PM12/22/18
to FoX-discuss
Hi,

I am new to fortran. I want to use the FoX library for one of my research project.
I just installed FoX libraries to use wxml as a xml parser with fortran. I compiled FoX with the following command:


$ ./configure FC=gfortran --prefix=/home/user/test
$ make install

it was installed without any problem. however, when I am trying to run the example file wxml_example.f90 after renaming it as wxml_example.f95 with the following command

$ f95 wxml_example.f95 -L/home/user/test/lib -I/home/user/test/finclude

I am getting the following error:

/tmp/cc7Q8ibD.o: In function `MAIN__':
wxml_example.f95:(.text+0x3d): undefined reference to `__m_wxml_core_MOD_xml_openfile'
wxml_example.f95:(.text+0x72): undefined reference to `__m_wxml_core_MOD_xml_adddoctype'
wxml_example.f95:(.text+0xab): undefined reference to `__m_wxml_core_MOD_xml_addparameterentity'
wxml_example.f95:(.text+0xd4): undefined reference to `__m_wxml_core_MOD_xml_addinternalentity'
wxml_example.f95:(.text+0xf9): undefined reference to `__m_wxml_core_MOD_xml_addelementtodtd'
wxml_example.f95:(.text+0x11e): undefined reference to `__m_wxml_core_MOD_xml_addattlisttodtd'
wxml_example.f95:(.text+0x136): undefined reference to `__m_wxml_core_MOD_xml_addpereferencetodtd'
wxml_example.f95:(.text+0x165): undefined reference to `__m_wxml_core_MOD_xml_addxmlpi'
wxml_example.f95:(.text+0x19a): undefined reference to `__m_wxml_core_MOD_xml_addpseudoattribute_ch'
wxml_example.f95:(.text+0x1cf): undefined reference to `__m_wxml_core_MOD_xml_addpseudoattribute_ch'
wxml_example.f95:(.text+0x204): undefined reference to `__m_wxml_core_MOD_xml_addnotation'
wxml_example.f95:(.text+0x225): undefined reference to `__m_wxml_core_MOD_xml_addcomment'
wxml_example.f95:(.text+0x25d): undefined reference to `__m_wxml_core_MOD_xml_addexternalentity'
wxml_example.f95:(.text+0x299): undefined reference to `__m_wxml_core_MOD_xml_addxmlstylesheet'
wxml_example.f95:(.text+0x2ce): undefined reference to `__m_wxml_core_MOD_xml_addxmlpi'
wxml_example.f95:(.text+0x2ea): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x309): undefined reference to `__m_wxml_overloads_MOD_attributescalarint'
wxml_example.f95:(.text+0x33e): undefined reference to `__m_wxml_core_MOD_xml_addattribute_ch'
wxml_example.f95:(.text+0x35a): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x377): undefined reference to `__m_wxml_core_MOD_xml_addcomment'
wxml_example.f95:(.text+0x38f): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x3ae): undefined reference to `__m_wxml_overloads_MOD_attributescalarint'
wxml_example.f95:(.text+0x3db): undefined reference to `__m_wxml_overloads_MOD_attributescalarrealdp'
wxml_example.f95:(.text+0x408): undefined reference to `__m_wxml_overloads_MOD_attributescalarrealdp'
wxml_example.f95:(.text+0x42b): undefined reference to `__m_wxml_core_MOD_xml_addcharacters_ch'
wxml_example.f95:(.text+0x44e): undefined reference to `__m_wxml_core_MOD_xml_addcharacters_ch'
wxml_example.f95:(.text+0x466): undefined reference to `__m_wxml_core_MOD_xml_endelement'
wxml_example.f95:(.text+0x489): undefined reference to `__m_wxml_core_MOD_xml_addcharacters_ch'
wxml_example.f95:(.text+0x4b8): undefined reference to `__m_wxml_core_MOD_xml_addxmlpi'
wxml_example.f95:(.text+0x4ed): undefined reference to `__m_wxml_core_MOD_xml_addpseudoattribute_ch'
wxml_example.f95:(.text+0x509): undefined reference to `__m_wxml_core_MOD_xml_addentityreference'
wxml_example.f95:(.text+0x52c): undefined reference to `__m_wxml_core_MOD_xml_addcharacters_ch'
wxml_example.f95:(.text+0x544): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x579): undefined reference to `__m_wxml_core_MOD_xml_addattribute_ch'
wxml_example.f95:(.text+0x5d6): undefined reference to `__m_wxml_core_MOD_xml_endelement'
wxml_example.f95:(.text+0x5ee): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x623): undefined reference to `__m_wxml_core_MOD_xml_addattribute_ch'
wxml_example.f95:(.text+0x63f): undefined reference to `__m_wxml_core_MOD_xml_addentityreference'
wxml_example.f95:(.text+0x66a): undefined reference to `__m_wxml_core_MOD_xml_declarenamespace'
wxml_example.f95:(.text+0x695): undefined reference to `__m_wxml_core_MOD_xml_declarenamespace'
wxml_example.f95:(.text+0x6ad): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x6c5): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x6dd): undefined reference to `__m_wxml_core_MOD_xml_endelement'
wxml_example.f95:(.text+0x6f5): undefined reference to `__m_wxml_core_MOD_xml_newelement'
wxml_example.f95:(.text+0x720): undefined reference to `__m_wxml_core_MOD_xml_declarenamespace'
wxml_example.f95:(.text+0x755): undefined reference to `__m_wxml_core_MOD_xml_addattribute_ch'
wxml_example.f95:(.text+0x771): undefined reference to `__m_wxml_core_MOD_xml_endelement'
wxml_example.f95:(.text+0x782): undefined reference to `__m_wxml_core_MOD_xml_close'
collect2: error: ld returned 1 exit status

I am using ubuntu 18.04 on a x86_64 machine.

It seems some of the tests were failed. The check.out from make check is attached.

Can anyone please indicate what is the problem? Or at least point out to a link if it is solved?



Thanks in advance,

With regards,

Surajit Nandi
Scuola Normale Superiore di Pisa
Piazza dei Cavalieri 7, Pisa, Italy
check.out

Andrew Walker [EAR]

unread,
Dec 24, 2018, 5:58:37 AM12/24/18
to FoX-discuss

Hi Surajit,


It looks like the compiler cannot find the FoX module files when compiling wxml_example.f95. Most Fortran 90 compilers need these to compile source code which "use" modules to check interfaces (it is not just a case of linking the module at the end). For gfortran you need to add a -I flag so the compiler knows where to look. 


FoX creates a little script to help set the compile and link paths - see "linking to an existing programme" at http://homepages.see.leeds.ac.uk/~earawa/FoX/DoX/Compilation.html. I think this works for make install as well as just make, but I don't think we test this.


Those errors in the tests look like something has gone wrong. What version of FoX are you running, and what version of gfortran? Those tests all passed in travis after the last commit on master (using gfortran 4.9 and Ubuntu 14.04).


Best wishes,


Andrew




From: fox-d...@googlegroups.com <fox-d...@googlegroups.com> on behalf of surajit nandi <surajit....@gmail.com>
Sent: 20 December 2018 17:18:47
To: FoX-discuss
Subject: [FoX] undefined reference error while using FOX library
 
--
You received this message because you are subscribed to the Google Groups "FoX-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fox-discuss...@googlegroups.com.
To post to this group, send email to fox-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/fox-discuss.
For more options, visit https://groups.google.com/d/optout.

surajit nandi

unread,
Dec 27, 2018, 11:57:47 AM12/27/18
to fox-d...@googlegroups.com
Dear Andrew,

Thank you very much for your reply. I figured that if I used the FoX-config --lib --wxml and FoX-config --fcflags flags while compiling, it is linking correctly. Thanks to  a member of this group who pointed this out to me. I am comfortable with this solution because it simply saves me from typing many library paths while compiling.

With best regards,
Surajit

You received this message because you are subscribed to a topic in the Google Groups "FoX-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fox-discuss/tqKgCqb5wug/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fox-discuss...@googlegroups.com.

To post to this group, send email to fox-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/fox-discuss.
For more options, visit https://groups.google.com/d/optout.


--
Surajit Nandi,
Smart Laboratory
Scuola Normale Superiore
Piazza dei Cavalieri 7, 56126 Pisa
Italy
Reply all
Reply to author
Forward
0 new messages