Installation problem on Ubuntu 22.04.2 LTS, cannot import escriptcpp.so

Asked by yang yu

Dear esys-escript Team:
     I am running into a problem when installing esys-escript (https://github.com/esys-escript/esys-escript.github.io.git) under the environment of Ubuntu 22.04.2 LTS and python 3.10.
     I used the command:
     sudo scons -j4 options_file=scons/LAPTOP-FT9AACDL_options.py
     The code in LAPTOP-FT9AACDL_options.py:
escript_opts_version = 203
openmp = True
boost_libs = ['boost_python310']
pythoncmd = 'python3'
pythonincpath='/usr/include/python3.10'
pythonlibpath='/usr/lib/x86_64-linux-gnu'
pythonlibname='libpython3.10'
#mpi = 'OPENMPI'
mpi_prefix = '/usr/lib/x86_64-linux-gnu/openmpi'
mpi_libs = ['mpi_cxx', 'mpi', 'open-rte', 'open-pal']
netcdf = True
#umfpack = True
umfpack_prefix = ['/usr/include/suitesparse', '/usr/lib']
umfpack_libs = ['umfpack', 'blas', 'amd']
lapack_prefix = ['/usr/include/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu/atlas']

    The first error is: 'samplesR' and 'samplesC' may be used uninitialized.
escriptcore/src/Utils.cpp: In function 'boost::python::numpy::ndarray escript::convertToNumpy(escript::Data)':
escriptcore/src/Utils.cpp:1027:45: error: 'samplesR' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1027 | DataTypes::pointToNumpyArray(dataArray, samplesR,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
 1028 | data.getDataPointShape(), offset, 0, i+j*numsamples);
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
escriptcore/src/Utils.cpp:1024:45: error: 'samplesC' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1024 | DataTypes::pointToNumpyArray(dataArray, samplesC,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
 1025 | data.getDataPointShape(), offset, 0, i+j*numsamples);
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
python3 scripts/py_comp.py escript/py_src/symbolic/__init__.py build/posix/escript/symbolic/__init__.pyc
python3 scripts/py_comp.py escript/py_src/symbolic/evaluator.py build/posix/escript/symbolic/evaluator.pyc
python3 scripts/py_comp.py escript/py_src/symbolic/utils.py build/posix/escript/symbolic/utils.pyc
cc1plus: all warnings being treated as errors
Install file: "build/posix/escript/run_escript.pyc" as "esys/escript/run_escript.pyc"
Compiling build/posix/paso/src/BiCGStab.os
scons: *** [build/posix/escriptcore/src/Utils.os] Error 1
scons: building terminated because of errors.

     So, I modified the code like this:
    // Initialise variables
    const DataTypes::cplx_t* samplesC=(0).
    const DataTypes::real_t* samplesR=0.

    However, I encountered another error:

Install file: "scripts/release_sanity.py" as "build/scripts/release_sanity.py"
/home/aegeansea2125/esys-escript/bin/run-escript /home/aegeansea2125/esys-escript/build/scripts/release_sanity.py
Traceback (most recent call last):
  File "/home/aegeansea2125/esys-escript/build/scripts/release_sanity.py", line 8, in <module>
    from esys.escript import *
  File "escript/py_src/__init__.py", line 74, in <module>
    from esys.escriptcore.escriptcpp import *
ImportError: /home/aegeansea2125/esys-escript/esys/escriptcore/escriptcpp.so: undefined symbol: _ZN5boost6python15instance_holder8allocateEP7_objectmmm
scons: *** [dummy] Error 1
scons: building terminated because of errors.

*** Config Summary (see config.log and <prefix>/lib/buildvars for details) ***
Escript revision
  Install prefix: /home/aegeansea2125/esys-escript
          Python: python3 (Version 3.10.6)
           boost: /usr (Version 1.81.0)
     boost numpy: YES
        trilinos: NO
           numpy: YES (with headers)
            gmsh: YES
            gzip: YES
  Solver library: paso
   Direct solver: NONE
         domains: dudley, finley, ripley, speckley
          netcdf: YES (3)
           weipa: YES
          openmp: YES
          pyproj: YES
           scipy: YES

  DISABLED features: cppunit debug gdal lapack mkl mpi mumps parmetis silo sympy trilinos umfpack visit
  Treating warnings as errors

How can I fix this issue?

Thanks, before,

Yang Yu

Question information

Language:
English Edit question
Status:
Solved
For:
esys-escript Edit question
Assignee:
No assignee Edit question
Solved by:
yang yu
Solved:
Last query:
Last reply:
Revision history for this message
Adam Ellery (aellery) said :
#1

Hi Yang,

You should be able to resolve the error by passing the argument

werror=0

I.e. by running

sudo scons -j4 options_file=scons/LAPTOP-FT9AACDL_options.py werror=0

Best regards,

Adam

Revision history for this message
yang yu (aegeansea2125) said (last edit ):
#2

Hi Adam,
Thanks for replying to my question.
I tried the command that you suggested, but got the same error:
I also tried to rebuild the boost, but it didn't work too.

Linking build/posix/weipa/src/libescriptreader.so
Install file: "build/posix/weipa/src/libescriptreader.so" as "lib/libescriptreader.so"
/home/aegeansea2125/esys-escript/bin/run-escript /home/aegeansea2125/esys-escript/build/scripts/release_sanity.py
Traceback (most recent call last):
  File "/home/aegeansea2125/esys-escript/build/scripts/release_sanity.py", line 8, in <module>
    from esys.escript import *
  File "escript/py_src/__init__.py", line 74, in <module>
    from esys.escriptcore.escriptcpp import *
ImportError: /home/aegeansea2125/esys-escript/esys/escriptcore/escriptcpp.so: undefined symbol: _ZN5boost6python15instance_holder8allocateEP7_objectmmm
scons: *** [dummy] Error 1
scons: building terminated because of errors.

*** Config Summary (see config.log and <prefix>/lib/buildvars for details) ***
Escript revision
  Install prefix: /home/aegeansea2125/esys-escript
          Python: python3 (Version 3.10.6)
           boost: ['/usr/include', '/usr/lib'] (Version 1.81.0)
     boost numpy: YES
        trilinos: NO
           numpy: YES (with headers)
            gmsh: YES
            gzip: YES
  Solver library: paso
   Direct solver: NONE
         domains: dudley, finley, ripley, speckley
          netcdf: YES (3)
           weipa: YES
          openmp: YES
          pyproj: YES
           scipy: YES

  DISABLED features: cppunit debug gdal lapack mkl mpi mumps parmetis silo sympy trilinos umfpack visit
  NOT treating warnings as errors

WARNING: Cannot import gdal. Inversions will not honour WKT coordinate system information.
WARNING: Cannot import sympy. Symbolic toolbox and nonlinear PDEs will not be available.

ERROR: build stopped due to errors

I still don't know why it appeared.

Best regards,

Yang Yu

Revision history for this message
Adam Ellery (aellery) said :
#3

Hi Yang,

I'm currently trying to replicate the bug on my machine. How did you upgrade your Ubuntu installation to Python 3.10? Did you use the deadsnakes/ppa repository or manually install it?

Adam

Revision history for this message
yang yu (aegeansea2125) said :
#4

Hi Adam,
I probably used the Python built-in with Ubuntu and updated it with the apt-get command.

Best regards,

Yang Yu

Revision history for this message
yang yu (aegeansea2125) said (last edit ):
#5

Hi Adam,

Based on the error code as"_ZN5boost6python15instance_holder8allocateEP7_objectmmm", I extracted the keyword as "boost::python::instance_holder-allocate_object", so I installed another version of boost, and the problem was solved.

Thank you again for your help.

Best regards,

Yang Yu