ranlibc -c used incorrectly in some packages #342
kgerheiser
started this conversation in
Good to know
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I found some very interesting about the
ranlib -c
used in bufr, and a couple other packages on macOS. Turns out that setting:Doesn't work as expected when installing libraries. ranlib is run correctly when creating the archive, but when running
make install
, ranlib is run again (without the -c) and the archive header is regenerated, negating its effect. This works in UPP because it's built internally as part of UFS (nomake install
). As far as I can tell there is no way to control ranlib flags used during the install phase (unless you manually edit the CMake install script), but I did a little research and found something better.The
-fno-common
flag can be used in both ifort and gfortran and prevents variables being added to the common section at compile time. Interestingly, I ran into this when compiling with gfortran. I had only ever experienced this with ifort.I was adding the MET package which links to bufr and even though I saw
ranlib -c
being used in the library build, my build would fail with missing symbols. Then, if I ranranlib -c
manually on the installed library the build would work.https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/data-options/fcommon.html
Another interesting tidbit is that GCC-10 defaults to using
-fno-common
, so I wouldn't have experienced this had I not been using GCC-9.https://gcc.gnu.org/gcc-10/porting_to.html
Not directly a spack-stack related issue, but I thought this would be a good place to document it.
Beta Was this translation helpful? Give feedback.
All reactions