XLF VERSION 3, LIBPATH ERROR

ITEM: RTA000047128



QUESTION:                                                                       
We received an update document for the XL Fortran Compiler Version 3            
which indicates that there is a document error in regards to LIBPATH            
statement.  There is an APAR IX44785 for this.  Would you be able to            
tell me what is the error?  We are having some problems with LIBPATH            
and would like to fix it, we followed the directions in the User's              
Guide and it does not seem to search the paths we specify.                      
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A: Let me give you the APAR description:                                        
                                                                                
The whole section on LIBPATH in the XLF V3R1 User's Guide p16/17                
is plain wrong, causing confusion. Similarly, the section on the                
-L Option on p65, should indicate that LIBPATH is used only at                  
runtime and should contain any libraries specified by -L.                      
LIBPATH will override (i.e. at runtime) anything specified at                   
bind time (i.e. "ld") by -L (i.e. object file specified by                      
FilePath parameter). Hence make sure that LIBPATH has the path                  
specified by -L at bind time (ie., if necessary). In conclusion,                
at bind time (ie., "ld" phase of compile time) you must use -L                  
to specify the location of any libraries indicated by -l, unless                
they are in the default path /usr/lib.                                          
                                                                                
  How library search path is determined:                                        
  At link time:                                                                 
  If -L is used to specify one or more directories, those paths are             
  written into the loader section of the executable file,                       
  followed by  /lib and /usr/lib.                                               
  If -L is not set and the LIBPATH variable is set, the                         
  LIBPATH setting is placed in the loader section.                             
  If neither -L or LIBPATH have been specified,                                 
  the default path                                                              
  "/lib:/usr/lib" is placed in the loader section.                              
  At load (run) time:                                                           
  If LIBPATH is set, the loader looks for each required library                 
  in the  directories specified by the LIBPATH setting.                         
  If LIBPATH is not set, or the library was not found                           
  in any of the LIBPATH directories,                                            
  the loader searches the directories specified                                 
  in the loader section of the executable file.                                 
                                                                                
  There only reference to an error that I could find was a PMR that             
  reproduced the problem by doing exactly what it tells you on pages            
  16 and 17 of the xlf 3.1 manual. In this case xlf fails with the              
  following error:                                                             
  Could not load program xlfentry                                               
  Could not load library libxlf90.a.io.o.                                       
  Error was: No such file or directory                                          
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
QUESTION:                                                                       
That is exactly the error we are seeing but I have couple of                    
additional questions:                                                           
                                                                                
- From your statements, should we NOT use LIBPATH variable during               
  compilation?  It seems that the system ignored the LIBPATH variable.          
  When we specified libraries using -L option they worked.                      
                                                                                
- What is the order in which the library paths are searched if using            
  -L option?  With LIBPATH, it is first to last.                               
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A: Yes, you should NOT use the LIBPATH variable during compilation. For         
further information I have appended an updated section from the                 
README provided with xlf 3.1.2.0.                                               
                                                                                
4) The LIBPATH environment variable does not in fact replace the -L             
   option, which must be used at link time for the linker to locate             
   libraries with non-default paths.  You should only need to use LIBPATH       
   if libraries are present at run time in a different directory than at        
   compile time. To use LIBPATH, set it at run time to the names of any         
   directories that contain libraries linked through -L, plus /usr/lib:         
                                                                                
   # Compile and link                                                           
   xlf -L/usr/lib/mydir1 -L/usr/lib/mydir2 -lmylib1 -lmylib2 test.f            
   # Run the program with the same configuration -- it finds the                
   # libraries in /usr/lib/mydir1 and /usr/lib/mydir2 without                   
   # any extra action.                                                          
   a.out                                                                        
   # After moving libmylib1.a and libmylib2.a into /usr/lib/mydir3, the         
   # following commands would be needed.                                        
   export LIBPATH=/usr/lib/mydir3:/usr/lib                                      
   a.out                                                                        
                                                                                
To answer your second question, the order is first to last that the             
library paths are searched when using the -L option.                            
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
                                                                                
                                                                               
This item was created from library item Q669179      CVHFV                      
                                                                                
Additional search words:                                                        
COMPILERS CVHFV ERR ERROR IX LIBPATH OZNEW RISCL RISCSYSTEM SEP94               
SOFTWARE VERSION XLF                                                            
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                               


WWQA: ITEM: RTA000047128 ITEM: RTA000047128
Dated: 06/1996 Category: RISCL
This HTML file was generated 99/06/24~12:43:18
Comments or suggestions? Contact us