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

configure: use correct CFLAGS and LDFLAGS variables #780

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

mkrupcale
Copy link
Contributor

The CFLAGS and LDFLAGS variables were used opposite of their intended usage for the udunits2 and netcdf external dependencies, so correct them.

  • configure: regenerate from...
  • configure.ac: use correct CFLAGS and LDFLAGS variables

The CFLAGS and LDFLAGS variables were used opposite of their intended usage for
the udunits2 and netcdf external dependencies, so correct them.

 * configure: regenerate from...
 * configure.ac: use correct CFLAGS and LDFLAGS variables
@durack1
Copy link
Contributor

durack1 commented Mar 9, 2025

@mkrupcale thanks for this PR. Did you have some docs to point to which supports this flag correction?

It would also be really useful as background to understand where these settings caused issues, so that we could capture such a problem with a test moving forward

@mkrupcale
Copy link
Contributor Author

@mkrupcale thanks for this PR. Did you have some docs to point to which supports this flag correction?

I think it's fairly standard that linker flags go in LDFLAGS, while C compiler flags go in CFLAGS [1], whereas for the udunits2 and netcdf dependencies these were reversed. The other dependencies were using the correct ordering. Although, LIBS is probably the correct place for -l arguments in particular, but this PR is closer to correct than previously.

It would also be really useful as background to understand where these settings caused issues, so that we could capture such a problem with a test moving forward

The reversal of compiler and linker flag variables could cause issues in the Makefile, although I didn't necessarily observe an issue directly because some linker flags can appear in compiler flag contexts and vice versa and may just be ignored in those contexts. I mainly just observed that the configure script output was reporting variables opposite of what I expected.

[1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Preset-Output-Variables.html

@durack1
Copy link
Contributor

durack1 commented Mar 10, 2025

@mkrupcale did you test your changes in a build - looks like the change has broken our CI builds, see below

@mkrupcale
Copy link
Contributor Author

@mkrupcale did you test your changes in a build

Yes, these changes work fine for me on Fedora Linux. Speaking of which, I'm working on packaging cmor for Fedora, so I will likely have additional patches coming.

looks like the change has broken our CI builds, see below

I don't think this change broke the CI. The CI is failing to checkout my git branch, presumably because it's not in the main repo [1]:

Cloning into bare repository '/Users/runner/work/cmor/cmor/workdir/macos_arm64/miniforge3/envs/smithy_env/conda-bld/git_cache/github.com/PCMDI/cmor.git'...
Could not scan for Git LFS tree: error in `git ls-tree`: exit status 128 fatal: Not a valid object name udunits2-netcdf-flags

Cloning into '/Users/runner/work/cmor/cmor/workdir/macos_arm64/miniforge3/envs/smithy_env/conda-bld/cmor_1741629654700/work'...
done.
error: pathspec 'udunits2-netcdf-flags' did not match any file(s) known to git
Traceback (most recent call last):
...
RuntimeError: Failed to download or patch source. Please see build log for info.
...
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
checkout: 'udunits2-netcdf-flags'
Warning: failed to download source.  If building, will try again after downloading recipe dependencies.
Error was: 
Command '['/Users/runner/work/cmor/cmor/workdir/macos_arm64/miniforge3/envs/smithy_env/bin/git', 'checkout', 'udunits2-netcdf-flags']' returned non-zero exit status 1.

If you give me repo access, I can push a branch to the main repo, which should fix the CI job.

[1] https://github.com/PCMDI/cmor/actions/runs/13752979396/job/38510374479?pr=780#step:7:39

@mauzey1
Copy link
Collaborator

mauzey1 commented Mar 10, 2025

@mkrupcale @durack1 I can confirm that this change works when building it on my machine.

I will approve and merge this change.

@mauzey1 mauzey1 merged commit 1244ce0 into PCMDI:main Mar 10, 2025
0 of 10 checks passed
@durack1
Copy link
Contributor

durack1 commented Mar 10, 2025

The CI is failing to checkout my git branch

@mauzey1 is there a trivial way to fix this? Can we cherry pick a patch from a remote repo for testing?

@mauzey1
Copy link
Collaborator

mauzey1 commented Mar 10, 2025

@durack1 I think the issue is due to the rerendering step assuming that all branches are from the PCMDI organization. I'll try to see if we can get it configured to use other orgs' or users' branches. It will still require our approval to run CI processes if a non-PCMDI user submits a PR to merge external branches.

@mkrupcale mkrupcale deleted the udunits2-netcdf-flags branch March 11, 2025 00:00
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