Skip to content

Fix gdal installation errors on NOAA RDHPC Gaea (64bit I/O) and invalid json-c library dir#30809

Closed
climbfuji wants to merge 4 commits intospack:developfrom
climbfuji:feature/bugfixes_and_variant_64bitio_gdal
Closed

Fix gdal installation errors on NOAA RDHPC Gaea (64bit I/O) and invalid json-c library dir#30809
climbfuji wants to merge 4 commits intospack:developfrom
climbfuji:feature/bugfixes_and_variant_64bitio_gdal

Conversation

@climbfuji
Copy link
Copy Markdown
Contributor

Fixes #23943 by using the correct library directory name (lib or lib64, depending on the system) when looking for json-c libraries.

Fixes #30808 by adding a new variant 64bitIO. Default is on, i.e. no change, turning it off on Gaea allows building [email protected] successfully.

]
# Fix for gdal always using suffix 'lib', even though libraries
# like json-c might get installed in 'lib64'
#ldflags.append(self.spec['libtiff'].libs.search_flags)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do the same for libtiff and libgeotiff?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that this solution is needed. Doesn't Spack automatically inject these into the compiler search path already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently not. I wasn't the only one having the issue, when I wanted to create one for this error I found that @tldahlgren had the same problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scheibelp @becker33 why would this not be done automatically by our compiler wrappers and build_environment.py?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should be done automatically. I'd be interested in seeing the compiler wrapper log generated when installing this with spack -d.... This (error and the fix) could happen if the build bypasses the Spack compiler wrappers (in which case the wrapper never gets a chance to insert the -L, but setting LDFLAGS in configure works because the build system then arranges things properly); in that case, the compiler wrapper log will be boring (but it will be apparent that the log is missing an entry for whatever compilation line fails in the build log).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think OSGeo/gdal#3895 (comment) has the logs you want (note that it's ~1 yr old)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies I did not make this clear but I would also need the spack-build-out.txt log to see which file failed, at which point I could cross-reference with the compiler wrapper log. Sometimes that is just the last entry in the log, but when I opened the log you posted there, the last entry included a -L<json-prefix>/lib64, so that looked good.

Also, I double checked our default library-finding logic and it appears to be capable of checking both lib and lib64.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scroll up to the top of that same issue for the build log (spack-build-out.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, the line which fails in the build log:

/bin/sh /data/geol552/a/adamjs5/spack-stage-gdal-3.2.3-ozkzmsnz4b4ucfeag6ezpb7xg6e67kpf/spack-src/libtool --mode=link --silent /data/keeling/a/adamjs5/spack/lib/spack/env/gcc/g++ gdalinfo_bin.lo /data/geol552/a/adamjs5/spack-stage-gdal-3.2.3-ozkzmsnz4b4ucfeag6ezpb7xg6e67kpf/spack-src/libgdal.la -o gdalinfo

Has no corresponding wrapper invocation, which suggests to me that libtool --mode=link is bypassing the Spack compiler wrapper (even though you refer to /data/keeling/a/adamjs5/spack/lib/spack/env/gcc/g++) or doing some check and deciding things won't work before it invokes it.

@climbfuji climbfuji mentioned this pull request May 24, 2022
4 tasks
@climbfuji
Copy link
Copy Markdown
Contributor Author

@adamjstewart Will fix the style errors once we agree on the variant name and what to do with libtiff and libgeotiff.

@adamjstewart
Copy link
Copy Markdown
Member

My only concern with this variant is that I don't see any equivalent in the new CMake build system (added in 3.5.0). Of course, we could make this variant available only in 3.4 and older, but I want to make sure that you don't have the same issue when I added 3.5.0.

@adamjstewart adamjstewart self-assigned this May 24, 2022
@climbfuji
Copy link
Copy Markdown
Contributor Author

My only concern with this variant is that I don't see any equivalent in the new CMake build system (added in 3.5.0). Of course, we could make this variant available only in 3.4 and older, but I want to make sure that you don't have the same issue when I added 3.5.0.

I can try building 3.5.0 on Gaea (our spack fork is a bit behind, don't have this version yet I think).

@adamjstewart
Copy link
Copy Markdown
Member

I haven't added it to the package yet because it switches from Autotools to CMake. I'm planning on working on this shortly after Spack 0.18 is released (in the next week).

@climbfuji
Copy link
Copy Markdown
Contributor Author

My only concern with this variant is that I don't see any equivalent in the new CMake build system (added in 3.5.0). Of course, we could make this variant available only in 3.4 and older, but I want to make sure that you don't have the same issue when I added 3.5.0.

I can try building 3.5.0 on Gaea (our spack fork is a bit behind, don't have this version yet I think).

Actually, I don't see 3.5.0 yet in the repo: https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/gdal/package.py

@climbfuji
Copy link
Copy Markdown
Contributor Author

I haven't added it to the package yet because it switches from Autotools to CMake. I'm planning on working on this shortly after Spack 0.18 is released (in the next week).

I see. How to proceed?

@adamjstewart
Copy link
Copy Markdown
Member

My personal preference would be to wait until I finish the CMake refactor (probably 2 week timeframe). If the new version that uses CMake fixes all of our issues, then great! If people still want to be able to install the older versions that require these hacks, then we can still merge them for the older Autotools-only versions. Does that work for you, or would you like to see this fixed sooner than 2 weeks?

@climbfuji
Copy link
Copy Markdown
Contributor Author

My personal preference would be to wait until I finish the CMake refactor (probably 2 week timeframe). If the new version that uses CMake fixes all of our issues, then great! If people still want to be able to install the older versions that require these hacks, then we can still merge them for the older Autotools-only versions. Does that work for you, or would you like to see this fixed sooner than 2 weeks?

I need a fix sooner than that, but in our own fork. I can update our fork with changes that go on top of this PR, but it would be good to choose the right name for the 64bitIO variant (because if the uppercase letters) for now.

Copy link
Copy Markdown
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+unix_stdio_64 changes look good and I'm happy to merge those right away.

For the ldflags changes, I want to better understand why these are needed before merging. These should be added automatically by the compiler wrappers. If they aren't, we can either fix that, or manually add them like you do here for all deps, not just json-c.

@climbfuji
Copy link
Copy Markdown
Contributor Author

+unix_stdio_64 changes look good and I'm happy to merge those right away.

For the ldflags changes, I want to better understand why these are needed before merging. These should be added automatically by the compiler wrappers. If they aren't, we can either fix that, or manually add them like you do here for all deps, not just json-c.

Ok, thanks. I'll merge the commits in this PR in our fork and add any follow-up changes we are making here later. What is in the PR right now is sufficient to build on Gaea. Thanks for your quick feedback!

@adamjstewart
Copy link
Copy Markdown
Member

Also, if you figure out a way to auto-detect whether or not ~unix_stdio_64 is needed on a system, that might be useful. I'm not entirely sure when it's needed just from looking at configure.

@climbfuji
Copy link
Copy Markdown
Contributor Author

@adamjstewart As it turns out the new variant +unix_stdio_64 = --with-unix-stdio-64=yes isn't working on any of the macOS and Linux platforms that I tried yesterday.

My assumption is that configure determines correctly to turn unix-stdio-64 off on most (all?) systems except Gaea, on which it thinks that it's ok to turn it on although it isn't supported.

What's the best way to deal with this? Simply make the default for variant unix_stdio_64 off?

@adamjstewart
Copy link
Copy Markdown
Member

Interesting. We could set it up so that +unix_stdio_64 does nothing and only ~unix_stdio_64 adds the flag, but I don't love non-deterministic build systems like this. Any idea how to determine when the flag is actually necessary? If we can figure that out directly in Python we wouldn't even need a variant.

@adamjstewart
Copy link
Copy Markdown
Member

Now that Spack 0.18 is out I'll be working on porting the package to CMake for the newest GDAL release. Hopefully that solves your issues because it seems like the Autotools build is wonky on your system.

@adamjstewart adamjstewart mentioned this pull request May 31, 2022
18 tasks
@adamjstewart adamjstewart mentioned this pull request Jun 20, 2022
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installation issue: gdal-3.4.2 on NOAA RDHPCS Gaea (Cray) Installation issue: gdal

3 participants