Topic: Building library

Hi jeff,
I want to build a library containig source for special tasks.
After compiling three files generating of the lib fails with the following message:
==============================================================================
Generating Makefile... Okay
==============================================================================
Compiling .\loadsetglobals.f90
Compiling .\menu_control_struc_concept.f90
Compiling .\NavigateStructureConcept.f90
Generating fortran-library.a
C:\Program Files (x86)\Simply Fortran 2\mingw-w64\bin\ar.exe: two different operation options specified
Error(E42): Last command making (fortran-library.a) returned a bad status
Error(E02): Make execution terminated

* Failed *

I am using default options for that project only.
I am not experianced with compiler and builder options. Could you explain wat to do with the different "operation options"?
Thanks, Klaus

Re: Building library

Klaus,

Could you post the contents of your Makefile here?  I suspect some option is being set incorrectly by Simply Fortran.

Jeff Armstrong
Approximatrix, LLC

Re: Building library

Hi Jeff,
Hereby the requested contents of the Makefile:

FFLAGS=$(SPECIALFLAGS) $(OPTFLAGS) $(PRJ_FFLAGS) -J../modules

CFLAGS=$(SPECIALFLAGS) $(OPTFLAGS) $(PRJ_CFLAGS)

"E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o": ".\loadsetglobals.f90"
    @echo Compiling .\loadsetglobals.f90
    @$(FC) -c -o "E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o" $(FFLAGS) ".\loadsetglobals.f90"
"..\modules\loadsetglobals.mod" "..\modules\scantlings_vars.mod" : "E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o" .EXISTSONLY
    @echo Compiling .\loadsetglobals.f90
    @$(FC) -c -o "E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o" $(FFLAGS) ".\loadsetglobals.f90"

"E:\ASC_prog_files\CASTOR12\StructureConcept\menu_control_struc_concept.o": ".\menu_control_struc_concept.f90"
    @echo Compiling .\menu_control_struc_concept.f90
    @$(FC) -c -o "E:\ASC_prog_files\CASTOR12\StructureConcept\menu_control_struc_concept.o" $(FFLAGS) ".\menu_control_struc_concept.f90"

"E:\ASC_prog_files\CASTOR12\StructureConcept\NavigateStructureConcept.o": ".\NavigateStructureConcept.f90" "..\modules\loadsetglobals.mod"
    @echo Compiling .\NavigateStructureConcept.f90
    @$(FC) -c -o "E:\ASC_prog_files\CASTOR12\StructureConcept\NavigateStructureConcept.o" $(FFLAGS) ".\NavigateStructureConcept.f90"

clean: .SYMBOLIC
    @echo Deleting E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o and related files
    @$(RM) "E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o" "..\modules\loadsetglobals.mod" "..\modules\scantlings_vars.mod"
    @echo Deleting E:\ASC_prog_files\CASTOR12\StructureConcept\menu_control_struc_concept.o and related files
    @$(RM) "E:\ASC_prog_files\CASTOR12\StructureConcept\menu_control_struc_concept.o"
    @echo Deleting E:\ASC_prog_files\CASTOR12\StructureConcept\NavigateStructureConcept.o and related files
    @$(RM) "E:\ASC_prog_files\CASTOR12\StructureConcept\NavigateStructureConcept.o"
    @echo Deleting fortran-library.a
    @$(RM) "fortran-library.a"

"fortran-library.a":  "E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o" "E:\ASC_prog_files\CASTOR12\StructureConcept\menu_control_struc_concept.o" "E:\ASC_prog_files\CASTOR12\StructureConcept\NavigateStructureConcept.o" "E:\ASC_prog_files\CASTOR12\StructureConcept\structure concept.prj.target"
    @echo Generating fortran-library.a
    @$(AR) rcs "fortran-library.a" "E:\ASC_prog_files\CASTOR12\StructureConcept\loadsetglobals.o" "E:\ASC_prog_files\CASTOR12\StructureConcept\menu_control_struc_concept.o" "E:\ASC_prog_files\CASTOR12\StructureConcept\NavigateStructureConcept.o" $(PRJ_LFLAGS)

all: "fortran-library.a" .SYMBOLIC

Don't hurry with reply; I am a couple of day's off.
Regards, Klaus

Re: Building library

Klaus,

I think this makefile is not complete.  Did you neglect to include some earlier information such as where PRJ_LFLAGS would be defined?

I suspect it may have something to do with $(PRJ_LFLAGS) being included in the AR command.  I've actually just disabled that flag for the next release of Simply Fortran if you're building a static library.  Usually that variable should contain linker flags, but static libraries are not "linked" until the calling executable is compiled.  Any flags will most likely just confuse AR.

Do you have anything set in the Linker box in Project Options under the Compiler Flags tab for this static library project?  If so, delete anything in that box.  It will almost certainly confuse AR.

Jeff Armstrong
Approximatrix, LLC

Re: Building library

Jeff,
After downloading version 2.25 of Simply Fortran the lib is created without any remark. I suppose that the library has to be renamed later for use in the main program due to build more libraries?
Regards, Klaus

Re: Building library

Klaus,

That's good to hear.  I would suggest changing the "Target Name" for each library so that you don't end up having to rename them in Windows Explorer or something similar.

Jeff Armstrong
Approximatrix, LLC