jxjo / Xoptfoil-JX

Xoptfoil-JX - modified version
GNU General Public License v3.0
14 stars 5 forks source link

Linux build error V1.5.0 #20

Closed joyo44 closed 4 years ago

joyo44 commented 4 years ago

Hi Jochen, I tried to build the new Release and got following error:

/usr/bin/gfortran -DPACKAGE_VERSION=\"\" -O3 -cpp -DUNIX=1 -c /home/john/Home_T420/XoptFoil/Xoptfoil-v1.50.0-JX/src/fortran/os_util.f90 -o CMakeFiles/MYOBJLIB.dir/src/fortran/os_util.f90.obj /home/john/Home_T420/XoptFoil/Xoptfoil-v1.50.0-JX/src/fortran/os_util.f90:178:10:

 case (COLOR_BAD)
      1

/home/john/Home_T420/XoptFoil/Xoptfoil-v1.50.0-JX/src/fortran/os_util.f90:182:10:

 case (COLOR_ERROR)
      2

Error: CASE label at (1) overlaps with CASE label at (2)

It looks like COLOR_BAD and COLOR_ERROR have the same signature:

integer, parameter, public :: COLOR_ERROR = iany([COLOR_RED, COLOR_INTENS]) integer, parameter, public :: COLOR_BAD = iany([COLOR_RED, COLOR_INTENS])

may be the compiler didn't like that?

I had another issue with the build-scripts. Setting TARGET_OS=UNIX didn't work for me. In build_linux.sh I passed the CMAKE_SYSTEM_NAME with TARGET_OS:

cmake \ -DCMAKE_INSTALL_PREFIX:PATH="$INSTALLDIR" \ -DCMAKE_BUILD_TYPE:STRING="Release" \ -DCMAKE_SYSTEM_NAME="$TARGET_OS" \ ..

and in CmakeLists.txt I changed the if-statement to

if(CMAKE_SYSTEM_NAME MATCHES "UNIX")

That works for me.

Could you check that for Windows.

Regards,

John

jxjo commented 4 years ago

Hello John - uff - Linux rescue is near! ;-)

Jochen

joyo44 commented 4 years ago

Hello Jochen,

yes, the "normal" way is to export the shell variable - didn't work, got always WIN32 for OS. I think CMake has it's own cache environment so you have to pass the variable to CMake, but I'm not familiar with CMake (I create old school makefiles by hand).

John

jxjo commented 4 years ago

Hi John, ... the COLOR issue is now fixed.

CMake is still strange as it works fine under Windows and documentation tells nothing special for LINUX. Mmh -did you delete the build directory before the build (caching problem)?

Thanks and regards

Jochen

joyo44 commented 4 years ago

Hi Jochen,

I have found a solution which works - and now shows also the version number on the sreen, which I missed.

here is my "build_linux" script:

!/bin/bash

BUILDDIR=build INSTALLDIR=$(pwd)/linux XOPTFOIL_VERSION=1.5.0beta TARGET_OS=UNIX

export XOPTFOIL_VERSION export TARGET_OS

if [ -d "$BUILDDIR" ]; then rm -Rf $BUILDDIR; fi if [ -d "$INSTALLDIR" ]; then rm -Rf $INSTALLDIR; fi

mkdir build cd build

cmake \ -DCMAKE_INSTALL_PREFIX:PATH="$INSTALLDIR" \ -DCMAKE_BUILD_TYPE:STRING="Release" \ .. make VERBOSE=1 || exit 1 make install || exit 1

cd ..

and the top lines in the "CMakeLists"

set(CMAKE_SYSTEM_NAME $ENV{TARGET_OS})

if(CMAKE_SYSTEM_NAME MATCHES "UNIX") set (OS_FLAG "-DUNIX=1")
message (STATUS "\n \n Building XFoptfoil-JX Version $ENV{XOPTFOIL_VERSION} for UNIX\n\n") else (CMAKE_SYSTEM_NAME MATCHES "WIN") set (OS_FLAG "-DWIN32=1") message (STATUS "\n \n Building XFoptfoil-JX Version $ENV{XOPTFOIL_VERSION} for Windows\n\n") endif (CMAKE_SYSTEM_NAME MATCHES "UNIX")

Hope this helps.

Regards,

John

jxjo commented 4 years ago

thanks John! (I added some "\" at the cmake command in build_linux. Hope this is correct)