Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Cofe compilation problem

cylab123
Beginner
840 Views
Hi !
I am using INtel fortran compiler for Linux (non-professional version) on my Laptop running FC11. I am trying to comile one Fortran code with the following attached 'Makefile'. NOW On running 'make', it gives the following error -



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[cylab123@skc INTEL]$ make
ifort -L/usr/X11R6/lib -lX11 -o lifetime lifetime.o minuit.o utilities.o life_com.o tek_life.o x_windows.o x_life_d.o ran.o
x_life_d.o: In function `x_display_':
x_life_d.f:(.text+0xac9): undefined reference to `xx_winman_'
x_life_d.f:(.text+0xd79): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x1006): undefined reference to `draw_axis_'
x_life_d.f:(.text+0x1161): undefined reference to `plotxy_'
x_life_d.f:(.text+0x128f): undefined reference to `draw_line_'
x_life_d.f:(.text+0x12ac): undefined reference to `draw_dash_'
x_life_d.f:(.text+0x12c9): undefined reference to `draw_dash_'
x_life_d.f:(.text+0x1302): undefined reference to `draw_filled_circle_'
x_life_d.f:(.text+0x13fb): undefined reference to `utopix_'
x_life_d.f:(.text+0x152d): undefined reference to `texout_'
x_life_d.f:(.text+0x167b): undefined reference to `texout_'
x_life_d.f:(.text+0x2087): undefined reference to `utopix_'
x_life_d.f:(.text+0x20f4): undefined reference to `texout_'
x_life_d.o: In function `x_display_shapes_':
x_life_d.f:(.text+0x2685): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x27d8): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x297b): undefined reference to `draw_axis_'
x_life_d.f:(.text+0x2a16): undefined reference to `utopix_'
x_life_d.f:(.text+0x2a64): undefined reference to `texout_'
x_life_d.f:(.text+0x2ba3): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2cba): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2e02): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2f4e): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2fa0): undefined reference to `plotxy_'
x_life_d.o:x_life_d.f:(.text+0x31a5): more undefined references to `plotxy_' follow
x_life_d.o: In function `x_eraser_':
x_life_d.f:(.text+0x372d): undefined reference to `xx_winman_'
make: *** [lifetime] Error 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


So please suggest me what changes I need to make in the attched Makefile, to compile the program cleanly.

I am using GCC version as -
gcc version 4.4.0 20090506

& Fortran compiler version as -

/intel/Compiler/11.1/038/

If possible please suggest me the changes in the make file (or additional options for compilation).
Desperately waiting for any help.


Thanks
0 Kudos
6 Replies
Kevin_D_Intel
Employee
840 Views

Appears your sourcefile uses free format. Add the ifort option: -free
0 Kudos
Steven_L_Intel1
Employee
840 Views

Appears your sourcefile uses free format. Add the ifort option: -free
Or rename the file to have a .f90 file type, which would be my recommendation.
0 Kudos
cylab123
Beginner
840 Views
Or rename the file to have a .f90 file type, which would be my recommendation.
Hi !
Thanks for the reply. Now I am able to go lettle more further. But still I am getting the following error message -

###########################################################################################################

[chamoli@skc INTEL]$ make
ifort -L/usr/X11R6/lib -lX11 -o lifetime lifetime.o minuit.o utilities.o life_com.o tek_life.o x_windows.o x_life_d.o ran.o
x_life_d.o: In function `x_display_':
x_life_d.f:(.text+0xac9): undefined reference to `xx_winman_'
x_life_d.f:(.text+0xd79): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x1006): undefined reference to `draw_axis_'
x_life_d.f:(.text+0x1161): undefined reference to `plotxy_'
x_life_d.f:(.text+0x128f): undefined reference to `draw_line_'
x_life_d.f:(.text+0x12ac): undefined reference to `draw_dash_'
x_life_d.f:(.text+0x12c9): undefined reference to `draw_dash_'
x_life_d.f:(.text+0x1302): undefined reference to `draw_filled_circle_'
x_life_d.f:(.text+0x13fb): undefined reference to `utopix_'
x_life_d.f:(.text+0x152d): undefined reference to `texout_'
x_life_d.f:(.text+0x167b): undefined reference to `texout_'
x_life_d.f:(.text+0x2087): undefined reference to `utopix_'
x_life_d.f:(.text+0x20f4): undefined reference to `texout_'
x_life_d.o: In function `x_display_shapes_':
x_life_d.f:(.text+0x2685): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x27d8): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x297b): undefined reference to `draw_axis_'
x_life_d.f:(.text+0x2a16): undefined reference to `utopix_'
x_life_d.f:(.text+0x2a64): undefined reference to `texout_'
x_life_d.f:(.text+0x2ba3): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2cba): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2e02): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2f4e): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2fa0): undefined reference to `plotxy_'
x_life_d.o:x_life_d.f:(.text+0x31a5): more undefined references to `plotxy_' follow
x_life_d.o: In function `x_eraser_':
x_life_d.f:(.text+0x372d): undefined reference to `xx_winman_'
make: *** [lifetime] Error 1
#########################################################################################################

I do not understand whay this problem is there. I thought as if some dependency is missing. But I checked with the program, it is not the case. Any clue ?
The make file I am running is attached with this mail.

Please suggest me now what other options I need to incorporate with ifort to cleanly finish the make process.

Waiting for the reply.

