Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
1619
Posts in
535
Topics by
781
Members - Latest Member:
chekyl43
January 27, 2023, 03:59:07 PM
Home
|
Help
|
Search
|
Login
|
Register
|
Absoft User Forum
|
Support
|
Macintosh
|
Undefined Symbols when compiling f77 and f90 code
« previous
next »
Print
Pages: [
1
]
Author
Topic: Undefined Symbols when compiling f77 and f90 code (Read 11346 times)
LauraDoyle
Newbie
Posts: 3
Undefined Symbols when compiling f77 and f90 code
«
on:
September 19, 2007, 04:58:21 PM »
Hello,
I am running Absoft ProFortran 9.2 on my mac g5 tower. I am trying to run a hydrodynamic and water quality model. To solve it, i need to use an old library of functions and subroutines called nspcg.f it was developed using fortran 1977 and is a very complicated and long piece of code (over 330000 lines of code). many collegues of mine use it successfully with compaq visual fortran, and some even with absoft fortran, but i can not get my program to compile correctly, either using the terminal window or using absoft tools.
I get the following type of error:
/usr/bin/ld: Undefined symbols:
_TIMER
_CG
_DFAULT
_LINEPLU_V0
_LINEPLU_V1
_MIC2
_NSPCG
_SI
./build/si3d_mixing.o reference to undefined _TIMER
./build/si3d_procedures.o reference to undefined _CG
./build/si3d_procedures.o reference to undefined _DFAULT
./build/si3d_procedures.o reference to undefined _LINEPLU_V0
./build/si3d_procedures.o reference to undefined _LINEPLU_V1
./build/si3d_procedures.o reference to undefined _MIC2
./build/si3d_procedures.o reference to undefined _NSPCG
./build/si3d_procedures.o reference to undefined _SI
./build/si3d_procedures.o reference to undefined _TIMER
./build/si3d.o reference to undefined _TIMER
after many searches on-line and in manuals, I cant figure out what to do. I tried adding the f77_oldnames.o when building the project, but still no luck. i added this .o file to the compile line of the terminal for both the f77 code and the f90 code. all the symbols listed above are functions in nspcg.f
any suggestions? i have tried changing the case (from lower to capital) of all the functions in the f77 file and f90 files, but still no success.
Thanks,
Laura
Logged
Mike Linacre
Sr. Member
Posts: 259
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #1 on:
September 20, 2007, 02:33:56 AM »
The Absoft Fortran compiler is mangling the external names by adding _ in front. One solution is an alias .ALS file, equivalencing the external names. Each line has the "wrong" name followed by the "right" name. Something like:
_TIMER TIMER
_CG CG
....
Logged
LauraDoyle
Newbie
Posts: 3
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #2 on:
September 20, 2007, 01:59:57 PM »
OK, I will look into this alias file, where does it go? Do I include it in the directory with the rest of the files and add it to my project? I'm still trying to learn Fortran as I go (not fun, wish I had learned it in college!) but I think I'm a quick learner. . .
Thanks for the suggestion
Logged
Mike Linacre
Sr. Member
Posts: 259
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #3 on:
September 20, 2007, 05:12:25 PM »
Laura, you can add these lines to an existing ALS file, like Unicode.als, which is already in your link phase.
Logged
LauraDoyle
Newbie
Posts: 3
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #4 on:
September 20, 2007, 06:03:40 PM »
I managed to fix it by adding the following compiler directives to any subroutine in my f90 code that reffered to an external:
!DIR$ NAME(TIMER="timer")
!DIR$ NAME(CG="cg")
!DIR$ NAME(DFAULT="dfault")
!DIR$ NAME(LINEPLU_V0="LINEPLU_v0")
!DIR$ NAME(LINEPLU_V1="LINEPLU_v1")
!DIR$ NAME(MIC2="mic2")
!DIR$ NAME(NSPCG="nspcg")
!DIR$ NAME(SI="si")
Logged
DanSzumski
Newbie
Posts: 3
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #5 on:
January 01, 2008, 02:08:03 PM »
Hello. I have had the exact same problem in linking a fortran program that I wrote. At your suggestion I have included the lines:
!DIR$ NAME(PLOTIT="plotit")
!DIR$ NAME(SOLN="soln")
...just after my COMMON block...with the expected results, but undefined externals(now in lower case)
f90fe: 0 Errors, 8 Warnings, 0 Other messages, 0 ANSI
/usr/bin/ld: Undefined symbols:
_plotit
_soln
/tmp/U2HuKX/BLACKEQN.o reference to undefined _plotit
/tmp/U2HuKX/BLACKEQN.o reference to undefined _soln
collect2: ld returned 1 exit status
link failed.
I use Mac OS X 10.4.11 powerbook.
What am I missing here?
Thanks for your assistance,
DanSzumski
«
Last Edit: January 01, 2008, 02:15:45 PM by DanSzumski
»
Logged
Mike Linacre
Sr. Member
Posts: 259
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #6 on:
January 01, 2008, 03:53:08 PM »
How about searching all library files for "soln" (upper or lower case, etc.). Then display the library to find out exactly how "soln" is specified in the library, e.g., "Soln" or "soln0", etc.
Then do the same for "plotit".
Logged
DanSzumski
Newbie
Posts: 3
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #7 on:
January 01, 2008, 04:55:27 PM »
Diectory with FORTRAN and C source:
dan:~ danielszumski$ cd ./FORTRANLIBRARY/BLACKEQN
dan:~/FORTRANLIBRARY/BLACKEQN danielszumski$ ls -l
total 2448
-rw-r--r-- 1 danielsz wheel 811 Dec 31 08:57 BLACKCOM
-rwxr-xr-x 1 danielsz danielsz 188156 Nov 20 07:54 BLACKEQN
-rwxr-xr-x 1 danielsz wheel 6008 Jan 1 10:29 BLACKEQN.F
-rw-r--r-- 1 danielsz danielsz 1131 Jan 1 13:39 BLACKEQN.INP.txt
-rw-r--r-- 1 danielsz danielsz 19456 Dec 29 18:45 BLACKEQN.NOTES
-rw-r--r-- 1 danielsz danielsz 0 Dec 29 18:52 BLACKEQN.OUT
-rw-r--r-- 1 danielsz danielsz 5102 Jan 1 13:31 BLACKEQN.amk
drwxr-xr-x 3 danielsz danielsz 102 Jan 1 13:28 BLACKEQN.app
drwxr-xr-x 3 danielsz danielsz 102 Nov 20 07:54 BLACKEQN.dSYM
-rw-r--r-- 1 danielsz wheel 3663 Jan 1 13:31 BLACKEQN.gui
-rw-r--r-- 1 danielsz danielsz 11889 Jan 1 13:16 BLACKEQN.r
-rw-r--r-- 1 danielsz danielsz 261717 Dec 20 09:48 BLACKEQN.zip
-rw-r--r-- 1 danielsz danielsz 1154 Dec 22 15:56 INPUT.txt
-rw-r--r-- 1 danielsz danielsz 653 Jan 1 13:16 Info.plist
-rw-r--r-- 1 danielsz danielsz 5734 Dec 30 17:09 Makefile.amk
-rw-r--r-- 1 danielsz wheel 4681 Dec 31 10:44 SOLN.f
-rw-r--r-- 1 danielsz danielsz 98287 Sep 12 2006 Xlib.h
drwxr-xr-x 8 danielsz danielsz 272 Jan 1 13:31 build
-rw-r--r-- 1 danielsz danielsz 0 Dec 29 23:34 fort.10
-rw-r--r-- 1 danielsz danielsz 278112 Jan 1 13:44 libBLACKEQN.a
-rw-r--r-- 1 danielsz danielsz 1320 May 13 2003 manyplot.f
drwxr-xr-x 5 danielsz danielsz 170 Jan 1 13:44 mkdep
-rw-r--r-- 1 danielsz danielsz 1628 Jan 1 13:16 mrweprefs.r
-rw-r--r-- 1 danielsz danielsz 133302 Dec 29 16:34 plotit.f
-rw-r--r-- 1 danielsz danielsz 184956 Dec 30 08:16 plotlib.a
-rw-r--r-- 1 danielsz danielsz 3151 May 13 2003 xlplotit.
Contents of my build directory
dan:~/FORTRANLIBRARY/BLACKEQN/build danielszumski$ ls -l
total 560
-rw-r--r-- 1 danielsz danielsz 28476 Jan 1 13:31 BLACKEQN.o
-rw-r--r-- 1 danielsz danielsz 12492 Jan 1 13:31 SOLN.o
-rw-r--r-- 1 danielsz danielsz 43712 Jan 1 13:31 manyplot.o
-rw-r--r-- 1 danielsz danielsz 189040 Jan 1 13:31 plotit.o
-rw-r--r-- 1 danielsz danielsz 3016 Jan 1 13:31 xlplotit.o
That does not seem to be the problem.
Thanks for your assistance.
DanSzumski
Logged
Mike Linacre
Sr. Member
Posts: 259
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #8 on:
January 01, 2008, 11:03:06 PM »
Please check the name in the library. It may not be the same as the name in the source file.
You may also need to specify the "_" which Absoft prepends to external names by default.
Logged
DanSzumski
Newbie
Posts: 3
Re: Undefined Symbols when compiling f77 and f90 code
«
Reply #9 on:
January 02, 2008, 11:32:58 AM »
Thank you
I have checked all of the libraries and run a 'spotlight' check of the directories. This is not the problem because I have used this program within the Absoft developers framework before I added the call to PLOTIT.f.
I had never tried this program in the Terminal environment untill I began having these problems. Specifically, the greying out of the run icon after a successful build... and... When I try to open the .app file in finder..I get the message:'you cannot open the application "BLACKEQN.app" because it may be damaged or incomplete.'.
I have also used the underscore, both in the main program calls, and in the complier directives. No luck.
It appears to be an issue in the way that the linker functions. It is significant that the problem did not occur (in the Absoft developer environment) when the only external subroutine in the program was SOLN.f which I wrote. The problem arose when I added the call to PLOTIT.f which uses a C routine named xlplotit.c.
Thank you for your time.
Dan
«
Last Edit: January 02, 2008, 11:35:11 AM by DanSzumski
»
Logged
Print
Pages: [
1
]
« previous
next »
Absoft User Forum
|
Support
|
Macintosh
|
Undefined Symbols when compiling f77 and f90 code
SMF 2.0.19
|
SMF © 2021
,
Simple Machines
Privacy Policy
|
Terms and Policies
Helios Multi
©
Bloc
Loading...