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

Problem building with module-loaded compiler #6

Closed
spakin opened this issue Dec 3, 2014 · 13 comments
Closed

Problem building with module-loaded compiler #6

spakin opened this issue Dec 3, 2014 · 13 comments
Assignees

Comments

@spakin
Copy link
Contributor

spakin commented Dec 3, 2014

I'm trying out spack for the first time and ran into trouble when I tried to install a package after loading a compiler with the module command:

$ gcc --version | head -1
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
$ module show compilers/gcc/4.8.3
-------------------------------------------------------------------
/etc/modulefiles/compilers/gcc/4.8.3:

module-whatis    load GCC 4.8.3 environment 
module-whatis    Modifies: PATH, LD_LIBRARY_PATH, MANPATH 
prepend-path     PATH /projects/opt/gcc/4.8.3/bin 
prepend-path     LD_LIBRARY_PATH /projects/opt/gcc/4.8.3/lib64:/projects/opt/gcc/4.8.3/lib 
prepend-path     MANPATH /projects/opt/gcc/4.8.3/share/man 
setenv       CC gcc 
setenv       CXX g++ 
setenv       CPP cpp 
setenv       FC gfortran 
setenv       F77 gfortran 
setenv       F90 gfortran 
-------------------------------------------------------------------

$ module load compilers/gcc/4.8.3
$ gcc --version | head -1
gcc (GCC) 4.8.3
$ spack compilers
==> Available compilers
-- gcc ----------------------------------------------------------
gcc@4.4.7
$ spack compiler add
==> Added 1 new compiler to /home/pakin/.spackconfig
gcc@4.8.3
$ spack install libelf
==> Installing libelf
==> Trying to fetch from http://www.mr511.de/software/libelf-0.8.12.tar.gz
######################################################################## 100.0%
==> Staging archive: /home/pakin/spack/var/spack/stage/libelf@0.8.12%gcc@4.8.3=unknown_arch/libelf-0.8.12.tar.gz
==> Created stage in /home/pakin/spack/var/spack/stage/libelf@0.8.12%gcc@4.8.3=unknown_arch.
==> No patches needed for libelf.
==> Building libelf.
creating cache ./config.cache
checking whether make sets ${MAKE}... yes
checking for gcc... cc
checking whether the C compiler (cc  ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
Traceback (most recent call last):
  File "/home/pakin/spack/lib/spack/spack/package.py", line 754, in do_install
self.install(self.spec, self.prefix)
  File "/home/pakin/spack/var/spack/packages/libelf/package.py", line 43, in install
"--disable-debug")
  File "/home/pakin/spack/lib/spack/spack/util/executable.py", line 83, in __call__
% (" ".join(cmd), proc.returncode))
spack.util.executable.ProcessError: command './configure --prefix=/home/pakin/spack/opt/unknown_arch/gcc@4.8.3/libelf@0.8.12 --enable-shared --disable-dependency-tracking --disable-debug' returned error code 1
$ cat /tmp/spack-stage/spack-stage-J87_JC/libelf-0.8.12/config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:582: checking whether make sets ${MAKE}
configure:611: checking for gcc
configure:724: checking whether the C compiler (cc  ) works
configure:740: cc -o conftest    conftest.c  1>&5
/projects/opt/gcc/4.8.3/packages/gcc-4.8.3/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
configure: failed program was:

#line 735 "configure"
#include "confdefs.h"

main(){return(0);}
$ ldd /projects/opt/gcc/4.8.3/packages/gcc-4.8.3/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/cc1
    linux-vdso.so.1 =>  (0x00007fff5b9ff000)
    libmpc.so.3 => /projects/opt/gcc/4.8.3/lib/libmpc.so.3 (0x00002ad3b51d7000)
    libmpfr.so.4 => /projects/opt/gcc/4.8.3/lib/libmpfr.so.4 (0x00002ad3b53ef000)
    libgmp.so.10 => /projects/opt/gcc/4.8.3/lib/libgmp.so.10 (0x00002ad3b564b000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003167000000)
    libz.so.1 => /lib64/libz.so.1 (0x0000003167400000)
    libstdc++.so.6 => /projects/opt/gcc/4.8.3/lib64/libstdc++.so.6 (0x00002ad3b58e3000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003166800000)
    libgcc_s.so.1 => /projects/opt/gcc/4.8.3/lib64/libgcc_s.so.1 (0x00002ad3b5bed000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003166400000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003166000000)

It looks like spack is discarding my LD_LIBRARY_PATH. Is there a way to tell it not to?

— Scott

@tgamblin
Copy link
Member

