Can anybody help me linking Fortran into C++

A

a-lbi

I use gcc compiler (version 2.8.1). During linking I get the following
error message:

Undefined first referenced
symbol in file
log10l /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(write.o)
strtof /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
strtold /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
__assert_c99 /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(error.o)
ld: fatal: Symbol referencing errors. No output written to symsimp
collect2: ld returned 1 exit status
gmake: *** [symsimp] Error 1

Does anybody know where I can find libraries with those functions?
 
M

Michael DOUBEZ

(e-mail address removed) a écrit :
I use gcc compiler (version 2.8.1).

2.8.1 ? It is 9 year old.
During linking I get the following
error message:

Undefined first referenced
symbol in file
log10l /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(write.o)
strtof /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
strtold /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
__assert_c99 /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(error.o)
ld: fatal: Symbol referencing errors. No output written to symsimp
collect2: ld returned 1 exit status
gmake: *** [symsimp] Error 1

Does anybody know where I can find libraries with those functions?

Your compiler looks into /opt/gcc_4.1.2/solaris10/ for gcc v4.1.2.

I think you have a path issue in your toolchain.

Michael
 
A

a-lbi

Your compiler looks into /opt/gcc_4.1.2/solaris10/ for gcc v4.1.2.

I think you have a path issue in your toolchain.

Michael


Thank you for your reply.
The problem is bit coplicated...

1. The reason I'm using 2.8.1 is that the ARPACK++ library I'm going
to use (some numerical linear algebra library interface) compiles only
in 2.8.1 (don't ask me why :p but it is not my task to change the
library code)

2. The fortran compiler I used is distributed with 4.1.2 version of
gcc compiler, that's why you see references to the file /opt/gcc_4.1.2/
solaris10/lib/libgfortran.a

3. Unfortunatelly the older versions of fortran copilers doesn't have
the library libgfortran.a (probably it was not installed by system
administrator :/). That's why I must use library from new gcc.

Or maybe you have some more ideas?

Janusz
 
A

a-lbi

(e-mail address removed) a écrit :
I use gcc compiler (version 2.8.1).

2.8.1 ? It is 9 year old.


During linking I get the following
error message:
Undefined first referenced
symbol in file
log10l /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(write.o)
strtof /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
strtold /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
__assert_c99 /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(error.o)
ld: fatal: Symbol referencing errors. No output written to symsimp
collect2: ld returned 1 exit status
gmake: *** [symsimp] Error 1
Does anybody know where I can find libraries with those functions?

Your compiler looks into /opt/gcc_4.1.2/solaris10/ for gcc v4.1.2.

I think you have a path issue in your toolchain.

Michael


Thank you for your reply.
The problem is bit coplicated...

1. The reason I'm using 2.8.1 is that the ARPACK++ library I'm going
to use (some numerical linear algebra library interface) compiles only
in 2.8.1 (don't ask me why :p but it is not my task to change the
library code)

2. The fortran compiler I used is distributed with 4.1.2 version of
gcc compiler, that's why you see references to the file /opt/gcc_4.1.2/
solaris10/lib/libgfortran.a

3. Unfortunatelly the older versions of fortran copilers doesn't have
the library libgfortran.a (probably it was not installed by system
administrator :/). That's why I must use library from new gcc.

Or maybe you have some more ideas?

Janusz
 
R

Robert Bauck Hamar

(e-mail address removed) a écrit :
I use gcc compiler (version 2.8.1).

2.8.1 ? It is 9 year old.


During linking I get the following
error message:
Undefined first referenced
symbol in file
log10l /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(write.o)
strtof /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
strtold /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
__assert_c99 /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(error.o)
ld: fatal: Symbol referencing errors. No output written to symsimp
collect2: ld returned 1 exit status
gmake: *** [symsimp] Error 1
Does anybody know where I can find libraries with those functions?

Your compiler looks into /opt/gcc_4.1.2/solaris10/ for gcc v4.1.2.

I think you have a path issue in your toolchain.

Michael


Thank you for your reply.
The problem is bit coplicated...

1. The reason I'm using 2.8.1 is that the ARPACK++ library I'm going
to use (some numerical linear algebra library interface) compiles only
in 2.8.1 (don't ask me why :p but it is not my task to change the
library code)

A lot has changed since then. C++ was standardised, for instance. If you
need features of the 2.8.1 GCC, you are probably best off sticking to this
release, however. Changing the library code may be the worst thing to do.
2. The fortran compiler I used is distributed with 4.1.2 version of
gcc compiler, that's why you see references to the file /opt/gcc_4.1.2/
solaris10/lib/libgfortran.a

