Closed wdtcjy closed 6 years ago
Every test which involves Python segfaulted. Although I cannot say much without more details, if I need to guess I would say that CRPropa is compiled with different version of Python headers compared to the version of python binary which is used to run tests. That would definitely lead to segfault. Do you have multiple Python packages installed on your system? If you do, maybe you should explicitly specify paths and override CMake's automatic detection.
Also, try to run examples manually to get more details (or look for the test logs), e.g.
python test/python/testBoundaries.py
@adundovi Thank you! What other details you need? I attached the result of CMAKE below. What command should I use to specify the path in of python in CMAKE?
(crpropa)client-75-102-115-89:build Jiang$ CMAKE_PREFIX_PATH=$CRPROPA_DIR cmake -DCMAKE_INSTALL_PREFIX=$CRPROPA_DIR ..
-- The Fortran compiler identification is GNU 6.2.0
-- The C compiler identification is AppleClang 7.3.0.7030031
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Check for working Fortran compiler: /usr/local/bin/gfortran
-- Check for working Fortran compiler: /usr/local/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/local/bin/gfortran supports Fortran 90
-- Checking whether /usr/local/bin/gfortran supports Fortran 90 -- yes
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build Type: Release
-- CRPropa version: HEAD-HASH-NOTFOUND GITDIR-NOTFOUND GITDIR-NOTFOUND
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
Using provided EIGEN
-- Try OpenMP C flag = [-fopenmp=libomp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-fopenmp=libomp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP Fortran flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Could NOT find OpenMP (missing: OpenMP_C_FLAGS OpenMP_CXX_FLAGS)
-- Google perftools: Found!
-- Include: /usr/local/include
-- FFTW3 with single precision (FFTW3F): Found!
-- Include: /usr/local/include
-- Library: /usr/local/lib/libfftw3f.dylib
-- Quimby: NOT Found!
-- Include: QUIMBY_INCLUDE_DIR-NOTFOUND
-- Library: QUIMBY_LIBRARY-NOTFOUND
-- SAGA: NOT Found!
-- Include: SAGA_INCLUDE_DIR-NOTFOUND
-- Library: SAGA_LIBRARY-NOTFOUND
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.1")
-- muParser: Found!
-- Include: /usr/local/Cellar/muparser/2.2.5/include
-- Library: /usr/local/Cellar/muparser/2.2.5/lib/libmuparser.dylib
-- Found ZLIB: /usr/local/lib/libz.dylib (found version "1.2.8")
-- Use absolute RPATH /Users/Jiang/.virtualenvs/crpropa/lib
-- Downloading data file from crpropa.desy.de ~ 50 MB
-- Extracting data file
-- Found PythonInterp: /Users/Jiang/.virtualenvs/crpropa/bin/python (found version "2.7.10")
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.10")
-- Found SWIG: /usr/local/bin/swig (found version "3.0.10")
-- Using user provided Python library: /usr/lib/libpython2.7.dylib
-- Python: Found!
-- Version: 2.7/27
-- Executeable: /Users/Jiang/.virtualenvs/crpropa/bin/python
-- Include: /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-- Library: /usr/lib/libpython2.7.dylib
-- Site-package directory: /Users/Jiang/.virtualenvs/crpropa/lib/python2.7/site-packages
-- Found numpy headers in /Users/Jiang/.virtualenvs/crpropa/lib/python2.7/site-packages/numpy/core/include
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Jiang/CRPropa3-masterNew7/build
When installing CRPropa on Mac the preinstalled Xcode compilers might interfere with the process. Compare
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
As a workaround, we installed gfortran, gcc and g++ (mp-6) manually via MacPorts, although other package managers should work as well. Afterwards some parameters in CCMake need to be changed. Namely:
CMAKE_CXX_COMPILER -> /opt/local/bin/g++-mp-6
CMAKE_C_COMPILER -> /opt/local/bin/gcc-mp-6
CMAKE_Fortran_COMPILER-> /opt/local/bin/gfortran-mp-6
Additionally you want to set CMAKE_INSTALL_PREFIX
to the path of you virtual environment if you use one.
Thank you @scaramangado for sharing this info.
@wdtcjy, could you please try to compile it with the different set of compilers suggested by @scaramangado - if it will not work, then I would go into debugging for which I would proceed in the following way:
$CRPROPA_DIR cmake -DCMAKE_INSTALL_PREFIX=$CRPROPA_DIR -DCMAKE_BUILD_TYPE:STRING=Debug ..
gdb --args python test/python/testBoundaries.py
(typing run
inside gdb will run the python).
That should reveal where is the cause of the segfault.
I assume this is fixed by now, please reopen the bug if not.
After I install the CRpropa(Mac OS 10.11.5 Python 2.7.10), I try to import it in python. I keep getting error message "Segmentation fault: 11" and the python quit automatically afterwards. Can anyone help me with that? I used make test to see what is wrong, and the result are as follows, Running tests... Test project /Users/Jiang/CRPropa3-masterNew7/build Start 1: testCore 1/37 Test #1: testCore ................................. Passed 0.03 sec Start 2: testVector3 2/37 Test #2: testVector3 .............................. Passed 0.02 sec Start 3: testModuleList 3/37 Test #3: testModuleList ........................... Passed 0.02 sec Start 4: testMagneticField 4/37 Test #4: testMagneticField ........................ Passed 0.15 sec Start 5: testDINT 5/37 Test #5: testDINT ................................. Passed 0.03 sec Start 6: testPropagation 6/37 Test #6: testPropagation .......................... Passed 0.03 sec Start 7: testBreakCondition 7/37 Test #7: testBreakCondition ....................... Passed 0.07 sec Start 8: testInteraction 8/37 Test #8: testInteraction .......................... Passed 30.24 sec Start 9: testSource 9/37 Test #9: testSource ............................... Passed 0.05 sec Start 10: testOutput 10/37 Test #10: testOutput ............................... Passed 0.02 sec Start 11: testGalacticMagneticLens 11/37 Test #11: testGalacticMagneticLens ................. Passed 0.09 sec Start 12: testMagneticLensPythonInterface 12/37 Test #12: testMagneticLensPythonInterface ..........Exception: SegFault 0.31 sec Start 13: testSimulationExecution 13/37 Test #13: testSimulationExecution ..................Exception: SegFault 0.12 sec Start 14: testPythonBoundaries 14/37 Test #14: testPythonBoundaries .....................Exception: SegFault 0.49 sec Start 15: testPythonCosmology 15/37 Test #15: testPythonCosmology ......................Exception: SegFault 0.32 sec Start 16: testPythonElectronPairProduction 16/37 Test #16: testPythonElectronPairProduction .........Exception: SegFault 0.30 sec Start 17: testPythonEnergyLossLength 17/37 Test #17: testPythonEnergyLossLength ...............Exception: SegFault 0.26 sec Start 18: testPythonJF12Field 18/37 Test #18: testPythonJF12Field ......................Exception: SegFault 0.30 sec Start 19: testPythonNuclearDecay 19/37 Test #19: testPythonNuclearDecay ...................Exception: SegFault 0.27 sec Start 20: testPythonNuclearMass 20/37 Test #20: testPythonNuclearMass ....................Exception: SegFault 0.31 sec Start 21: testPythonPhotoPionProduction_pnRatio 21/37 Test #21: testPythonPhotoPionProduction_pnRatio ....Exception: SegFault 0.31 sec Start 22: testPythonPropagationCK 22/37 Test #22: testPythonPropagationCK ..................Exception: SegFault 0.31 sec Start 23: testPythonPshirkovField 23/37 Test #23: testPythonPshirkovField ..................Exception: SegFault 0.27 sec Start 24: testPythonSourceComposition 24/37 Test #24: testPythonSourceComposition ..............Exception: SegFault 0.31 sec Start 25: testPythonTools 25/37 Test #25: testPythonTools ..........................Exception: SegFault 0.09 sec Start 26: testPythonTurbulentGrid 26/37 Test #26: testPythonTurbulentGrid ..................***Exception: SegFault 0.29 sec Start 27: testXML1D_discreteSource 27/37 Test #27: testXML1D_discreteSource ................. Passed 0.02 sec Start 28: testXML1D 28/37 Test #28: testXML1D ................................ Passed 0.12 sec Start 29: testXML3D_continuousHomogeneousSources 29/37 Test #29: testXML3D_continuousHomogeneousSources ... Passed 4.98 sec Start 30: testXML3D_discreteHomogeneousSources 30/37 Test #30: testXML3D_discreteHomogeneousSources ..... Passed 4.89 sec Start 31: testXML3D_kolmogorovBfield 31/37 Test #31: testXML3D_kolmogorovBfield ............... Passed 5.57 sec Start 32: testXML3D_noBfield 32/37 Test #32: testXML3D_noBfield ....................... Passed 0.06 sec Start 33: testXML3D_uniformBfield 33/37 Test #33: testXML3D_uniformBfield .................. Passed 2.12 sec Start 34: testXMLCRPropa2EventOutput1D 34/37 Test #34: testXMLCRPropa2EventOutput1D ............. Passed 0.02 sec Start 35: testXMLCRPropa2EventOutput3D 35/37 Test #35: testXMLCRPropa2EventOutput3D ............. Passed 0.02 sec Start 36: testXMLCRPropa2TrajectoryOutput1D 36/37 Test #36: testXMLCRPropa2TrajectoryOutput1D ........ Passed 0.02 sec Start 37: testXMLCRPropa2TrajectoryOutput3D 37/37 Test #37: testXMLCRPropa2TrajectoryOutput3D ........ Passed 0.02 sec
59% tests passed, 15 tests failed out of 37
Total Test time (real) = 52.86 sec
The following tests FAILED: 12 - testMagneticLensPythonInterface (SEGFAULT) 13 - testSimulationExecution (SEGFAULT) 14 - testPythonBoundaries (SEGFAULT) 15 - testPythonCosmology (SEGFAULT) 16 - testPythonElectronPairProduction (SEGFAULT) 17 - testPythonEnergyLossLength (SEGFAULT) 18 - testPythonJF12Field (SEGFAULT) 19 - testPythonNuclearDecay (SEGFAULT) 20 - testPythonNuclearMass (SEGFAULT) 21 - testPythonPhotoPionProduction_pnRatio (SEGFAULT) 22 - testPythonPropagationCK (SEGFAULT) 23 - testPythonPshirkovField (SEGFAULT) 24 - testPythonSourceComposition (SEGFAULT) 25 - testPythonTools (SEGFAULT) 26 - testPythonTurbulentGrid (SEGFAULT) Errors while running CTest make: *** [test] Error 8