Skip to content

Conversation

@dfm
Copy link
Owner

@dfm dfm commented Sep 5, 2022

Closes #186

Things to remember to do:

@dfm dfm marked this pull request as draft September 5, 2022 22:46
@bd-j
Copy link
Collaborator

bd-j commented Sep 5, 2022

Is it worth doing 0.4.2 release before this build system change? There are a few small tweaks to fsps/py-fsps I wanted to include before doing a release but I think they are about ready. But maybe the build system changes all be more or less transparent.

@dfm
Copy link
Owner Author

dfm commented Sep 5, 2022

@bd-j — I think that doing a release first is an excellent idea. This might take me a while to get working anyways!

@dfm
Copy link
Owner Author

dfm commented Sep 7, 2022

Now the tests are failing with a segfault in compute_csp. I can reproduce locally, but I have no idea what's causing it, so I'm going to need to leave it here for now.

@dfm dfm changed the title Starting to implement meson build Implementing meson build Sep 20, 2022
@dfm dfm marked this pull request as ready for review September 20, 2022 14:11
@dfm dfm requested a review from bd-j September 20, 2022 14:11
@dfm
Copy link
Owner Author

dfm commented Sep 20, 2022

This may magically finally be working now!

@bd-j — My plan is to squash and merge this PR and then make a pre-release so that we can more easily test the wheels, etc. What do you think of all this?

@dfm
Copy link
Owner Author

dfm commented Sep 20, 2022

OK maybe I spoke too soon. We're getting some (as far as I can tell, non-deterministic) build failures on CI with the error:

../../meson.build:1:0: ERROR: Compiler gfortran can not compile programs.
Full log
      /usr/bin/ld: cannot find -lm
      collect2: error: ld returned 1 exit status
      The Meson build system
      Version: 0.63.2
      Source dir: /home/runner/work/python-fsps/python-fsps
      Build dir: /home/runner/work/python-fsps/python-fsps/.mesonpy-kwgh563g/build
      Build type: native build
      Project name: fsps
      Project version: 0.4.2.dev22+g6e147b6
      
      ../../meson.build:1:0: ERROR: Compiler gfortran can not compile programs.

It seems like re-running exactly the same workflow often fixes this error, and I'm not clear on how to debug the issue here.

Edit: I can confirm that when I re-ran the exact same workflow for the same commit, it runs just fine... very confused!

(Perhaps @eli-schwartz has tips? No worries if it's not straightforward!)

@eli-schwartz
Copy link

It seems like re-running exactly the same workflow often fixes this error, and I'm not clear on how to debug the issue here.

(Perhaps @eli-schwartz has tips? No worries if it's not straightforward!)

This tries to compile a basic program (specifically, program main; print *, "Fortran compilation is working."; end program) using a command line that is effectively gfortran builddir/meson-private/sanitycheckf.f90 -o builddir/meson-private/sanitycheckf and then somehow that errors out with:

/usr/bin/ld: cannot find -lm
collect2: error: ld returned 1 exit status

Which TBH is a pretty odd error to get. How is libm not available?

@dfm
Copy link
Owner Author

dfm commented Sep 20, 2022

@eli-schwartz — Thanks for the summary - that's very strange!! I don't have any great ideas for what's going on, but I'll come back to it soon and see what I can dig up...

@eli-schwartz
Copy link

Weirdly, Meson's debug log is less thorough about logging the inner guts of that compiler check than it is for C-like languages... currently poking around to try to consolidate it, but that code line really is the gist of it minus some specificity around injecting $FFLAGS and suchlike into the test compile command.

@eli-schwartz
Copy link

Update: I've implemented a better log for this in Meson: mesonbuild/meson#10835

After that PR, you would be able to do pip install . --config-settings=builddir=$PWD/builddir, and pip would not delete your custom build directory that isn't in its tempdir. So you could actually print the logs from that directory and see something like:

Sanity testing Fortran compiler: gfortran
Is cross compiler: False.
Sanity check compiler command line: gfortran sanitycheckf.f90 -o sanitycheckf.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  /home/eschwartz/git/meson/t/builddir/meson-private/sanitycheckf.exe
Fortran compiler for the host machine: gfortran (gcc 11.1.0 "GNU Fortran (GCC) 11.1.0")

@bd-j
Copy link
Collaborator

bd-j commented Sep 24, 2022

This looks great! Sorry I completely missed this was ready when working on updating fsps 🤦. Shall we do a 4.2 release with what's on main now, and then merge this?

@eli-schwartz
Copy link

eli-schwartz commented Sep 25, 2022

Oh by the way, status update: I merged the relevant change into meson, although to test it you'd need to install Meson from git master. python -m build -nx / pip install --no-build-isolation can actually allow you to use it without forcibly installing an older version into a venv.

@dfm
Copy link
Owner Author

dfm commented Sep 26, 2022

@bd-j — I've done a 0.4.2 release with the current setup and the wheels seem to be all good. I'll fix the conflicts and get this merged and we can go from there!

@eli-schwartz — Thanks for all the updates and tips. I'll give the GitHub version a shot if/when we hit this build issue again!

getting versioning to work

do we gotta chdir\?

pointing back at upstream repo

testing meson build

install setuptools_scm

temporarily disabling release builds

show me some logs

oldest supported numpy

adding support for older numpy

try different windows setup

static library

macos gfortran

optional link args

try via python

fixing segfaults perhaps

specify nox session

trying to get things to compile on windows

typos

link language

gst

Updating FSPS

updating workflows

updateing release workflow

correcting cibuildwheel config

typos for days

opt; windows

attributes

export ignore

skip all

dist script

dist

dist

sdist

getting sdist to work

fortran top level

updated wheels build

tryin some things

sps_home for cibw

guess we need the setup python?

consistent test commands

updating compilers on linux
@dfm dfm merged commit d689181 into main Sep 26, 2022
@dfm dfm deleted the meson branch September 26, 2022 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle deprecation of numpy.distutils

4 participants