sohailreddy / WindFLO

Wind Farm Layout Optimization (WindFLO)
Apache License 2.0
16 stars 7 forks source link

Compilation issues on Linux #2

Open hcOnel opened 10 months ago

hcOnel commented 10 months ago

Hi, As instructed, I modify the compilers in the Makefile as the following:

FCOMPILER = gfortran-11
CCOMPILER = g++-11
LGFORTRAN = #-L/usr/lib/gcc/x86_64-linux-gnu/11/ -I/usr/lib/gcc/x86_64-linux-gnu/11/

and run make as:

make OS=LINUX

I get the following output with errors:

make COMPILE;
make[1]: Entering directory '/home/hconel/WindFLO/src'
gfortran-11 -x f95-cpp-input -g -fcheck=all -fbacktrace -fdec-math -fPIC  -lstdc++ -c WindFLO_f.f90
WindFLO_f.f90:140:14:

  140 |                                 nTurbines, batch,                                                               &
      |                                          1
Error: Symbol ‘nturbines’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:140:21:

  140 |                                 nTurbines, batch,                                                               &
      |                                                 1
Error: Symbol ‘batch’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:141:8:

  141 |                                 rho, turbulenceIntensity,                                               &
      |                                    1
Error: Symbol ‘rho’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:141:29:

  141 |                                 rho, turbulenceIntensity,                                               &
      |                                                         1
Error: Symbol ‘turbulenceintensity’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:142:14:

  142 |                                 windModel, modelVelocity,                                               &
      |                                          1
Error: Symbol ‘windmodel’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:142:29:

  142 |                                 windModel, modelVelocity,                                               &
      |                                                         1
Error: Symbol ‘modelvelocity’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:143:21:

  143 |                                 surfaceRoughness, referenceHeight,                              &
      |                                                 1
Error: Symbol ‘surfaceroughness’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:143:38:

  143 |                                 surfaceRoughness, referenceHeight,                              &
      |                                                                  1
Error: Symbol ‘referenceheight’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:144:14:

  144 |                                 wakeModel, wakeMergeModel, wakeExpansionCoeff,  &
      |                                          1
Error: Symbol ‘wakemodel’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:144:30:

  144 |                                 wakeModel, wakeMergeModel, wakeExpansionCoeff,  &
      |                                                          1
Error: Symbol ‘wakemergemodel’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:144:50:

  144 |                                 wakeModel, wakeMergeModel, wakeExpansionCoeff,  &
      |                                                                              1
Error: Symbol ‘wakeexpansioncoeff’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:145:15:

  145 |                                 gaussOrder, monteCarloPts,                                              &
      |                                           1
Error: Symbol ‘gaussorder’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:145:30:

  145 |                                 gaussOrder, monteCarloPts,                                              &
      |                                                          1
Error: Symbol ‘montecarlopts’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:146:17:

  146 |                                 turbineFiles,                                                                   &
      |                                             1
Error: Symbol ‘turbinefiles’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:147:8:

  147 |                                 coe,                                                                                    &
      |                                    1
Error: Symbol ‘coe’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:149:17:

  149 |                                 terrainModel, terrainFile, windRoseFile,                                        &
      |                                             1
Error: Symbol ‘terrainmodel’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:149:30:

  149 |                                 terrainModel, terrainFile, windRoseFile,                                        &
      |                                                          1
Error: Symbol ‘terrainfile’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:149:44:

  149 |                                 terrainModel, terrainFile, windRoseFile,                                        &
      |                                                                        1
Error: Symbol ‘windrosefile’ in namelist ‘windflo_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:246:14:

  246 |                         turbineNum,     name, fictitious,               &
      |                                   1
Error: Symbol ‘turbinenum’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:246:20:

  246 |                         turbineNum,     name, fictitious,               &
      |                                             1
Error: Symbol ‘name’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:246:32:

  246 |                         turbineNum,     name, fictitious,               &
      |                                                         1
Error: Symbol ‘fictitious’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:247:12:

  247 |                         position, height, diameter, radius,     &
      |                                 1
Error: Symbol ‘position’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:247:20:

  247 |                         position, height, diameter, radius,     &
      |                                         1
Error: Symbol ‘height’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:247:30:

  247 |                         position, height, diameter, radius,     &
      |                                                   1
Error: Symbol ‘diameter’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:247:38:

  247 |                         position, height, diameter, radius,     &
      |                                                           1
Error: Symbol ‘radius’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:248:15:

  248 |                         orientation, yaw, ratedPower,           &
      |                                    1
