Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Disable sigsetjmp for default compilation #196

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

marshallward
Copy link
Member

The sigsetjmp function is part of the POSIX, but is not required to be
defined as a symbol, and may be implemented as a macro. Since Fortran
C bindings require a symbol, we cannot bind to macro implementations.

The prior implementation assumed a Linux glibc binding of __sigsetjmp
(accessed by a sigsetjmp macro), but this did not work on BSD and
MacOS builds, which have a dedicated sigsetjmp symbol.

Although the autoconf build included a macro to test and assign the
symbol to SIGSETJMP_NAME, this did not resolve builds based on mkmf or
similar build systems, and would fail to compile.

To resolve this, the SIGSETJMP_NAME points to a placeholder function,
sigsetjmp_missing which permits compilation but raises an error if
called.

Since this function is only used in our unit testing, and even then only
for tests which would otherwise raise FATAL, this change will not
disrupt any simulations.

It does mean that only "power" users who build with either
autoconf or -DSIGSETJMP_NAME=\"...\" will be able to run the unit
tests. In practice, it should be sufficient to direct users to the
autoconf builds, and no actual disruptions are expected.

@codecov
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #196 (ba9e7f1) into dev/gfdl (a490004) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##           dev/gfdl     #196      +/-   ##
============================================
- Coverage     37.13%   37.13%   -0.01%     
============================================
  Files           262      262              
  Lines         72662    72666       +4     
  Branches      13586    13586              
============================================
  Hits          26985    26985              
- Misses        40672    40676       +4     
  Partials       5005     5005              
Impacted Files Coverage Δ
src/framework/posix.F90 50.00% <0.00%> (-5.27%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

The sigsetjmp function is part of the POSIX, but is not required to be
defined as a symbol, and may be implemented as a macro.  Since Fortran
C bindings require a symbol, we cannot bind to macro implementations.

The prior implementation assumed a Linux glibc binding of __sigsetjmp
(accessed by a `sigsetjmp` macro), but this did not work on BSD and
MacOS builds, which have a dedicated `sigsetjmp` symbol.

Although the autoconf build included a macro to test and assign the
symbol to `SIGSETJMP_NAME`, this did not resolve builds based on mkmf or
similar build systems, and would fail to compile.

To resolve this, the SIGSETJMP_NAME points to a placeholder function,
`sigsetjmp_missing` which permits compilation but raises an error if
called.

Since this function is only used in our unit testing, and even then only
for tests which would otherwise raise FATAL, this change will not
disrupt any simulations.

However, it does mean that only "power" users who build with either
autoconf or `-DSIGSETJMP_NAME=\"...\"` will be able to run the unit
tests.  In practice, it should be sufficient to direct users to the
autoconf builds, and no actual disruptions are expected.
@Hallberg-NOAA
Copy link
Member

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/16705.

@Hallberg-NOAA Hallberg-NOAA merged commit 03bc321 into NOAA-GFDL:dev/gfdl Sep 8, 2022
@marshallward marshallward deleted the sigsetjmp_default branch April 21, 2023 15:22
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.

3 participants