Topic: Not picking up libraries

I have inherited a large project (which has numerous issues and very badly written fortran but I wont go into that) which I manage using MS visual studio 2010 and the Intel compiler.

However, I thought I would give SimplyFortran a go as it is always worth using more than 1 compiler where possible to reveal portability issues etc.

But, I can't get SimplyFortran to pick up some precompiled libraries, which are written in a mixture of Fortran and C.

I specify the libraries and the folder in the correct place in the IDE and so the top of the Makefile is

FC="C:\Users\User\Documents\programs_local\Simply Fortran\mingw\bin\gfortran.exe"
CC="C:\Users\User\Documents\programs_local\Simply Fortran\mingw\bin\gcc.exe"
AR="C:\Users\User\Documents\programs_local\Simply Fortran\mingw\bin\ar.exe"

TOUCH="C:\Users\User\Documents\programs_local\Simply Fortran\fwin\wtouch.exe"
RM=del
IDIR=-I"C:/Users/User/Documents/programs_local/Simply Fortran/mingw/include/"
LDIR=-L"C:/Users/User/Documents/programs_local/Simply Fortran/mingw/lib/" -LC:/Users/User/Documents/lib
SPECIALFLAGS=$(IDIR)
PRJ_FFLAGS=
PRJ_CFLAGS=
PRJ_LFLAGS=-lstress -lfutil -lcutil -lsimulator_lib


the libraries are in the folder and called libstress.a etc.


The final build statement in the Makefile is

Simulator4.exe:  build\adddec.o ...    $(FC) -o Simulator4.exe -static build\adddec.o ... $(LDIR) $(PRJ_LFLAGS)

(... indicates the whole set of object files that have been compiled).

However, when I try to build I get a whole lot of unresolved reference errors before it gives up the ghost printing garbage.

build\lsu0cfe(+fse(ol0st0:r0
e:x.o:.f nre:tdo_dedo(bbri)liewoe xcrdf.tbien(uebrsnd+0ec2rfeo .:efi
ec`d.lseetoine.oc.ce  7a'et2atle.et
+lic0
n.
fllm  .edt'e:0oei0s
u(
t
nc eintogile.e ra:v soe0.\ef
epcutnt\e+teteroreentl x
tdteotoeeSnt`v_fOldx ox preb d_db

I have tried with and without the -nounderscore option on the compiler but it makes no difference.

What am I doing wrong?

TIA

Re: Not picking up libraries

There could be a few things that could be causing the problem.  Do you recognize the undefined references as being routines that should be provided by your library?  If so, my first guess would be that the libraries themselves should be recompiled if possible.  The most likely culprit would be any libraries that are composed of Fortran code.  Additionally, a Fortran library that was built with the Intel compiler will expect to be linked with the Intel Fortran runtime, which will not be present when linking with Simply Fortran.

As far as the garbage output is concerned, I'm not sure why that is happening.  It might fix itself if the undefined references are cleared up.

Let me know if things improve.  I'll be happy to provide more assistance.

Jeff Armstrong
Approximatrix, LLC

Re: Not picking up libraries

Yes, all the unresolved externals are routines that should be found in the libraries.

All the code in the libraries is C or C++ apart from 1 routine in one of the libraries and if compiler incompatibilty was going to be a problem I was going to tackle that later.

The libraries as they stand have been compiled using the Intel C compiler but I thought that I would try to compile them using the SF gcc compiler but...

Open Watcom Make Version 1.9
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
    "C:\Users\User\Documents\programs_local\Simply Fortran\mingw\bin\gcc.exe" -c -o build\Cutil.o -I"C:/Users/User/Documents/programs_local/Simply Fortran/mingw/include/" -IC:/Users/User/Documents/oslo_vision_visual10/Include  .\Cutil.cpp
gcc.exe: error: CreateProcess: No such file or directory
Error(E42): Last command making (build\Cutil.o) returned a bad status
Error(E02): Make execution terminated
* Complete *

I don't know why it is looking for CreateProcess as it is not called from this code.

I do use CreateProcess in other C++ code that I use so I do know it is available on my machine, it is a standard MS function anyway.

Re: Not picking up libraries

This error is occurring because Simply Fortran doesn't include the GNU C++ compiler.  What is actually happening is that gcc is calling out to g++, but the executable isn't found.  The "CreateProcess" error is because the executables associated with the C++ compiler are not present. 

There are a few options for fixing the issue.  If there was enough interest, the GNU C++ compiler could be included with Simply Fortran.  Another option would be a separate installer to "add" GNU C++ to a current Simply Fortran installation.  Finally, if you'd rather not wait, you can install the MinGW package from MinGW and modify the Simply Fortran compiler locations to point at the MinGW installation.

If you need more specific assistance, feel free to email support@approximatrix.com.  I'd also like to hear what other users think about including GNU C++.

Jeff Armstrong
Approximatrix, LLC

Re: Not picking up libraries

I have downloaded the MinGw libraries from the link above and changed SimplyFortran to point to its compilers but when I try to build the C code I get an error dialog box

cc1plus.exe - Application error

The application was unable to start correctly (0xc0000013)

Any ideas?
I am using Windows 7, is there a compatibility issue?

Re: Not picking up libraries

I'm not sure why there'd be an issue with the compiler.  Have you installed version 1.22 of Simply Fortran?  It now contains the GNU C++ compiler itself, and you shouldn't need a separate MinGW installation.  That said, you might still encounter the same issue with the version shipped with Simply Fortran.

Jeff Armstrong
Approximatrix, LLC

Re: Not picking up libraries

I was using 1.21 so I have upgraded to 1.22 and the same thing happens and also when I open the fortran based project I get the same error from f951.exe

Re: Not picking up libraries

After installation of version 1.22, did you reset the compiler paths within Simply Fortran?  This step can either be done manually, or, alternatively, you can select 'Restore Defaults...' from the Options menu to reset the compiler paths automatically.

If you did reset them and are still experiencing issues, can you check what your current system path is?  The directory containing the compilers should be on the path, and it sometimes fixes these type of problems if the compilers are not on the path. 

Let me know if either of these helps fix the issue.  If not, we'll have to think of some more ideas.

Jeff Armstrong
Approximatrix, LLC