gtk-fortran icon indicating copy to clipboard operation
gtk-fortran copied to clipboard

MSYS2: PLplot detected by CMake but compilation fails for PLplot examples

Open vmagnin opened this issue 2 years ago • 5 comments

Describe the bug CMake detects PLplot modules, but the compilation fails:

-- Checking for module 'plplot-fortran'
--   Found plplot-fortran, version 5.15.0
-- Checking for module 'plplot'
--   Found plplot, version 5.15.0
-- Configuring done
-- Generating done
-- Build files have been written to: C:/msys64/home/vmagnin/gtk-fortran/build
[ 90%] Generating plplot_extra.mod
[ 90%] Built target plplot_extra_module
Scanning dependencies of target hl_plplot8e
[ 90%] Building Fortran object plplot/CMakeFiles/hl_plplot8e.dir/hl_plplot8e.f90.obj
f951.exe: Warning: Nonexistent include directory 'C:/msys64/home/vmagnin/gtk-fortran/lib/fortran/modules/plplot' [-Wmissing-include-dirs]
C:/msys64/home/vmagnin/gtk-fortran/plplot/hl_plplot8e.f90:57:7:

   57 |   use plplot, PI => PL_PI
      |       1
Fatal Error: Cannot open module file 'plplot.mod' for reading at (1): No such file or directory
compilation terminated.
make[2]: *** [plplot/CMakeFiles/hl_plplot8e.dir/build.make:75: plplot/CMakeFiles/hl_plplot8e.dir/hl_plplot8e.f90.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1416: plplot/CMakeFiles/hl_plplot8e.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Your system:

  • OS version: Windows 10 21H2 and MSYS2-UCRT64
  • Compiler version: gfortran 12.2.0
  • GTK branch: gtk4

vmagnin avatar Oct 05 '22 06:10 vmagnin

With Ninja:

[210/228] Building Fortran object plplot/CMakeFiles/hl_plplot8e.dir/hl_plplot8e.f90.obj
FAILED: plplot/CMakeFiles/hl_plplot8e.dir/hl_plplot8e.f90.obj plplot/common_ex8.mod plplot/handlers_ex8.mod plplot/plplot_code_ex8.mod
C:\msys64\ucrt64\bin\gfortran.exe -IC:\msys64\home\vmagnin\temp\gtk-fortran\plplot -IC:/msys64/ucrt64/include/gtk-4.0 -IC:/msys64/ucrt64/include/pango-1.0 -
IC:/msys64/ucrt64/include -IC:/msys64/ucrt64/include/glib-2.0 -IC:/msys64/ucrt64/lib/glib-2.0/include -IC:/msys64/ucrt64/include/harfbuzz -IC:/msys64/ucrt64
/include/freetype2 -IC:/msys64/ucrt64/include/libpng16 -IC:/msys64/ucrt64/include/fribidi -IC:/msys64/ucrt64/include/cairo -IC:/msys64/ucrt64/include/lzo -I
C:/msys64/ucrt64/include/pixman-1 -IC:/msys64/ucrt64/include/gdk-pixbuf-2.0 -IC:/msys64/ucrt64/include/graphene-1.0 -IC:/msys64/ucrt64/lib/graphene-1.0/incl
ude -IC:/msys64/ucrt64/include/plplot -I/ucrt64/include/pango-1.0 -I/ucrt64/include/glib-2.0 -I/ucrt64/lib/glib-2.0/include -I/ucrt64/include/harfbuzz -I/uc
rt64/include/freetype2 -I/ucrt64/include/libpng16 -I/ucrt64/include/fribidi -I/ucrt64/include/cairo -I/ucrt64/include/lzo -I/ucrt64/include/pixman-1 -I/ucrt
64/include/QtCore -I/ucrt64/include/QtGui -I/ucrt64/include/QtPrintSupport -I/ucrt64/include/QtWidgets -I/ucrt64/include/QtSvg -I/ucrt64/lib/wx/include/msw-
unicode-3.0 -I/ucrt64/include/wx-3.0 -IC:/msys64/home/vmagnin/temp/gtk-fortran/lib/fortran/modules/plplot -IC:/msys64/home/vmagnin/temp/gtk-fortran/build/pl
plot -IC:/msys64/home/vmagnin/temp/gtk-fortran/build/src/modules -g -pthread -Wall -Wextra -pedantic -std=f2008 -Wtabs -fcheck=all -fbacktrace -Wno-unused-d
ummy-argument -Jplplot   -mfpmath=sse -msse -msse2 -mms-bitfields -fpreprocessed -c plplot/CMakeFiles/hl_plplot8e.dir/hl_plplot8e.f90-pp.f90 -o plplot/CMake
Files/hl_plplot8e.dir/hl_plplot8e.f90.obj

The problem probably comes from -IC:/msys64/home/vmagnin/temp/gtk-fortran/lib/fortran/modules/plplot It should be -IC:/msys64/ucrt64/lib/fortran/modules/plplot

$ ls /ucrt64/lib/fortran/modules/plplot
plfortrandemolib.mod  plplot_double.mod    plplot_private_exposed.mod    plplot_single.mod
plplot.mod            plplot_graphics.mod  plplot_private_utilities.mod  plplot_types.mod

vmagnin avatar Oct 05 '22 15:10 vmagnin

In plplot/CMakeLists.txt:

#===============================================================================
# Build PLplot examples:
#===============================================================================
if (NOT NO_BUILD_EXAMPLES)
  foreach(example hl_plplot8e hl_plplot17e hl_plplot17e_gto hl_plplot30e
          hl_plplot1e hl_plplot4e)
    add_executable(${example} "${example}.f90")
    add_dependencies(${example} plplot_extra_module)
    target_link_libraries(${example} gtk-fortran_static ${GTK_LIBRARIES}
                          ${PLPLOT-FORTRAN_LIBRARIES} ${PLPLOT_LIBRARIES})
    add_test(${example} ./${example})
  endforeach(example)
endif (NOT NO_BUILD_EXAMPLES)

vmagnin avatar Oct 05 '22 15:10 vmagnin

With the latest gtk-fortran and MSYS2, it fails with the following message:

[ 90%] Generating plplot_extra.mod
[ 90%] Built target plplot_extra_module
[ 90%] Building Fortran object plplot/CMakeFiles/hl_plplot8e.dir/hl_plplot8e.f90.obj
f951.exe: Warning: Nonexistent include directory 'D:/Logiciels/MSYS2/ucrt64/lib/wx/include/msw-unicode-3.2' [-Wmissing-include
-dirs]
f951.exe: Warning: Nonexistent include directory 'D:/Logiciels/MSYS2/ucrt64/include/wx-3.2' [-Wmissing-include-dirs]
D:/Logiciels/MSYS2/home/vmagnin/gtk-fortran/plplot/hl_plplot8e.f90:90:43:

   90 |        x(i) = dble(i-1-(xpts/2))/dble (xpts/2)
      |                                           1
Warning: Integer division truncated to constant '17' at (1) [-Winteger-division]
[ 91%] Linking Fortran executable hl_plplot8e.exe
D:/Logiciels/MSYS2/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwx
_baseu-3.2: No such file or directory
D:/Logiciels/MSYS2/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwx
_mswu_core-3.2: No such file or directory
D:/Logiciels/MSYS2/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwx
_baseu-3.2: No such file or directory
D:/Logiciels/MSYS2/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwx
_mswu_core-3.2: No such file or directory
collect2.exe: error: ld returned 1 exit status
make[2]: *** [plplot/CMakeFiles/hl_plplot8e.dir/build.make:98: plplot/hl_plplot8e.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:1416: plplot/CMakeFiles/hl_plplot8e.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

vmagnin avatar May 22 '24 11:05 vmagnin

The warnings and errors suggest that things relative to unicode in wxWidgets are missing.

  • https://packages.msys2.org/base/mingw-w64-wxwidgets3.2
  • https://packages.msys2.org/package/mingw-w64-clang-x86_64-wxwidgets3.2-common
  • https://packages.msys2.org/package/mingw-w64-clang-x86_64-wxwidgets3.2-msw

vmagnin avatar May 22 '24 14:05 vmagnin

I have finally fixed the problem: there was a conflict between the libraries wxwidgets3.0 and 3.2. I have reinstalled two 3.2 packages and removed a 3.0 package:

$ pacman -S mingw-w64-ucrt-x86_64-wxwidgets3.2-common
$  pacman -S mingw-w64-ucrt-x86_64-wxwidgets3.2-msw
$  pacman -Rs mingw-w64-ucrt-x86_64-wxwidgets3.0-msw-libs

vmagnin avatar May 22 '24 16:05 vmagnin