tgamblin commented Dec 5, 2014

So, this is interesting. All the LLNL custom gcc installs use either static dependency libraries, or they rely on the system dependency libraries (libmpfr, etc). The idea with Spack is that things like LD_LIBRARY_PATH should not matter, and moreover that they shouldn't interfere with the package build. I blow away LD_LIBRARY_PATH and populate it with /lib and /lib64 locations only of dependencies during a spack build. I also add RPATHs for all the dependencies to the compile line. If I include your LD_LIBRARY_PATH, I run the risk of polluting the package build with gcc's dependencies. What if gcc itself builds a binary that depends on mpfr?

For example, when Spack builds gcc, it actually bakes in the dependency RPATHs using its cc wrapper.

I can't do that with external compilers, but I definitely want to support external compilers. Would it be reasonable to record the LD_LIBRARY_PATH on "spack compiler add" and to use that particular one to invoke the real gcc from within spack's cc? That would keep LD_LIBRARY_PATH out of the build environment and out of test runs (e.g., in configure) during the build. When the build invokes Spack's cc, it makes sure to use the LD_LIBRARY_PATH needed by the compiler.

Does that seem reasonable?

@spakin
Copy link
Contributor Author

spakin commented Dec 5, 2014

Wouldn't it be sufficient simply to prepend Spack's dependencies before the existing LD_LIBRARY_PATH? That way, if a dependency can be satisfied by Spack it will be. In cases like mine, the external compiler should still be able to run.

I don't know how Spack decides what to include in each generated executable's RPATH, but I'd think that properly ordering LD_LIBRARY_PATH would just do the right thing.

— Scott

@tgamblin
Copy link
Member

tgamblin commented Dec 5, 2014

Not exactly -- if I do as you suggest, what happens when I unload the module? The user should still be able to build thing with, say, %gcc@4.8.3 and have it work. If I rely on modules, it won't. I could simplify implementation by putting compiler LD_LIBRARY_PATHs last in the environment and not bothering with passing them to wrappers to be set only when compilers run, but I still think I have to remember the LD_LIBRARY_PATH per compiler...

@tgamblin tgamblin self-assigned this Apr 27, 2015
@tgamblin tgamblin added the bug Something isn't working label Dec 20, 2015
@AdrianRodriguezVilas
Copy link

Hi, I'm just posting this comment because I found the same problem and I'm interested in knowing if this is already solved somehow or is planned to be in a future version.

@tgamblin Your solution seems reasonable to me. I understand that solving it that way would allow to load/unload the compiler module without affecting to the builds made with it previously, am I right?

@adamjstewart
Copy link
Member

This issue is still being reported:

https://groups.google.com/forum/#!topic/spack/I7CQgmwHmLI

@adamjstewart
Copy link
Member

Also see #332.

@tgamblin
Copy link
Member

tgamblin commented Nov 9, 2016

Fixed by #2279.

@tgamblin tgamblin closed this as completed Nov 9, 2016
hartzell pushed a commit to hartzell/spack that referenced this issue Mar 9, 2017
The issue is described in depth [here][desc].  C++14 no longer
allows implicit conversion from iostream classes to void*.