Error: Symbol ‘orientation’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:248:20:

  248 |                         orientation, yaw, ratedPower,           &
      |                                         1
Error: Symbol ‘yaw’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:248:32:

  248 |                         orientation, yaw, ratedPower,           &
      |                                                     1
Error: Symbol ‘ratedpower’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:249:11:

  249 |                         CpCurve, CtCurve
      |                                1
Error: Symbol ‘cpcurve’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:249:19:

  249 |                         CpCurve, CtCurve
      |                                        1
Error: Symbol ‘ctcurve’ in namelist ‘turbine_data’ at (1) must be declared before the namelist is declared.
WindFLO_f.f90:563:8:

  563 |         bool = WindFLO_input%batch
      |               1
Warning: Extension: Conversion from LOGICAL(4) to INTEGER(4) at (1)
WindFLO_f.f90:523:8:

  523 |         bool = WindFLO_input%turbines(ith)%fictitious
      |               1
Warning: Extension: Conversion from LOGICAL(4) to INTEGER(4) at (1)
WindFLO_f.f90:531:8:

  531 |         bool = WindFLO_input%turbines(ith)%yaw
      |               1
Warning: Extension: Conversion from LOGICAL(4) to INTEGER(4) at (1)
make[1]: *** [Makefile:64: WindFLO_f.o] Error 1
make[1]: Leaving directory '/home/hconel/WindFLO/src'
make: *** [Makefile:52: BUILD] Error 2

Is this caused by the compiler version I'm using? Thanks in advance.

EtorArza commented 8 months ago

Hey @hcOnel, I was able to solve this issue by using a earlier version of the repo. In an earlier version, you compile after you cd to the release directory with the command make OS=LINUX MAIN=main.

hcOnel commented 8 months ago

@EtorArza thanks for your suggestion. By changing the definitions as follows:

FCOMPILER = gfortran-10
CCOMPILER = g++-10
LGFORTRAN = -L/usr/lib/gcc/x86_64-linux-gnu/10/ -I/usr/lib/gcc/x86_64-linux-gnu/10/

I've managed to advance up to CREATE_LIB. But now, I'm getting numerous multiple definition and first defined here messages. My make log is as follows (I've trimmed most of the definition messages to shorten it)

make COMPILE;
make[1]: Entering directory '/home/hconel/WindFLO/src'
make[1]: Nothing to be done for 'COMPILE'.
make[1]: Leaving directory '/home/hconel/WindFLO/src'
make LINKALL;
make[1]: Entering directory '/home/hconel/WindFLO/src'
g++-10 octree.o terrain.o WindFLO_f.o WindFLO.o wakeModels.o sobol.o ambientWindModels.o turbine.o costModels.o convexHull.o userDefined.o CubicSpline.o API.o main.o -L/usr/lib/gcc/x86_64-linux-gnu/10/ -I/usr/lib/gcc/x86_64-linux-gnu/10/ -g -lgfortran -o ../release/WindFLO
make[1]: Leaving directory '/home/hconel/WindFLO/src'
make CREATE_LIB;
make[1]: Entering directory '/home/hconel/WindFLO/src'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_muldi3.o): in function `__multi3':
(.text+0x0): multiple definition of `__multi3'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_muldi3.o):(.text+0x0): first defined here
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_negdi2.o): in function `__negti2':
(.text+0x0): multiple definition of `__negti2'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_negdi2.o):(.text+0x0): first defined here

...
...
...

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o): in function `__morestack_set_guard':
(.text+0x167): multiple definition of `__morestack_set_guard'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o):(.text+0x167): first defined here
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o): in function `__morestack_make_guard':
(.text+0x171): multiple definition of `__morestack_make_guard'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o):(.text+0x171): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:113: CREATE_LIB] Error 1
make[1]: Leaving directory '/home/hconel/WindFLO/src'
make: *** [Makefile:55: BUILD] Error 2

I still can't pinpoint the source of the problem

EtorArza commented 8 months ago

Yeah, I also get this error when compiling the current version in linux. I managed to make it work by using an earlier version.

On Wed, Feb 21, 2024, 23:10 Huseyin C. Onel @.***> wrote:

@EtorArza https://github.com/EtorArza thanks for your suggestion. By changing the definitions as follows:

FCOMPILER = gfortran-10 CCOMPILER = g++-10 LGFORTRAN = -L/usr/lib/gcc/x86_64-linux-gnu/10/ -I/usr/lib/gcc/x86_64-linux-gnu/10/

