Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GHA: Add MSYS2 build #4

Merged
merged 3 commits into from
Jun 12, 2022
Merged

GHA: Add MSYS2 build #4

merged 3 commits into from
Jun 12, 2022

Conversation

zmughal
Copy link
Contributor

@zmughal zmughal commented Oct 24, 2021

This PR is on top of the commits of
#2 and
#3.

This PR also requires

  • disabling some of the routines in sys/ and some of the drivers in
    drivers/ because of required headers that are not available under MinGW:
    • require termios.h: sys/grgetc.c, sys/grtermio.c,
      drivers/ttdriv.f, drivers/vtdriv.f
    • require sys/socket.h: drivers/nexsup.c, drivers/nedriv.f
  • setting FC to gfortran because f77 is not available (on Linux f77 is
    a symlink to gfortran)
    • FC = f77 means fonts/pgpack can not build
    • this can be worked around by setting FC to the contents of F77 (gfortran)

@djerius
Copy link
Owner

djerius commented Jun 10, 2022

I've created a new branch based off of this one which conditionally compiles the stubbed out drivers if the system provides the capabilities. Seems to have worked

@zmughal
Copy link
Contributor Author

zmughal commented Jun 12, 2022

OK, I'm going to merge and squash that commit into this PR.

@zmughal zmughal force-pushed the msys2-build branch 2 times, most recently from 88fc0ba to 09856dd Compare June 12, 2022 01:13
@djerius
Copy link
Owner

djerius commented Jun 12, 2022

The build error seems to be due to autoconf setting EXEEXT = .exe which is causing make to use a built-in recipe for compiling Fortran programs without linking.

On MSYS (and on Linux if I copy over the Makefile) with the above setting for EXEEXT,

make -n
f77 -g -O2   pgpack.f   -o pgpack
rm -f grfont.dat
./pgpack < ./grfont.txt
make  all-am

If make was using the build recipes in the Makefile, it would use the F77COMPILE make macro, which resolves to gfortran -std=legacy -g -O2

Setting EXEEXT = gives the expected result.

make -n
gfortran -std=legacy -g -O2 -c -o pgpack.o pgpack.f
rm -f pgpack
/bin/sh ../libtool  --tag=F77   --mode=link gfortran -std=legacy -g -O2   -o pgpack pgpack.o  -lm  -LD:/a/_temp/msys64/mingw64/lib -lpng16 -lz 

From the autoconf manual

All the tests for compilers ('AC_PROG_CC', 'AC_PROG_CXX', 'AC_PROG_F77')
define the output variable 'EXEEXT' based on the output of the compiler,
typically to the empty string if Posix and '.exe' if a DOS variant.

I don't know much about MSYS, but I'm guessing that it doesn't need the .exe to indicate that it's an executable, but autoconf doesn't know that.

@djerius
Copy link
Owner

djerius commented Jun 12, 2022

I don't know much about MSYS, but I'm guessing that it doesn't need the .exe to indicate that it's an executable, but autoconf doesn't know that.

Or, it could be due to one of the mst_* autoconf macros that I'm responsible for.

@djerius
Copy link
Owner

djerius commented Jun 12, 2022

I see you found the bug as well. Please rebase against main, as I fixed an autoconf macro.

@zmughal
Copy link
Contributor Author

zmughal commented Jun 12, 2022

Found it thanks to your debugging in the comments above! Rebasing now. :-)

zmughal and others added 2 commits June 12, 2022 17:40
@zmughal zmughal marked this pull request as ready for review June 12, 2022 21:41
@zmughal
Copy link
Contributor Author

zmughal commented Jun 12, 2022

CI passes. Should be ready to review now.

@djerius djerius merged commit 75abca2 into djerius:main Jun 12, 2022
@zmughal zmughal deleted the msys2-build branch June 12, 2022 22:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants