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

Pythia ./configure fails when building from source with installer #568

Open
mjbludwig opened this issue Apr 12, 2023 · 12 comments
Open

Pythia ./configure fails when building from source with installer #568

mjbludwig opened this issue Apr 12, 2023 · 12 comments
Labels
bug General bug

Comments

@mjbludwig
Copy link

Describe the bug

Looks like during the configuration of pythia, it is unable to find the cppunits header file even though it is looking in the right place and the header file looks fine.

To Reproduce

fresh build using ./configure --prefix=/home/software/pylith/3.0.3/ --with-make-threads=12 --enable-python --enable-force-install

Expected behavior

Successful build

Screenshots

N/A

Environment

Please provide the following information:

  • CentOS 7.7.1908
  • PyLith 3.0.3 from source using the installer

Additional context

Error during config:

checking cppunit/TestRunner.h usability... no
checking cppunit/TestRunner.h presence... no
checking for cppunit/TestRunner.h... no

I even tried tweaking the pythia config part of the Makefile to point to the file but no luck.

[m_ludwig@compute-node pylith-installer-3.0.3-0]$ ls -l /home/software/pylith/3.0.3/include/cppunit/
total 204
-rw-r--r-- 1 m_ludwig m_ludwig  2276 Apr 12 15:00 AdditionalMessage.h
-rw-r--r-- 1 m_ludwig m_ludwig 12050 Apr 12 15:00 Asserter.h
-rw-r--r-- 1 m_ludwig m_ludwig   935 Apr 12 15:00 BriefTestProgressListener.h
-rw-r--r-- 1 m_ludwig m_ludwig  5317 Apr 12 15:00 CompilerOutputter.h
drwxrwxr-x 2 m_ludwig m_ludwig   189 Apr 12 15:00 config
-rw-r--r-- 1 m_ludwig m_ludwig  4350 Apr 12 15:00 config-auto.h
-rw-r--r-- 1 m_ludwig m_ludwig  2161 Apr 12 15:00 Exception.h
drwxrwxr-x 2 m_ludwig m_ludwig  4096 Apr 12 15:00 extensions
-rw-r--r-- 1 m_ludwig m_ludwig  4656 Apr 12 15:00 Message.h
-rw-r--r-- 1 m_ludwig m_ludwig   368 Apr 12 15:00 Outputter.h
drwxrwxr-x 2 m_ludwig m_ludwig   205 Apr 12 15:00 plugin
drwxrwxr-x 2 m_ludwig m_ludwig    57 Apr 12 15:00 portability
-rw-r--r-- 1 m_ludwig m_ludwig  5561 Apr 12 15:00 Portability.h
-rw-r--r-- 1 m_ludwig m_ludwig  2665 Apr 12 15:00 Protector.h
-rw-r--r-- 1 m_ludwig m_ludwig  1443 Apr 12 15:00 SourceLine.h
-rw-r--r-- 1 m_ludwig m_ludwig  1955 Apr 12 15:00 SynchronizedObject.h
-rw-r--r-- 1 m_ludwig m_ludwig 25428 Apr 12 15:00 TestAssert.h
-rw-r--r-- 1 m_ludwig m_ludwig  5076 Apr 12 15:00 TestCaller.h
-rw-r--r-- 1 m_ludwig m_ludwig  1124 Apr 12 15:00 TestCase.h
-rw-r--r-- 1 m_ludwig m_ludwig   923 Apr 12 15:00 TestComposite.h
-rw-r--r-- 1 m_ludwig m_ludwig  1118 Apr 12 15:00 TestFailure.h
-rw-r--r-- 1 m_ludwig m_ludwig  2661 Apr 12 15:00 TestFixture.h
-rw-r--r-- 1 m_ludwig m_ludwig  4000 Apr 12 15:00 Test.h
-rw-r--r-- 1 m_ludwig m_ludwig   921 Apr 12 15:00 TestLeaf.h
-rw-r--r-- 1 m_ludwig m_ludwig  4083 Apr 12 15:00 TestListener.h
-rw-r--r-- 1 m_ludwig m_ludwig  7025 Apr 12 15:00 TestPath.h
-rw-r--r-- 1 m_ludwig m_ludwig  1998 Apr 12 15:00 TestResultCollector.h
-rw-r--r-- 1 m_ludwig m_ludwig  4466 Apr 12 15:00 TestResult.h
-rw-r--r-- 1 m_ludwig m_ludwig  3500 Apr 12 15:00 TestRunner.h
-rw-r--r-- 1 m_ludwig m_ludwig   843 Apr 12 15:00 TestSuccessListener.h
-rw-r--r-- 1 m_ludwig m_ludwig  1963 Apr 12 15:00 TestSuite.h
-rw-r--r-- 1 m_ludwig m_ludwig  1431 Apr 12 15:00 TextOutputter.h
-rw-r--r-- 1 m_ludwig m_ludwig   951 Apr 12 15:00 TextTestProgressListener.h
-rw-r--r-- 1 m_ludwig m_ludwig   949 Apr 12 15:00 TextTestResult.h
-rw-r--r-- 1 m_ludwig m_ludwig   148 Apr 12 15:00 TextTestRunner.h
drwxrwxr-x 2 m_ludwig m_ludwig   133 Apr 12 15:00 tools
drwxrwxr-x 3 m_ludwig m_ludwig    26 Apr 12 15:00 ui
-rw-r--r-- 1 m_ludwig m_ludwig  5063 Apr 12 15:00 XmlOutputter.h
-rw-r--r-- 1 m_ludwig m_ludwig  4920 Apr 12 15:00 XmlOutputterHook.h

