From: Axel Freyn <axel-freyn@gmx.de>
To: gcc-help@gcc.gnu.org
Subject: Re: Compilation with g77 works but not with gfortran
Date: Fri, 04 Feb 2011 19:53:00 -0000 [thread overview]
Message-ID: <20110204182314.GQ11006@axel> (raw)
In-Reply-To: <4D4C3B8D.8010803@gmail.com>
Hi Paul,
On Fri, Feb 04, 2011 at 06:46:53PM +0100, Paul van Hoven wrote:
> I have an extension for matlab that i want to compile. The machine on
> which I compile the code has a g77-3.4 and a gfortran-4.2 compiler
> installed. If I set the fortran compiler in the Makefile to g77-3.4 the
> compilation process runs through without any error messages and I can
> use the extension without any problems.
>
>
> [...]
> /net/matlab/Matlab2009b/bin/mex -cxx CXX=/usr/site-local/bin/g++-4.2
> CC=/usr/site-local/bin/g++-4.2 FC= LD=/usr/site-local/bin/g++-4.2 -lg2c
> -lm \
> -O -output lbfgsb.mexa64 solver.o matlabexception.o
> matlabscalar.o matlabstring.o matlabmatrix.o arrayofmatrices.o program.o
> matlabprogram.o lbfgsb.o
> solver.o: In function `timer_':
> solver.f:(.text+0x17c4): undefined reference to `_gfortran_etime'
> solver.o: In function `dcsrch_':
> solver.f:(.text+0x1b66): undefined reference to `_gfortran_compare_string'
> solver.f:(.text+0x1ca7): undefined reference to `_gfortran_compare_string'
> solver.f:(.text+0x20d8): undefined reference to `_gfortran_compare_string'
> solver.f:(.text+0x2215): undefined reference to `_gfortran_compare_string'
> solver.o: In function `subsm_':
> solver.f:(.text+0x2cce): undefined reference to `_gfortran_st_write'
> solver.f:(.text+0x2ce2): undefined reference to
> `_gfortran_transfer_character'
> solver.f:(.text+0x2cea): undefined reference to `_gfortran_st_write_done'
> ...
> ...long list of errors...
> ...
> solver.f:(.text+0xb31c): undefined reference to `_gfortran_st_write'
> solver.f:(.text+0xb324): undefined reference to `_gfortran_st_write_done'
> solver.o: In function `setulb_':
> solver.f:(.text+0xb58c): undefined reference to `_gfortran_compare_string'
> collect2: ld returned 1 exit status
>
> mex: link of ' "lbfgsb.mexa64"' failed.
You have to link with the gfortran-library. g2c only works with g77.
If you add "-lgfortran" to the link command, everything should work
well (I hope :-))
Axel
next prev parent reply other threads:[~2011-02-04 18:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 18:23 Paul van Hoven
2011-02-04 19:53 ` Axel Freyn [this message]
[not found] ` <626908448-1296846552-cardhu_decombobulator_blackberry.rim.net-64410111-@bda169.bisx.prod.on.blackberry>
2011-02-05 0:22 ` Paul van Hoven
2011-02-05 12:03 ` Paul van Hoven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110204182314.GQ11006@axel \
--to=axel-freyn@gmx.de \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).