The gfortran compiler is relatively new. Earlier versions of GCC shipped
only a Fortran 77 compiler, called with g77.
3. Unfortunatelly the older versions of fortran copilers doesn't have
the library libgfortran.a (probably it was not installed by system
administrator :/). That's why I must use library from new gcc.

I believe libgfortran is new with the gfortran compiler.
Or maybe you have some more ideas?

Standard C++, the topic of this newsgroup, has no means of communicating
with fortran. Since you are using both the GNU C++ and the GNU fortran
compilers (?), I suggest you ask in a GNU forum.
 
M

Michael DOUBEZ

(e-mail address removed) a écrit :
(e-mail address removed) a écrit :
I use gcc compiler (version 2.8.1).
2.8.1 ? It is 9 year old.


During linking I get the following
error message:
Undefined first referenced
symbol in file
log10l /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(write.o)
strtof /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
strtold /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(read.o)
__assert_c99 /opt/gcc_4.1.2/solaris10/lib/
libgfortran.a(error.o)
ld: fatal: Symbol referencing errors. No output written to symsimp
collect2: ld returned 1 exit status
gmake: *** [symsimp] Error 1
Does anybody know where I can find libraries with those functions?
Your compiler looks into /opt/gcc_4.1.2/solaris10/ for gcc v4.1.2.

I think you have a path issue in your toolchain.

Thank you for your reply.
The problem is bit coplicated...

1. The reason I'm using 2.8.1 is that the ARPACK++ library I'm going
to use (some numerical linear algebra library interface) compiles only
in 2.8.1 (don't ask me why :p but it is not my task to change the
library code)

2. The fortran compiler I used is distributed with 4.1.2 version of
gcc compiler, that's why you see references to the file /opt/gcc_4.1.2/
solaris10/lib/libgfortran.a

3. Unfortunatelly the older versions of fortran copilers doesn't have
the library libgfortran.a (probably it was not installed by system
administrator :/). That's why I must use library from new gcc.

Or maybe you have some more ideas?

A hint perhaps: the functions it doesn't find are likely to be C99
function (ANSI C has only strtod not strtold, _assert_c99 ...).

You will have to perform the final link with gcc 4.1.2 or recompile
libgfortran.a in ansi C. man gcc is your friend here.

Michael
 
M

Michael DOUBEZ

(e-mail address removed) a écrit :
[snip]
3. Unfortunatelly the older versions of fortran copilers doesn't have
the library libgfortran.a (probably it was not installed by system
administrator :/). That's why I must use library from new gcc.

I don't know the content of your server but f77 (or f95) may be more
useful than using gcc for compiling fortran.

Michael
 
A

a-lbi

(e-mail address removed) a écrit :
[snip]
3. Unfortunatelly the older versions of fortran copilers doesn't have
the library libgfortran.a (probably it was not installed by system
administrator :/). That's why I must use library from new gcc.

I don't know the content of your server but f77 (or f95) may be more
useful than using gcc for compiling fortran.

We have f77, but it has some 'licence problems'. Probably I should
talk with system administrator about it but it is not so easy to get
in touch with him.
 
A

a-lbi

The gfortran compiler is relatively new. Earlier versions of GCC shipped
only a Fortran 77 compiler, called with g77.

Thanks for the tip. I already discovered that we have version 2.95.1
of gcc with g77. The previous problems vanished, however the new
problems occured. Do you have any ideas about this:

symbol in file
s_cmp /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(dsaupd.o)
do_fio /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(dsaupd.o)
e_wsfe /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(dsaupd.o)
pow_dd /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(dseupd.o)
s_copy /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(dseupd.o)
s_stop /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(xerbla.o)
s_wsfe /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(dsaupd.o)
G77_second_0 /home/werkstud/janusz/
linear_algebra/ARPACK/libarpack_SUN4.a(dsconv.o)
ld: fatal: Symbol referencing errors. No output written to symsimp
collect2: ld returned 1 exit status
gmake: *** [symsimp] Error 1


Standard C++, the topic of this newsgroup, has no means of communicating
with fortran. Since you are using both the GNU C++ and the GNU fortran
compilers (?), I suggest you ask in a GNU forum.

I probably will.

J.
 
A

a-lbi

Thank you everybody for help. It appears that I finally solved the
problem...

The solution was:

1. Use g77 instead of gfortran
2. Link the libg2c.a library

I expect other problems (because the rest of the programme is compiled
with newer compiler) but recent problems are solved :D

J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top