This patch comes directly from [PR spack#6][patch].

[desc]: http://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar
[patch]: agordon/libgtextutils#6
adamjstewart pushed a commit that referenced this issue Mar 9, 2017
* New gcc uses C++14 mode, this fixes implicit conversion

The issue is described in depth [here][desc].  C++14 no longer
allows implicit conversion from iostream classes to void*.

This patch comes directly from [PR #6][patch].

[desc]: http://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar
[patch]: agordon/libgtextutils#6

* mend
diaena pushed a commit to diaena/spack that referenced this issue May 26, 2017
* New gcc uses C++14 mode, this fixes implicit conversion

The issue is described in depth [here][desc].  C++14 no longer
allows implicit conversion from iostream classes to void*.

This patch comes directly from [PR spack#6][patch].

[desc]: http://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar
[patch]: agordon/libgtextutils#6

* mend
xavierandrade pushed a commit to xavierandrade/spack that referenced this issue Jun 16, 2017
* New gcc uses C++14 mode, this fixes implicit conversion

The issue is described in depth [here][desc].  C++14 no longer
allows implicit conversion from iostream classes to void*.

This patch comes directly from [PR spack#6][patch].

[desc]: http://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar
[patch]: agordon/libgtextutils#6

* mend
EmreAtes pushed a commit to EmreAtes/spack that referenced this issue Jul 10, 2017
* New gcc uses C++14 mode, this fixes implicit conversion

The issue is described in depth [here][desc].  C++14 no longer
allows implicit conversion from iostream classes to void*.

This patch comes directly from [PR spack#6][patch].

[desc]: http://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar
[patch]: agordon/libgtextutils#6

* mend
amklinv pushed a commit that referenced this issue Jul 17, 2017
* New gcc uses C++14 mode, this fixes implicit conversion

The issue is described in depth [here][desc].  C++14 no longer
allows implicit conversion from iostream classes to void*.

This patch comes directly from [PR #6][patch].

[desc]: http://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar
[patch]: agordon/libgtextutils#6

* mend
healther referenced this issue in electronicvisions/spack Jul 26, 2017
* New gcc uses C++14 mode, this fixes implicit conversion

The issue is described in depth [here][desc].  C++14 no longer
allows implicit conversion from iostream classes to void*.

This patch comes directly from [PR #6][patch].

[desc]: http://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar
[patch]: agordon/libgtextutils#6

* mend
@junghans
Copy link
Contributor

/cc @louisvernon @rspavel

@scheibelp
Copy link
Member

@junghans could you expand on #6 (comment)? For example if you are getting the exact same error as #6 (comment) it would be good to know that (along with additional details e.g. relevant entries from compilers.yaml or packages.yaml) or if this came up in another issue if that could be mentioned here (at the present time #5705 isn't confirmed to be related to compiler modules AFAIK).

@louisvernon
Copy link
Contributor

This was reopened by @junghans as we unclear on how #2279 fixes the originally described issue. What is the current expected behavior for a compiler which requires the setting of LD_LIBRARY_PATH? If the expectation is to explicitly manage the environment through customization of compilers.yaml, how does this relate to #2279?

@scheibelp
Copy link
Member

@louisvernon thanks for the extra info.

@tgamblin FYI

What is the current expected behavior for a compiler which requires the setting of LD_LIBRARY_PATH?

Prior to #5599 (merged last week) LD_LIBRARY_PATH as set by the compiler module would not have been respected. Now it should be - @becker33 does that conflict with #6 (comment)?

If the expectation is to explicitly manage the environment through customization of compilers.yaml...

Sorry I'm lacking the context for this one. Is this related to desired behavior not yet available or expected behavior that is not working?

@becker33
Copy link
Member

becker33 commented Jul 6, 2018

Closing as outdated

@becker33 becker33 closed this as completed Jul 6, 2018
gartung referenced this issue in gartung/spack Feb 5, 2019
Revert commits accidentally included in merge branch.
tgamblin pushed a commit that referenced this issue Jul 1, 2019
* satsuma2: new package (#4838)

* salmon: new package (#4833)

* New Package: C-Ares (#4840)

Adds the c-ares library, a C library for asynchronous DNS requests.

Required for the google gRPC library.

* sickle: new package (#4851)

* seqprep: new package (#4850)

* smalt: new package (#4853)

* singularity: new package (#4852)

* lmdb: Update to 0.9.21 (#4830)

Convert to MakefilePackage and add pkg-config file.

* added new pruners-ninja version (#4859)

* sortmerna: new package (#4866)

* revbayes: trying this again (#4861)

* new package: miniGMG (#4849)

* new package: miniGMG

* changed based on comments

* removed cuda version

* sparta: new package (#4867)

* sparta: new package

* fixing homepage

* Savanna (#4856)

Installing the stable version 0.5 through the checksummed tar.gz does not fetch the git submodule in the package.
The submodule appears as an empty directory.

Thus, clone the commit tagged as v0.5 using git to get around this issue

* savanna: modified adios dependency spec
* Replaced adios+staging with adios+flexpath+dataspaces
* savanna: Enabling fortran support in adios by default
* savanna: reverting to variant 'staging' for enabling all staging transports

* Make testing spack commands simpler (#4868)

Adds SpackCommand class allowing Spack commands to be easily in Python

Example usage:

    from spack.main import SpackCommand
    info = SpackCommand('info')
    out, err = info('mpich')
    print(info.returncode)

This allows easier testing of Spack commands.

Also:
* Simplify command tests
* Simplify mocking in command tests.
* Simplify module command test
* Simplify python command test
* Simplify uninstall command test
* Simplify url command test
* SpackCommand uses more compatible output redirection

* gBenchmark: Development Package (#4847)

* gBenchmark: Development Package

Add the development version (master branch) of `gBenchmark`

* gBenchmark: Remove Duplicate

Remove duplicate `gbenchmark` library
and keep its patch to remove the shipped
-Werror

* Perl - allow package activation without PERL5LIB variable (#4540)

* perl: prepend default perl @inc path to support package activation

* perl: remove stray comma from list of configure arguments

* perl: final comma in configure arguments makes adding arguments safer

This reverts commit fdc10cd.

* perl: add comment about modified @inc (thanks to George Hartzell)

* perl: use self.prefix.lib and self.prefix.bin for clarity

* perl: convert tabs added by editor to spaces for flake8

* perl: use new path syntax: prefix.lib.perl5

* perl: avoid line break before binary operator

* perl: use compact spack syntax for perl executable

* fix sphinx dependencies, add v1.6.3 (#4870)

* Add cuda variant for mvapich2. (#4800)

* Add cuda variant for mvapich2.

* Disable cuda for mvapich2 by default.

* Add a py-theano version from git repo (#4871)

* Change Version formatting properties and functions to return Version objects (#4834)

* Change version.up_to() to return Version() object
* Add unit tests for Version.up_to()
* Fix packages that expected up_to() to return a string
* Ensure that up_to() preserves separator characters
* Use version indexing instead of up_to
* Make all Version formatting properties return Version objects
* Update docs
* Tests need to test string representation

* stringtie: new package (#4878)

* added new version of cdo (#4877)

* subread: new package (#4882)

* structure: new package (#4879)

* structure: new pacakge

* fixing package structure (not a pun)

* swarm: new package (#4885)

* added new version of jdk 8u141-b15 (#4876)

* stacks: new package (#4875)

* fix GobjectIntrospection on Darwin (#4872)

* fix GobjectIntrospection on Darwin

* minor
tgamblin pushed a commit that referenced this issue Jul 1, 2019
This reverts commit 9860be1.
fcannini pushed a commit to fcannini/spack that referenced this issue Oct 29, 2019
…evelop

* commit 'da8427ea74396be4298d936897b7b76468310094':
  py-msmtools: New package. Dependency of `PKG-4`.
amd-toolchain-support referenced this issue in amd-toolchain-support/spack Mar 17, 2021
Don't use version suffix to distinguish among compilers
@mohit9638iitk
Copy link

Spack install can't find shared libraries when using intel compilers

Paul-Ferrell added a commit to Paul-Ferrell/spack that referenced this issue Oct 7, 2021
bernhardkaindl pushed a commit to bernhardkaindl/spack that referenced this issue Nov 2, 2021
…ecov/codecov-action-1.5.2

build(deps): bump codecov/codecov-action from 1.5.0 to 1.5.2
climbfuji referenced this issue in climbfuji/spack Feb 11, 2022
Bug fix for findutils: apply nonnull.patch only for versions 4.8.0+
mlxd pushed a commit to mlxd/spack that referenced this issue Mar 17, 2023
tldahlgren pushed a commit that referenced this issue Apr 21, 2023
1. support version 3.1.3, which now depends on sundials@6

2. support version 3.1.2:, which broke the two patch files and
   therefore the two patch files have been replaced by more flexible
   filter_file() commands inside a patch() function.

3. rename the variant for python extension from using the package name
   "+pyuqtk" to the more standard "+python"

4. add maintainers @omsai and the upstream developer @bjdebus who
   offered to help with the spack packaging.

5. swig should only be a build-time dependency.  swig is only
   necessary until @:3.1.0

6. confirmed python dependencies are correct by inspecting imports,
   subset python dependencies type to build, run, and confirmed all
   31 build-time tests pass including the 9 python tests:

```console
$ spack env create uqtk-dev
$ spack add uqtk@3.1.3
$ spack install --test root && cat $(spack location -i uqtk)/.spack/install-time-test-log.txt
==> Testing package uqtk-3.1.3-nok6fut
==> [2023-04-19-14:56:25.005361] Running build-time tests
==> [2023-04-19-14:56:25.005536] RUN-TESTS: build-time tests [check]
==> [2023-04-19-14:56:25.009543] '/home/omsai/src/spack/opt/spack/linux-pureos10-skylake/gcc-10.2.1/gmake-4.4.1-b6g4apmfvxz3bn4eabh37dehcrg65fj7/bin/make' '-j4' '-n' 'test'
==> [2023-04-19-14:56:25.014903] '/home/omsai/src/spack/opt/spack/linux-pureos10-skylake/gcc-10.2.1/gmake-4.4.1-b6g4apmfvxz3bn4eabh37dehcrg65fj7/bin/make' '-j4' 'test'
Running tests...
/home/omsai/src/spack/opt/spack/linux-pureos10-skylake/gcc-10.2.1/cmake-3.26.3-zjmsfz23j5l4ytniz26uzvxonlu5qebr/bin/ctest --force-new-ctest-process
Test project /tmp/omsai/spack-stage/spack-stage-uqtk-3.1.3-nok6fut47h42cnaau7wkoohgqy5f2qqa/spack-build-nok6fut
      Start  1: ArrayReadAndWrite
      Start  2: ArrayDelColumn
      Start  3: Array1DMiscTest
      Start  4: Array2DMiscTest
 1/31 Test  #1: ArrayReadAndWrite ................   Passed    0.01 sec
      Start  5: ArraySortTest
 2/31 Test  #2: ArrayDelColumn ...................   Passed    0.01 sec
      Start  6: MultiIndexTest
 3/31 Test  #3: Array1DMiscTest ..................   Passed    0.01 sec
      Start  7: CorrTest
 4/31 Test  #4: Array2DMiscTest ..................   Passed    0.01 sec
      Start  8: QuadLUTest
 5/31 Test  #5: ArraySortTest ....................   Passed    0.02 sec
      Start  9: MCMC2dTest
 6/31 Test  #6: MultiIndexTest ...................   Passed    0.01 sec
      Start 10: MCMCRandomTest
 7/31 Test  #8: QuadLUTest .......................   Passed    0.02 sec
      Start 11: MCMCNestedTest
 8/31 Test #10: MCMCRandomTest ...................   Passed    0.02 sec
      Start 12: Deriv1dTest
 9/31 Test #12: Deriv1dTest ......................   Passed    0.01 sec
      Start 13: SecondDeriv1dTest
10/31 Test #13: SecondDeriv1dTest ................   Passed    0.01 sec
      Start 14: GradHessianTest
11/31 Test #11: MCMCNestedTest ...................   Passed    0.03 sec
      Start 15: GradientPCETest
12/31 Test #14: GradHessianTest ..................   Passed    0.01 sec
      Start 16: PCE1dTest
13/31 Test #15: GradientPCETest ..................   Passed    0.01 sec
      Start 17: PCEImplTest
14/31 Test #16: PCE1dTest ........................   Passed    0.01 sec
      Start 18: PCELogTest
15/31 Test #18: PCELogTest .......................   Passed    0.01 sec
      Start 19: Hessian2dTest
16/31 Test #19: Hessian2dTest ....................   Passed    0.01 sec
      Start 20: BCS1dTest
17/31 Test #20: BCS1dTest ........................   Passed    0.01 sec
      Start 21: BCS2dTest
18/31 Test #21: BCS2dTest ........................   Passed    0.01 sec
      Start 22: LowRankRegrTest
19/31 Test #22: LowRankRegrTest ..................   Passed    0.01 sec
      Start 23: PyModTest
20/31 Test #17: PCEImplTest ......................   Passed    0.07 sec
      Start 24: PyArrayTest
21/31 Test #23: PyModTest ........................   Passed    0.08 sec
      Start 25: PyArrayTest2
22/31 Test #25: PyArrayTest2 .....................   Passed    0.30 sec
      Start 26: PyQuadTest
23/31 Test #24: PyArrayTest ......................   Passed    1.44 sec
      Start 27: PyBCSTest1D
24/31 Test #26: PyQuadTest .......................   Passed    1.68 sec
      Start 28: PyBCSTest2D
25/31 Test #27: PyBCSTest1D ......................   Passed    1.66 sec
      Start 29: PyBADPTest
26/31 Test  #7: CorrTest .........................   Passed    3.43 sec
      Start 30: PyRegressionTest
27/31 Test #28: PyBCSTest2D ......................   Passed    1.50 sec
      Start 31: PyGalerkinTest
28/31 Test  #9: MCMC2dTest .......................   Passed    3.90 sec
29/31 Test #29: PyBADPTest .......................   Passed    1.66 sec
30/31 Test #30: PyRegressionTest .................   Passed    1.72 sec
31/31 Test #31: PyGalerkinTest ...................   Passed    1.63 sec

100% tests passed, 0 tests failed out of 31

Total Test time (real) =   5.35 sec
==> [2023-04-19-14:56:30.382797] '/home/omsai/src/spack/opt/spack/linux-pureos10-skylake/gcc-10.2.1/gmake-4.4.1-b6g4apmfvxz3bn4eabh37dehcrg65fj7/bin/make' '-j4' '-n' 'check'
==> [2023-04-19-14:56:30.385983] Target 'check' not found in Makefile
```
AlexanderRichert-NOAA pushed a commit to AlexanderRichert-NOAA/spack that referenced this issue May 25, 2023
Add cmake flags for Apple-clang case to cover C/C++ and RELEASE/REWITHDEBINFO builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants