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

Bug in buildlib code to check for compiler warnings #240

Open
adrifoster opened this issue Aug 21, 2023 · 1 comment
Open

Bug in buildlib code to check for compiler warnings #240

adrifoster opened this issue Aug 21, 2023 · 1 comment

Comments

@adrifoster
Copy link
Contributor

In running on my own personal computer, I encountered a bug with the python buildlib script.

nextline is set up as an empty string here, but strings cannot be appended to as they are immutable, so this fails on this line .

I propose changing the line to nextline = nextline + line.

However, I still got additional errors because of this check:

        if len(nextline) > 0:
            expect(False, nextline)`

The specific warning I got was

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/afoster/projects/scratch/SMS_D_Ld1_P8x1.f10_f10_mg37.I2000Clm50BgcCropQianRs.fleabone_gnu.clm-default.20230821_112432_besy6i/bld/gnu/openmpi/debug/nothreads/nuopc/lib/libFoX_common.a(FoX_common.F90.o) has no symbols

There does seem to be symbols in this file checking on my own and with @billsacks. Commenting out this entire code block, my tests all ran so I'm not sure what this warning is about. However, I believe it is not getting caught by the if "F90" in line and not "fox" in line: above because "fox" is actually "FoX" in the warning output.

So I propose (will submit a PR if get the go ahead) to change this entire code block to:

    if compiler == "gnu" and case.get_value("DEBUG"):
        # Do not allow any warnings except from fox external
        nextline = ""
        for line in e.split("\n"):
            if "f90" in line.lower() and not "fox" in line.lower():
                nextline = nextline + line
        if len(nextline) > 0:
            expect(False, nextline)

@billsacks and @jedwards4b and others does this seem okay? I have done manual testing of this update and it seems to work.

@billsacks
Copy link
Member

This suggestion looks good to me, so opening a PR sounds great. Thank you for working through it!

billsacks added a commit that referenced this issue Aug 21, 2023
Simple fix for buildlib python bug

### Description of changes

As laid out in #240 a bug was found in the [buildlib script](https://github.com/ESCOMP/CDEPS/blob/f7e657e6f0ad2e758534b0e2cd195f18e8f08ecc/cime_config/buildlib#L182)

This code update changes the `append` line to a string concatenation and updates the `if "F90" in line and not "fox" in line:` line to ensure different capitalizations of "fox" don't slip through.


Contributors other than yourself, if any: @billsacks 

CDEPS Issues Fixed (include github issue #): #240

Are there dependencies on other component PRs (if so list): No

Are changes expected to change answers (bfb, different to roundoff, more substantial): No

Any User Interface Changes (namelist or namelist defaults changes): No

Testing performed (e.g. aux_cdeps, CESM prealpha, etc):

Tested manually with `SMS_D_Ld1_P8x1.f10_f10_mg37.I2000Clm50BgcCropQianRs.fleabone_gnu.clm-default` (on personal computer)

Hashes used for testing:
`cdeps1.0.13-1-gd31de60`
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

No branches or pull requests

2 participants