You are not logged in.

#1 2013-08-07 10:25:44

aquarius
Member
Registered: 2013-08-07
Posts: 2

CMake behaves differently from within PKGBUILD and from command line

Hi,
I am currently struggling with an issue which I cannot find a solution. The problem is, I am trying to create a PKGBUILD for the CasADi code. The following is the PKGBUILD file written. My problem is the cmake configuration part. When the code is configured from the command line, without PKGBUILD, camke detects the -fopenmp flag for C and C++ compilers. For exactly the same compilers, cmake detects openmp for C compiler but fails to do so for the C++ compiler, when configuration is done from within the PKGBUILD file using makepkg.
My question is, why different behaviors? Any suggestions on what is wrong?

pkgname=casadi-git
pkgver=0
pkgrel=1
pkgdesc="A symbolic framework for automatic differentiation and numeric optimization"
arch=('i686' 'x86_64')
url=""
license=('GPL')
groups=()
depends=('sundials' 'ipopt' 'blas' 'lapack' 'python2')
makedepends=('cmake' 'swig')
checkdepends=()
optdepends=()
provides=('casadi')
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=('casadi::git+https://github.com/casadi/casadi.git')
md5sums='SKIP'

build() {
        cd "$srcdir/casadi"
        sed -i 's/PythonLibs/PythonLibs 2.7/g' ./cmake_modules/FindNUMPY.cmake ./swig/CMakeLists.txt
        cmake . -DCMAKE_INSTALL_PREFIX=/usr \
                      -DPYTHON_EXECUTABLE=/usr/bin/python2 \
                      -DWITH_DL:BOOL=ON \
                      -DWITH_LLVM:BOOL=OFF \
                      -DWITH_PYTHON_INTERRUPTS:BOOL=ON \
                      -DWITH_OPENMP:BOOL=ON \
                      -DWITH_OOQP:BOOL=ON \
                      -DWITH_DOC:BOOL=ON \
                      -DWITH_OPENCL:BOOL=OFF

        make
}

package() {
       cd "$srcdir/casadi"
       make DESTDIR="$pkgdir/" install
}

Output when cmake is run from command line

-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/colorgcc
-- Check for working C compiler: /usr/bin/colorgcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The Fortran compiler identification is GNU
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Flag needed for enabling C++11 features: -std=gnu++11
-- x86_64 architecture detected - setting flag -fPIC
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp  
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.9.1") 
-- A library with BLAS API found.
-- Looking for Fortran cheev
-- Looking for Fortran cheev - found
-- A library with LAPACK API found.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- checking for one of the modules 'ipopt'
-- Detected an IPOPT configuration without development headers. Build will proceed, but without callback functionality. To enable it, see https://github.com/casadi/casadi/wiki/enableIpoptCallback
-- Detected an IPOPT configuration without sIPOPT headers. Build will proceed, but without sIPOPT functionality.
-- Found IPOPT: ipopt;lapack;blas;m;dl;coinmumps;pthread;blas;gfortran;m;gcc_s;quadmath;coinmetis  
-- Could not find KNITRO include dir
-- Could not find KNITRO library
-- Could not find CPLEX include dir
-- Could not find CPLEX libraries
-- Could not find MA57
-- MA57 libraries not found. Falling back to MA27
-- Could not find MA27
-- Could not find OOQP include dir
-- Could not find SNOPT include dir
-- Found Snopt libs: /usr/lib64/libf2c.a;/usr/lib64/liblapack.so;/usr/lib64/libblas.so;dl
-- Could not find MATLAB include dir
-- Could not find Matlab libs
-- Could not find SNOPT include dir
-- Found Snopt libs: /usr/lib64/libf2c.a;/usr/lib64/liblapack.so;/usr/lib64/libblas.so;dl
-- Could not find MATLAB include dir
-- Could not find Matlab libs
-- Found SWIG: /usr/bin/swig (found version "2.0.10") 
-- Found PythonLibs: /usr/lib64/libpython2.7.so (found suitable version "2.7.5", minimum required is "2.7") 
-- Python executable is /home/hamid/bin/python
-- numpy.get_include() is /usr/lib/python2.7/site-packages/numpy/core/include
-- Numpy path found: /usr/include/python2.7/numpy
-- Python libs: /usr/lib64/libpython2.7.so
-- Numpy includes: /usr/include/python2.7/numpy;/usr/include
-- Numpy libs: /usr/lib64/python2.7/site-packages/numpy/core/multiarray.so
-- Found PythonInterp: /home/hamid/bin/python (found version "2.7.5") 
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.4") 
-- Found DOXYFILE_IN: /usr/src/AUR/build/casadi/src/casadi/documentation/api-doc/Doxyfile.in  
-- pyreport not found -- try 'easy_install pyreport' 
-- 
-- The following features have been enabled:

 * dynamic-loading , Compile with support for dynamic loading of generated functions (needed for ExternalFunction)
 * using-c++11 , Using C++11 features (improves efficiency and is required for some examples).
 * sundials-interface , Interface to the ODE/DAE integrator suite SUNDIALS.
 * csparse-interface , Interface to the sparse direct linear solver CSparse.
 * lapack-interface , Interface to LAPACK.
 * ipopt-interface , Interface to the NLP solver Ipopt.
 * qpoases-interface , Interface to the active-set QP solver qpOASES.
 * dsdp-interface , Interface to the interior point SDP solver DSDP (requires BLAS and LAPACK).

-- The following OPTIONAL packages have been found:

 * OpenMP
 * LibXml2
 * BLAS
 * Threads
 * LAPACK
 * PkgConfig
 * IPOPT
 * SWIG
 * NUMPY
 * PythonInterp
 * Doxygen

-- The following features have been disabled:

 * just-in-time , Just-in-time compiliation via the LLVM compiler framework.
 * opencl-support , Enable just-in-time compiliation to CPUs and GPUs with OpenCL.
 * get-ipopt , Download and build Ipopt.
 * knitro-interface , Interface to the NLP solver KNITRO.
 * cplex-interface , Interface to the QP solver CPLEX.
 * ooqp-interface , Interface to the QP solver OOQP (requires BLAS).
 * worhp-inteface , Interface to the NLP solver Worhp (requires LibXml2 headers).

-- The following OPTIONAL packages have not been found:

 * KNITRO
 * CPLEX
 * MA57
 * MA27
 * OOQP
 * MATLAB
 * OCTAVE
 * LATEX
 * PYREPORT

-- Configuring done
-- Generating done

Output when running makepkg

-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/colorgcc
-- Check for working C compiler: /usr/bin/colorgcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The Fortran compiler identification is GNU
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Flag needed for enabling C++11 features: -std=gnu++11
-- x86_64 architecture detected - setting flag -fPIC
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- 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 = [ ]
-- 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
-- Could NOT find OpenMP (missing:  OpenMP_CXX_FLAGS) 
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.9.1") 
-- A library with BLAS API found.
-- Looking for Fortran cheev
-- Looking for Fortran cheev - found
-- A library with LAPACK API found.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- checking for one of the modules 'ipopt'
-- Detected an IPOPT configuration without development headers. Build will proceed, but without callback functionality. To enable it, see https://github.com/casadi/casadi/wiki/enableIpoptCallback
-- Detected an IPOPT configuration without sIPOPT headers. Build will proceed, but without sIPOPT functionality.
-- Found IPOPT: ipopt;lapack;blas;m;dl;coinmumps;pthread;blas;gfortran;m;gcc_s;quadmath;coinmetis  
-- Could not find KNITRO include dir
-- Could not find KNITRO library
-- Could not find CPLEX include dir
-- Could not find CPLEX libraries
-- Could not find MA57
-- MA57 libraries not found. Falling back to MA27
-- Could not find MA27
-- Could not find OOQP include dir
-- Could not find SNOPT include dir
-- Found Snopt libs: /usr/lib64/libf2c.a;-lpthread;/usr/lib64/liblapack.so;/usr/lib64/libblas.so;dl
-- Could not find MATLAB include dir
-- Could not find Matlab libs
-- Could not find SNOPT include dir
-- Found Snopt libs: /usr/lib64/libf2c.a;-lpthread;/usr/lib64/liblapack.so;/usr/lib64/libblas.so;dl
-- Could not find MATLAB include dir
-- Could not find Matlab libs
-- Found SWIG: /usr/bin/swig (found version "2.0.10") 
-- Found PythonLibs: /usr/lib64/libpython2.7.so (found suitable version "2.7.5", minimum required is "2.7") 
-- Python executable is /usr/bin/python2
-- numpy.get_include() is /usr/lib/python2.7/site-packages/numpy/core/include
-- Numpy path found: /usr/include/python2.7/numpy
-- Python libs: /usr/lib64/libpython2.7.so
-- Numpy includes: /usr/include/python2.7/numpy;/usr/include
-- Numpy libs: /usr/lib64/python2.7/site-packages/numpy/core/multiarray.so
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.5") 
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.4") 
-- Found DOXYFILE_IN: /usr/src/AUR/build/casadi/src/casadi/documentation/api-doc/Doxyfile.in  
-- pyreport not found -- try 'easy_install pyreport' 
-- 
-- The following features have been enabled:

 * dynamic-loading , Compile with support for dynamic loading of generated functions (needed for ExternalFunction)
 * using-c++11 , Using C++11 features (improves efficiency and is required for some examples).
 * sundials-interface , Interface to the ODE/DAE integrator suite SUNDIALS.
 * csparse-interface , Interface to the sparse direct linear solver CSparse.
 * lapack-interface , Interface to LAPACK.
 * ipopt-interface , Interface to the NLP solver Ipopt.
 * qpoases-interface , Interface to the active-set QP solver qpOASES.
 * dsdp-interface , Interface to the interior point SDP solver DSDP (requires BLAS and LAPACK).

-- The following OPTIONAL packages have been found:

 * LibXml2
 * BLAS
 * Threads
 * LAPACK
 * PkgConfig
 * IPOPT
 * SWIG
 * NUMPY
 * PythonInterp
 * Doxygen

-- The following features have been disabled:

 * just-in-time , Just-in-time compiliation via the LLVM compiler framework.
 * opencl-support , Enable just-in-time compiliation to CPUs and GPUs with OpenCL.
 * get-ipopt , Download and build Ipopt.
 * knitro-interface , Interface to the NLP solver KNITRO.
 * cplex-interface , Interface to the QP solver CPLEX.
 * ooqp-interface , Interface to the QP solver OOQP (requires BLAS).
 * worhp-inteface , Interface to the NLP solver Worhp (requires LibXml2 headers).

-- The following OPTIONAL packages have not been found:

 * OpenMP
 * KNITRO
 * CPLEX
 * MA57
 * MA27
 * OOQP
 * MATLAB
 * OCTAVE
 * LATEX
 * PYREPORT

-- Configuring done
-- Generating done

Offline

Board footer

Powered by FluxBB