Thanks.
0 Kudos
TimP
Honored Contributor III
840 Views
Are you expecting /usr/X11R6/lib/libX11 to contain Fortran wrappers? This is not supplied by either gcc or Intel compilers; it might be available (for C linkage) as an optional Fedora install package (libx11-dev). I suppose you must have installed something there, or you would get an error about finding that library. If you have C callable functions there (no appended underscore), in principle, you could call them in accordance with iso_c_binding.
In your Makefile, you have an option -Mnounderscore, which would appear to be an option for some Fortran compiler which you didn't mention to suppress the trailing underscore. If you got really lucky, the corresponding ifort option '-assume nounderscore' might help. It's really important to read the compiler docs when you attempt nonportable stuff like this.
0 Kudos
cylab123
Beginner
840 Views
Quoting - tim18
Are you expecting /usr/X11R6/lib/libX11 to contain Fortran wrappers? This is not supplied by either gcc or Intel compilers; it might be available (for C linkage) as an optional Fedora install package (libx11-dev). I suppose you must have installed something there, or you would get an error about finding that library. If you have C callable functions there (no appended underscore), in principle, you could call them in accordance with iso_c_binding.
In your Makefile, you have an option -Mnounderscore, which would appear to be an option for some Fortran compiler which you didn't mention to suppress the trailing underscore. If you got really lucky, the corresponding ifort option '-assume nounderscore' might help. It's really important to read the compiler docs when you attempt nonportable stuff like this.
Hi !
Thanks for the reply mail. I am not very smart in Fortran , so didn't get much of your thought. By the way even if I remove the option '-Mnounderscore' from the Make file, it doesn't make any difference. So to clerify the whole issue, I am attaching the original fortran code (giving problem on making) along with the make file I am using. When I run this make file, i get the following error message on the screen -

######################################################################
[chamoli@skc INTEL]$ make
ifort -L/usr/X11R6/lib -lX11 -o lifetime life_com.o lifetime.o minuit.o tek_life.o utilities.o x_life_d.o x_windows.o ran.o
x_life_d.o: In function `x_display_':
x_life_d.f:(.text+0xac9): undefined reference to `xx_winman_'
x_life_d.f:(.text+0xd79): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x1006): undefined reference to `draw_axis_'
x_life_d.f:(.text+0x1161): undefined reference to `plotxy_'
x_life_d.f:(.text+0x128f): undefined reference to `draw_line_'
x_life_d.f:(.text+0x12ac): undefined reference to `draw_dash_'
x_life_d.f:(.text+0x12c9): undefined reference to `draw_dash_'
x_life_d.f:(.text+0x1302): undefined reference to `draw_filled_circle_'
x_life_d.f:(.text+0x13fb): undefined reference to `utopix_'
x_life_d.f:(.text+0x152d): undefined reference to `texout_'
x_life_d.f:(.text+0x167b): undefined reference to `texout_'
x_life_d.f:(.text+0x2087): undefined reference to `utopix_'
x_life_d.f:(.text+0x20f4): undefined reference to `texout_'
x_life_d.o: In function `x_display_shapes_':
x_life_d.f:(.text+0x2685): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x27d8): undefined reference to `xx_winman_'
x_life_d.f:(.text+0x297b): undefined reference to `draw_axis_'
x_life_d.f:(.text+0x2a16): undefined reference to `utopix_'
x_life_d.f:(.text+0x2a64): undefined reference to `texout_'
x_life_d.f:(.text+0x2ba3): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2cba): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2e02): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2f4e): undefined reference to `plotxy_'
x_life_d.f:(.text+0x2fa0): undefined reference to `plotxy_'
x_life_d.o:x_life_d.f:(.text+0x31a5): more undefined references to `plotxy_' follow
x_life_d.o: In function `x_eraser_':
x_life_d.f:(.text+0x372d): undefined reference to `xx_winman_'
make: *** [lifetime] Error 1
########################################################################


. Please have a look at the code and suggest me if I have to add (or remove) something from my Makefile ?

waiting for the reply.

Thanks.

0 Kudos
Kevin_D_Intel
Employee
840 Views

Best to post new replies and not edit earlier ones.Our earlier advice now no longer applies to the link errors that you subsequently pasted into your original post. Maybe you can go back and re-create the compilation errors and re-insert those into your original post so our earlier replies make sense and are of benefit to others reading this forum.

Your unresolved reference errors are not flagging anything wrong with the attached Fortran source file or the ifort compiler. The unresolved externals occur because you failed to provide the linker with the required library (or .o file) containing the routines that are called from within the attached Fortran source file.

For example:

The first unresolved external reference error received is:

x_life_d.f:(.text+0xac9): undefined reference to `xx_winman_'


Which relates to the external CALL at line 197 of the attached Fortran source file:

194 C Initialize graphics
195
196 IF(GRAF_INITIAL) THEN
197 CALL XX_WINMAN('CLR ',0)
198 END IF


You received the unresolved external error because you did not provide the linker with a library or object file containing the routine XX_WINMAN.

You need search the other source files or find out from the application author what library or source file provides this and the other unresolved routines. At least from the call above, you clearly need a graphics library of some sort and based on the lifetime rule in the makefile, it seem the application depends on X-windows.

I suspect x_windows.c contains some or all of these unresolved references and that Tim's advice to compile the Fortran source files with -assume nounderscore might just do the trick.

Maybe either the source file xjwlibu.f or xjwlibc.cprovides these routines. By the way, the rule for xjwlibu.f uses a "0" instead of "o" in the object name which reads: xjwlubu.0. I see both rules are inactive too.
0 Kudos
Reply