These are chat archives for symengine/symengine

27th
Jul 2015
Shivam Vats
@shivamvats
Jul 27 2015 12:54

I am getting the following linking error in master in the debug mode. It links fine in Release mode:

Linking CXX executable add1
CMakeFiles/add1.dir/add1.cpp.o: In function `main':
/home/aries/foss/symengine/benchmarks/add1.cpp:37: undefined reference to `SymEngine::pow(Teuchos::RCP<SymEngine::Basic const> const&, Teuchos::RCP<SymEngine::Basic const> const&)'
/home/aries/foss/symengine/benchmarks/add1.cpp:37: undefined reference to `SymEngine::mul(Teuchos::RCP<SymEngine::Basic const> const&, Teuchos::RCP<SymEngine::Basic const> const&)'
/home/aries/foss/symengine/benchmarks/add1.cpp:37: undefined reference to `SymEngine::add(Teuchos::RCP<SymEngine::Basic const> const&, Teuchos::RCP<SymEngine::Basic const> const&)'
/home/aries/foss/symengine/benchmarks/add1.cpp:38: undefined reference to `SymEngine::mul(Teuchos::RCP<SymEngine::Basic const> const&, Teuchos::RCP<SymEngine::Basic const> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [benchmarks/add1] Error 1
make[1]: *** [benchmarks/CMakeFiles/add1.dir/all] Error 2
make: *** [all] Error 2

My cmake settings are:

-- Found MPFR: /usr/lib/x86_64-linux-gnu/libpthread.so  
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   date_time
--   filesystem
--   system
-- Found MPFR: /usr/local/lib/libmpfr.so  
-- Python version: 2.7
-- Python install path: /usr/lib/python2.7/dist-packages
-- Found CYTHON: /usr/local/bin/cython
Copying source of python wrappers into: /home/aries/foss/symengine/build/symengine/python/symengine
--------------------------------------------------------------------------------

+-------------------------------+
| Configuration results SUMMARY |
+-------------------------------+

CMAKE_C_COMPILER:   /usr/bin/cc
CMAKE_CXX_COMPILER: /usr/bin/c++
CMAKE_BUILD_TYPE: Debug
CMAKE_CONFIGURATION_TYPES: 
CMAKE_CXX_FLAGS_DEBUG:   -std=c++0x -Wall -Wextra -fPIC -g -Wno-unused-parameter -ggdb
CMAKE_CXX_FLAGS_RELEASE: -std=c++0x -Wall -Wextra -fPIC -O3 -march=native -ffast-math -funroll-loops -Wno-unused-parameter -DNDEBUG
CMAKE_INSTALL_PREFIX: /usr/local
WITH_SYMENGINE_ASSERT: yes
WITH_SYMENGINE_RCP: no
HAVE_TEUCHOS_DEBUG: yes
HAVE_TEUCHOS_DEBUG_RCP_NODE_TRACING: yes
HAVE_GCC_ABI_DEMANGLE: yes
HAVE_C_FUNCTION_NOT_FUNC: no
HAVE_DEFAULT_CONSTRUCTORS: yes
HAVE_SYMENGINE_NOEXCEPT: yes
HAVE_SYMENGINE_IS_CONSTRUCTIBLE: yes
HAVE_SYMENGINE_RESERVE: yes
WITH_SYMENGINE_THREAD_SAFE: no
BUILD_TESTS: yes
BUILD_BENCHMARKS: yes
GMP_INCLUDE_DIRS: /usr/include
GMP_LIBRARIES: /usr/lib/x86_64-linux-gnu/libgmpxx.so;/usr/lib/x86_64-linux-gnu/libgmp.so
WITH_BFD: no
WITH_PYTHON: yes
PYTHON_LIBRARY: /usr/lib/x86_64-linux-gnu/libpython2.7.so
PYTHON_INCLUDE_PATH: /usr/include/python2.7
PYTHON_INSTALL_PATH: /usr/lib/python2.7/dist-packages
Cython path: /usr/local/bin/cython
WITH_RUBY: no
WITH_ECM: no
WITH_PRIMESIEVE: no
WITH_ARB: no
WITH_MPFR: yes
MPFR_INCLUDE_DIRS: /usr/local/include
MPFR_LIBRARIES: /usr/local/lib/libmpfr.so
WITH_PIRANHA: yes
PIRANHA_INCLUDE_DIRS: /home/aries/foss/piranha/src
WITH_BOOST: yes
BOOST_INCLUDE_DIRS: /usr/include
BOOST_LIBRARIES: /usr/lib/x86_64-linux-gnu/libboost_date_time.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/usr/lib/x86_64-linux-gnu/libboost_system.so
WITH_PTHREAD: yes
PTHREAD_INCLUDE_DIRS: /usr/include
PTHREAD_LIBRARIES: /usr/lib/x86_64-linux-gnu/libpthread.so
WITH_MPC: no
WITH_TCMALLOC: no
WITH_OPENMP: no
Isuru Fernando
@isuruf
Jul 27 2015 13:01
Are you sure you are using the master branch?
First line is Found MPFR: /usr/lib/x86_64-linux-gnu/libpthread.so which is weird
Shivam Vats
@shivamvats
Jul 27 2015 13:10
Yes, I am using master.
It seems to find mpfr twice.
Francesco Biscani
@bluescarni
Jul 27 2015 14:23
@isuruf are you linking in the Boost libraries because of Piranha or do you need them somewhere else as well?
Isuru Fernando
@isuruf
Jul 27 2015 14:24
It's only for Piranha
Btw, Piranha and SymEngine both need to have a ProjectConfig.cmake file for other cmake projects to use.
Francesco Biscani
@bluescarni
Jul 27 2015 14:26
you can remove them then. Piranha uses header-only boost libraries only, apart from one special case which I think is of no interest to symengine (serialization)
the boost linking is needed only for running the test suite
Isuru Fernando
@isuruf
Jul 27 2015 14:27
@shivamvats can you post benchmarks/CMakeFiles/add1.dir/link.txt?
Francesco Biscani
@bluescarni
Jul 27 2015 14:28
I never looked into using existing cmake project files into other projects, looks intriguing
I did not even know it was possible actually
Isuru Fernando
@isuruf
Jul 27 2015 14:33
If we do that, then another project using SymEngine just have to do find_package(symengine HINTS hint) and it will find and give include dirs and library dirs for all the dependencies of symengine and symengine
Arafat
@Arafatk
Jul 27 2015 15:16
Hi! I am new here ! I want to contribute to your project . Is their anyone who could guide me ? If i am at the wrong place, can you please tell me where i should go ?
Shivam Vats
@shivamvats
Jul 27 2015 15:23
@isuruf
/usr/bin/c++   -std=c++0x -Wall -Wextra -fPIC -O3 -march=native -ffast-math 
-funroll-loops -Wno-unused-parameter -DNDEBUG    CMakeFiles/add1.dir
/add1.cpp.o  -o add1 -rdynamic ../symengine/libsymengine.a ../symengine/teuchos
/libteuchos.a -lgmpxx -lgmp -lpthread -lboost_date_time -lboost_filesystem 
-lboost_system /usr/local/lib/libmpfr.so -Wl,-rpath,/usr/local/lib
Isuru Fernando
@isuruf
Jul 27 2015 15:39
mpfr is the problem.
Try this
diff --git a/cmake/FindPTHREAD.cmake b/cmake/FindPTHREAD.cmake
index d92de21..207d84b 100644
--- a/cmake/FindPTHREAD.cmake
+++ b/cmake/FindPTHREAD.cmake
@@ -7,7 +7,7 @@ set(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
 set(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})

 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(MPFR DEFAULT_MSG PTHREAD_LIBRARIES
+find_package_handle_standard_args(PTHREAD DEFAULT_MSG PTHREAD_LIBRARIES
     PTHREAD_INCLUDE_DIRS)

 mark_as_advanced(PTHREAD_INCLUDE_DIR PTHEARD_LIBRARY)
Francesco Biscani
@bluescarni
Jul 27 2015 15:40
do you really need to explicitly look for pthreads? In Piranha I am using the CMake macro FindThreads http://www.cmake.org/cmake/help/v3.0/module/FindThreads.html
Isuru Fernando
@isuruf
Jul 27 2015 15:47
Is it available in v2.8?
Francesco Biscani
@bluescarni
Jul 27 2015 15:48
I do think so, I have been using it for a long time
so, in theory in C++11 you just have std::thread and you don't care too much about the internal implementation of the threading stuff
this is highly platform/compiler dependent though, so it's difficult to get a general guideline
sorry gitter is really messed up at the moment for me, all the messages appear in the wrong order
there's some GCC-specific info here
you might have to enable compiler switches and/or link to platform specific libraries
Shivam Vats
@shivamvats
Jul 27 2015 21:15
@isuruf Though the first line in cmake is gone, I am still getting the same errors.
02:37:59 {master} ~/foss/symengine/build$ cmake .
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   date_time
--   filesystem
--   system
-- Python version: 2.7
-- Python install path: /usr/lib/python2.7/dist-packages
-- Found CYTHON: /usr/local/bin/cython
Copying source of python wrappers into: /home/aries/foss/symengine/build/symengine/python/symengine
--------------------------------------------------------------------------------

+-------------------------------+
| Configuration results SUMMARY |
+-------------------------------+

CMAKE_C_COMPILER:   /usr/bin/cc
CMAKE_CXX_COMPILER: /usr/bin/c++
CMAKE_BUILD_TYPE: Debug
CMAKE_CONFIGURATION_TYPES: 
CMAKE_CXX_FLAGS_DEBUG:   -std=c++0x -Wall -Wextra -fPIC -g -Wno-unused-parameter -ggdb
CMAKE_CXX_FLAGS_RELEASE: -std=c++0x -Wall -Wextra -fPIC -O3 -march=native -ffast-math -funroll-loops -Wno-unused-parameter -DNDEBUG
CMAKE_INSTALL_PREFIX: /usr/local
WITH_SYMENGINE_ASSERT: yes
WITH_SYMENGINE_RCP: no
HAVE_TEUCHOS_DEBUG: yes
HAVE_TEUCHOS_DEBUG_RCP_NODE_TRACING: yes
HAVE_GCC_ABI_DEMANGLE: yes
HAVE_C_FUNCTION_NOT_FUNC: no
HAVE_DEFAULT_CONSTRUCTORS: yes
HAVE_SYMENGINE_NOEXCEPT: yes
HAVE_SYMENGINE_IS_CONSTRUCTIBLE: yes
HAVE_SYMENGINE_RESERVE: yes
WITH_SYMENGINE_THREAD_SAFE: no
BUILD_TESTS: yes
BUILD_BENCHMARKS: yes
GMP_INCLUDE_DIRS: /usr/include
GMP_LIBRARIES: /usr/lib/x86_64-linux-gnu/libgmpxx.so;/usr/lib/x86_64-linux-gnu/libgmp.so
WITH_BFD: no
WITH_PYTHON: yes
PYTHON_LIBRARY: /usr/lib/x86_64-linux-gnu/libpython2.7.so
PYTHON_INCLUDE_PATH: /usr/include/python2.7
PYTHON_INSTALL_PATH: /usr/lib/python2.7/dist-packages
Cython path: /usr/local/bin/cython
WITH_RUBY: no
WITH_ECM: no
WITH_PRIMESIEVE: no
WITH_ARB: OFF
WITH_MPFR: yes
MPFR_INCLUDE_DIRS: /usr/local/include
MPFR_LIBRARIES: /usr/local/lib/libmpfr.so
WITH_PIRANHA: yes
PIRANHA_INCLUDE_DIRS: /home/aries/foss/piranha/src
WITH_BOOST: yes
BOOST_INCLUDE_DIRS: /usr/include
BOOST_LIBRARIES: /usr/lib/x86_64-linux-gnu/libboost_date_time.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/usr/lib/x86_64-linux-gnu/libboost_system.so
WITH_PTHREAD: yes
PTHREAD_INCLUDE_DIRS: /usr/include
PTHREAD_LIBRARIES: /usr/lib/x86_64-linux-gnu/libpthread.so
WITH_MPC: no
WITH_TCMALLOC: no
WITH_OPENMP: no

--------------------------------------------------------------------------------

-- Configuring done
-- Generating done
-- Build files have been written to: /home/aries/foss/symengine/build