Let me know if I can provide any other info!!

Thanks!

@mjbludwig mjbludwig added the bug General bug label Apr 12, 2023
@baagaard-usgs
Copy link
Contributor

Did you run source setup.sh after running configure but before running make?
When this step is omitted, the installer will build dependencies but they won't be seen by packages built later.

@mjbludwig
Copy link
Author

Hi @baagaard-usgs, thanks for the quick reply!

Indeed, I have been sourcing the file as instructed. Ran the process from scratch just to be sure. I noticed that CPATH did not have the path to /home/software/pylith/3.0.3/include in it so I did try prepending that to CPATH before another subsequent run but no luck.

Here is my current env, after sourcing (along with my CPATH prepends):

MANPATH=/home/software/gcc/6.2.0/pkg/openmpi/3.0.4/share/man:/home/software/gcc/6.2.0/share/man:/usr/share/man:/usr/local/share/man
XDG_SESSION_ID=6485
SHELL=/bin/bash
TERM=screen
LIBRARY_PATH=/home/software/gcc/6.2.0/pkg/openmpi/3.0.4/lib:/home/software/gcc/6.2.0/lib64:/home/software/gcc/6.2.0/lib
NCARG_FONTCAPS=/usr/lib64/ncarg/fontcaps
QTDIR=/usr/lib64/qt-3.3   
QTINC=/usr/lib64/qt-3.3/include
QT_GRAPHICSSYSTEM_CHECKED=1
USER=m_ludwig
LD_LIBRARY_PATH=/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/pylith/3.0.3/lib:/home/software/pylith/3.0.3/lib64:/home/software/gcc/6.2.0/pkg/openmpi/3.0.4/lib:/home/software/gcc/6.2.0/lib64:/home/software/gcc/6.2.0/lib
CPATH=/home/software/pylith/3.0.3/include/cppunit/:/home/software/pylith/3.0.3/include/:/home/software/gcc/6.2.0/pkg/openmpi/3.0.4/include:/home/software/gcc/6.2.0/include
NCARG_GRAPHCAPS=/usr/lib64/ncarg/graphcaps
PATH=/home/software/pylith/3.0.3/bin:/home/software/pylith/3.0.3/bin:/home/software/pylith/3.0.3/bin:/home/software/pylith/3.0.3/bin:/home/software/pylith/3.0.3/bin:/home/software/pylith/3.0.3/bin:/home/software/pylith/3.0.3/bin:/home/software/pylith/3.0.3/bin:/home/software/gcc/6.2.0/pkg/openmpi/3.0.4/bin:/home/software/cmake/3.17.3/bin:/home/software/gcc/6.2.0/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/dell/srvadmin/bin:/home/m_ludwig/.local/bin:/home/m_ludwig/bin
MAIL=/var/spool/mail/m_ludwig
STY=8241.pylith_build
PWD=/home/software/pylith/src/pylith-installer-3.0.3-0/build
_LMFILES_=/home/software/modulefiles/gcc/6.2.0:/home/software/modulefiles/cmake/3.17.3:/home/software/gcc/6.2.0/pkg/modulefiles/openmpi/3.0.4
NCARG_ROOT=/usr
LANG=en_US.UTF-8
MODULEPATH=/home/software/gcc/6.2.0/pkg/modulefiles:/home/software/sloan/modulefiles/:/home/software/modulefiles:/cm/shared/modulefiles
NCARG_DATABASE=/usr/lib64/ncarg/database
LOADEDMODULES=gcc/6.2.0:cmake/3.17.3:openmpi/3.0.4
HISTCONTROL=ignoredups
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
NCARG_LIB=/usr/lib64/ncarg
HOME=/home/m_ludwig
SHLVL=2
NCARG_NCARG=/usr/share/ncarg
PYTHONPATH=/home/software/pylith/3.0.3/lib/python3.10/site-packages:/home/software/pylith/3.0.3/lib64/python3.10/site-packages:/home/software/pylith/3.0.3/lib/python3.10/site-packages:/home/software/pylith/3.0.3/lib64/python3.10/site-packages:/home/software/pylith/3.0.3/lib/python3.10/site-packages:/home/software/pylith/3.0.3/lib64/python3.10/site-packages:/home/software/pylith/3.0.3/lib/python3.10/site-packages:/home/software/pylith/3.0.3/lib64/python3.10/site-packages:/home/software/pylith/3.0.3/lib/python3.10/site-packages:/home/software/pylith/3.0.3/lib64/python3.10/site-packages:/home/software/pylith/3.0.3/lib/python3.10/site-packages:/home/software/pylith/3.0.3/lib64/python3.10/site-packages
LOGNAME=m_ludwig
CVS_RSH=ssh
QTLIB=/usr/lib64/qt-3.3/lib
WINDOW=0
XDG_DATA_DIRS=/home/m_ludwig/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
MODULESHOME=/usr/share/Modules
LESSOPEN=||/usr/bin/lesspipe.sh %s
BASH_FUNC_module()=() {  eval `/usr/bin/modulecmd bash $*`
}
_=/bin/printenv

@baagaard-usgs
Copy link
Contributor

I think I know the source of the problem. The error is not that CppUnit is not found, but that there is an error when it is trying to be used; you should be able to verify this in the config.log. CppUnit requires C++11. We have a check in the SpatialData and PyLith configure, but it is missing from the PyLith installer configure (I will fix this in the installer for the next release). The default compiler (gcc 4.8) that comes with CentOS 7 does not support C++11. If you are trying to install PyLith on a cluster, then there is probably a compiler that supports C++11 available along with a corresponding version of MPI. If this is a workstation, then the options are to either (1) update the operating system to something more recent (CentOS 7 was initially released in 2014; rockylinux provides open-source CentOS like images and there are many other options available like Ubuntu, Fedora, etc) that comes with compilers that support C++11 or (2) have the installer build a newer version of gcc (it will install gcc 10). If you have the installer build gcc, then you need to also have it build all of the dependencies; see https://pylith-installer.readthedocs.io/en/latest/configs/centos.html#configure.

@mjbludwig
Copy link
Author

@baagaard-usgs You are right, this is on a cluster that is still on centos7 at the moment. Apologies for not mentioning that.

I have built gcc/6.2.0 along with openmpi/3.0.4 against that gcc and am using that for the build but only have it "loaded" by prepending PATH, CPATH, LD_LIBRARY_PATH and LIBRARY_PATH with the paths to the newer gcc binary, headers and libs. Is it possible part of this build is not picking up that gcc binary (and its deps) from the ENV?

Also, CentOS 7 was shipped with GCC 4.8.5 but I believe GCC 4.8.1 was when C++11 was introduced?

@baagaard-usgs
Copy link
Contributor

Try using CPPPATH instead of CPATH. The config.log contains a lot of useful information about which versions are detected and the symptoms of any failures.

@baagaard-usgs
Copy link
Contributor

Sorry, I meant CPPFLAGS, not CPPPATH, instead of CPATH.

@mjbludwig
Copy link
Author

I think I have passed that previous error but now running into an issue where it looks like -std=gnu11 is getting injected into the various ./configures when building dependencies. Starting from scratch and using https://pylith-installer.readthedocs.io/en/latest/configs/centos.html#operating-system-packages

/bin/mkdir -p sqlite-build
cd sqlite-build && \
        ../sqlite-autoconf-3310100/configure --prefix=/home/software/pylith/3.0.3 \
                --enable-shared CFLAGS="-g -O2" CXXFLAGS="-g -O2 -DMPICH_IGNORE_CXX_SEEK" FCFLAGS="" CC=gcc **-std=gnu11** CXX=g++ \
                CPPFLAGS="-I/home/software/pylith/3.0.3/include " LDFLAGS="-L/home/software/pylith/3.0.3/lib -L/home/software/pylith/3.0.3/lib64 "; \
        make -j 16 && \
        make install && \
        touch /home/software/pylith/src/pylith-installer-3.0.3-0/dependencies/installed_sqlite
configure: error: unrecognized option: `-std=gnu11'
Try `../sqlite-autoconf-3310100/configure --help' for more information

@mjbludwig
Copy link
Author

Well I went into $BUILD_ROOT/dependencies/Makefile and added quotes to CC so its CC = "gcc -std=gnu11" and that seems to have gotten me past that

@baagaard-usgs
Copy link
Contributor

This is fixed in the main branch of the PyLith installer. Note that the main branch also uses newer versions of several of the dependencies. The installer now checks for C++14 but doesn't change CC or CXX.

@mjbludwig
Copy link
Author

mjbludwig commented May 11, 2023

Good to know! I am now able to reproduce an issue where netcdf seems to be breaking. Its complaining about numpy but that is definitely installed in the prefix location?

Collecting http://geoweb.cse.ucdavis.edu/~buildbot/deps/netCDF4-1.5.7.tar.gz
  Downloading http://geoweb.cse.ucdavis.edu/~buildbot/deps/netCDF4-1.5.7.tar.gz (763 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 763.9/763.9 kB 1.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done   
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      Package hdf5 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `hdf5.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'hdf5' found
      reading from setup.cfg...
      using nc-config...
      checking /home/software/pylith/3.0.3/include ...
      HDF5 library version: 1.12.1 headers found in /home/software/pylith/3.0.3/include
      Traceback (most recent call last):
        File "/home/software/pylith/3.0.3/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/software/pylith/3.0.3/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/software/pylith/3.0.3/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-3a9dqpsg/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 380, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-3a9dqpsg/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-3a9dqpsg/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 505, in <module>
      ModuleNotFoundError: No module named 'numpy'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

I can try a build off the main branch if you would like?

@baagaard-usgs
Copy link
Contributor

What happens if you start the Python interpreter (python3) and enter import numpy at the Python prompt? If numpy isn't found, check PYTHONPATH to make sure it matches where numpy is installed. Also check PYTHONPATH in dependencies/Makefile.

@mjbludwig
Copy link
Author

Thought the same thing, sorry for not mentioning it but yeah numpy loads fine when using the python that was build by the install process. My PYTHONPATH in my environment points to the right place as well. I do not see PYTHONPATH being set in the dependencies/Makefile anywhere though?

I did see PYTHON_SITEPKGS and PYTHON64_SITEPKGS though and tried appending the path to the site-packages where numpy lives, but alas no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug General bug
Projects
None yet
Development

No branches or pull requests

2 participants