Python module fails to build if build directory is changed

Issue #96 new
Fabricio created an issue

Hello there.

I’m develop a recipe for spack and am facing an issue when mshr is built in a different directory than the one created by decompressing the source tarball. By default, spack separates the source directory ‘spack-src’ from the build directory ‘spack-build’ [0] [1].

This setup works fine when building ‘libmshr.so’ and/or ‘mshrable’, but building the python module fails as it cannot find libmshr.so

==> [2019-12-11-15:46:21.238070] 'cmake' '.'
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /opt/spack/lib/spack/env/gcc/gcc
-- Check for working C compiler: /opt/spack/lib/spack/env/gcc/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/spack/lib/spack/env/gcc/g++
-- Check for working CXX compiler: /opt/spack/lib/spack/env/gcc/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/python-3.7.4-qbp6wmwnsl54tspd2wlqdmsr526pfvh2/bin/python3.7 (found version "3.7.4")
-- Found PythonLibs: /opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/python-3.7.4-qbp6wmwnsl54tspd2wlqdmsr526pfvh2/lib/libpython3.7m.so
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/root/spack-stage/spack-stage-fenics-mshr-2019.1.0-p54tdjbshqijrb2zojb6ilukiuv57flg/spack-src/python
==> [2019-12-11-15:46:27.152311] Copying config.json to build/
==> [2019-12-11-15:46:27.154287] '/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/python-3.7.4-qbp6wmwnsl54tspd2wlqdmsr526pfvh2/bin/python3.7' 'setup.py' '--no-user-cfg' 'build'
running build
running build_py
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/mshr
copying mshr/__init__.py -> build/lib.linux-x86_64-3.7/mshr
running build_ext
building 'mshr.cpp' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
/opt/spack/lib/spack/env/gcc/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/python-3.7.4-qbp6wmwnsl54tspd2wlqdmsr526pfvh2/include -I/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/fenics-dolfin-2019.1-3dovubtd6qurzeldbdvkywr5xb6n4ud3/include -I/tmp/root/spack-stage/spack-stage-fenics-mshr-2019.1.0-mh4sofu7gzlrkezbcfmd6zuyeebyoejy/spack-src/include -I/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/python-3.7.4-qbp6wmwnsl54tspd2wlqdmsr526pfvh2/include/python3.7m -c src/mshr.cpp -o build/temp.linux-x86_64-3.7/src/mshr.o -std=c++11
/opt/spack/lib/spack/env/gcc/gcc -pthread -shared -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/sqlite-3.30.1-uym5du2waswjfk6ejlmfexjqgog7npwo/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/ncurses-6.1-ktkurgldbb6ly3x5ktiu7q7cbrrupk6c/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/expat-2.2.9-6tz33utlyhkr7vltxi5qdqvgr7vbvf2u/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/xz-5.2.4-22uh6euciklzkbldeb6x2ngrt2zzumwk/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/libffi-3.2.1-pcolzxomjc6gkalkrdvf6q2mk2vi6p43/lib64 -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/readline-8.0-wmq3joh3rpkh6zpy6725lywzhko23vdb/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/gdbm-1.18.1-kvfa2ldqglcb45c3czf4qshmskvthx5w/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/bzip2-1.0.8-p6q2canmrlyruo6afabgs7w76b6q4kdo/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/zlib-1.2.11-j3zdmzqsbyenjda44kvkceohj352n5ga/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openssl-1.1.1d-c3qm3sp4ncd5j4sbvglqzifq3irfmtxe/lib -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/gettext-0.20.1-lxkri4wzs2rnosojdmqhcsgfmk2o55ix/lib build/temp.linux-x86_64-3.7/src/mshr.o -L/tmp/root/spack-stage/spack-stage-fenics-mshr-2019.1.0-mh4sofu7gzlrkezbcfmd6zuyeebyoejy/spack-build -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/python-3.7.4-qbp6wmwnsl54tspd2wlqdmsr526pfvh2/lib -lmshr -lpython3.7m -o build/lib.linux-x86_64-3.7/mshr/cpp.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lmshr
collect2: error: ld returned 1 exit status

[0] https://spack.readthedocs.io/en/latest/build_systems/cmakepackage.html

[1] https://spack.readthedocs.io/en/latest/spack.build_systems.html#module-spack.build_systems.cmake

Changing ‘build_directory’ in the spack recipe doesn’t help, neither using cmake options.

Making this work would clear the only roadblock to putting mshr in spack.

Thanks a lot,

Fabricio.

Comments (0)

  1. Log in to comment