I've managed to advance up to CREATE_LIB. But now, I'm getting numerous multiple definition and first defined here messages. My make log is as follows (I've trimmed most of the definition messages to shorten it)

make COMPILE; make[1]: Entering directory '/home/hconel/WindFLO/src' make[1]: Nothing to be done for 'COMPILE'. make[1]: Leaving directory '/home/hconel/WindFLO/src' make LINKALL; make[1]: Entering directory '/home/hconel/WindFLO/src' g++-10 octree.o terrain.o WindFLO_f.o WindFLO.o wakeModels.o sobol.o ambientWindModels.o turbine.o costModels.o convexHull.o userDefined.o CubicSpline.o API.o main.o -L/usr/lib/gcc/x86_64-linux-gnu/10/ -I/usr/lib/gcc/x86_64-linux-gnu/10/ -g -lgfortran -o ../release/WindFLO make[1]: Leaving directory '/home/hconel/WindFLO/src' make CREATE_LIB; make[1]: Entering directory '/home/hconel/WindFLO/src' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_muldi3.o): in function __multi3': (.text+0x0): multiple definition ofmulti3'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_muldi3.o):(.text+0x0): first defined here /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_negdi2.o): in function `negti2': (.text+0x0): multiple definition of `__negti2'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(_negdi2.o):(.text+0x0): first defined here

... ... ...

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o): in function __morestack_set_guard': (.text+0x167): multiple definition ofmorestack_set_guard'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o):(.text+0x167): first defined here /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o): in function `morestack_make_guard': (.text+0x171): multiple definition of `__morestack_make_guard'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(morestack.o):(.text+0x171): first defined here collect2: error: ld returned 1 exit status make[1]: [Makefile:113: CREATE_LIB] Error 1 make[1]: Leaving directory '/home/hconel/WindFLO/src' make: [Makefile:55: BUILD] Error 2

I still can't pinpoint the source of the problem

— Reply to this email directly, view it on GitHub https://github.com/sohailreddy/WindFLO/issues/2#issuecomment-1958097971, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKWFANNVOYH2QKHNOICNICTYUZWHDAVCNFSM6AAAAABA6OSCUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJYGA4TOOJXGE . You are receiving this because you were mentioned.Message ID: @.***>

hcOnel commented 8 months ago

The only release I see is this one: https://github.com/sohailreddy/WindFLO/releases/tag/v1.0.0 Is the version you've mentioned older? Can you share it?

EtorArza commented 8 months ago

I think the version in the other branch should work: https://github.com/sohailreddy/WindFLO/tree/WindFLO-v2.0.0

it has the release folder I mentioned and compiles with make OS=LINUX MAIN=main once you cd release. Let me know if it works. To be specific, I am using the version in https://github.com/JudithEtxebarrieta/OPTECOT/tree/main/WindFLO but I think we took the code from the branch https://github.com/sohailreddy/WindFLO/tree/WindFLO-v2.0.0.

sohailreddy commented 8 months ago

Apparently there were some issues with using gcc10 ++ I pushed a fix and tested with gcc10, 11 and 13 Can you try the latest master (with gcc11) and let me know if you are able to compile it.

hcOnel commented 7 months ago

I've downloaded the latest master branch and tried compiling it with g++-10 and g++-11. I get the same multiple definition warnings and the error as before:

With g++-10:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(generic-morestack.o): in function `__morestack_fail':
(.text+0x0): multiple definition of `__morestack_fail'; /usr/lib/gcc/x86_64-linux-gnu/10/libgcc.a(generic-morestack.o):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:110: CREATE_LIB] Error 1
make: *** [Makefile:52: BUILD] Error 2

With g++-11:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a(generic-morestack.o): in function `__morestack_fail':
(.text+0x0): multiple definition of `__morestack_fail'; /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a(generic-morestack.o):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:110: CREATE_LIB] Error 1
make: *** [Makefile:52: BUILD] Error 2

(you said gcc but I guess you meant g++?)

I'm on Ubuntu 22.04 and the complete make log is attached: log.make.txt Can you please suggest a specific Makefile configuration? I can't pinpoint my mistake.

hcOnel commented 7 months ago

Note: I've tried compiling with an older version of GCC (gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0) on Ubuntu 18.04 and got this message after "first defined here" messages:

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS): relocation R_X86_64_PC32 against undefined hidden symbol `__init_array_start' can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:108: recipe for target 'CREATE_LIB' failed
make[1]: *** [CREATE_LIB] Error 1
make[1]: Leaving directory '/home/hconel/WindFLO-test/src'
Makefile:49: recipe for target 'BUILD' failed
make: *** [BUILD] Error 2