LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-22-2015, 05:46 AM   #1
Mikibelavista
LQ Newbie
 
Registered: Mar 2015
Posts: 20

Rep: Reputation: Disabled
Problem with building c++ code with cmake


I have downloaded code from:
https://github.com/pthimon/clustering
I have followed the instructions from readme.md file.
You will need the Eigen2 library (libeigen2-devel) and CMake (only tested under Linux).

$ mkdir release
$ cd release
$ cmake ../
$ make
The cmake:
cmake_minimum_required (VERSION 2.6)
project (clustering)

IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(LIB_SUFFIX "")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(LIB_SUFFIX 64)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")

find_package(Eigen2 REQUIRED)
include_directories(${Eigen2_INCLUDE_DIR})

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)

if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(LIB_NAME clusteringd)
else(CMAKE_BUILD_TYPE MATCHES "Debug")
set(LIB_NAME clustering)
endif(CMAKE_BUILD_TYPE MATCHES "Debug")

file(GLOB LIB_PUBLIC_HEADERS "${CMAKE_SOURCE_DIR}/*.h")
file(GLOB LIB_SOURCES "${CMAKE_SOURCE_DIR}/*.cpp")

#add_library (${LIB_NAME}-s STATIC ${LIB_PUBLIC_HEADERS} ${LIB_SOURCES})
add_library (${LIB_NAME} SHARED ${LIB_PUBLIC_HEADERS} ${LIB_SOURCES})

install(
TARGETS ${LIB_NAME}
LIBRARY DESTINATION lib${LIB_SUFFIX}
)

#install(
# TARGETS ${LIB_NAME}-s
# ARCHIVE DESTINATION lib${LIB_SUFFIX}
#)

install(
FILES ${LIB_PUBLIC_HEADERS}
DESTINATION include/${LIB_NAME}
)

The problem is that I do not have bin folder in my build directory.Why?
 
Old 07-22-2015, 08:06 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,813
Blog Entries: 13

Rep: Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875
This builds. What exact errors are you seeing, or why are you concluding something about a bin directory?

You need to have libeigen2-dev installed on your system. Their documentation incorrectly states that as libeigen2-devel. There is no bin directory needed.

You can download the zip or get the files and they'll be in the clustering-master tree. The instructions tell you to make the release sub-directory, change into that, and then run "cmake ../". That creates the Makefile. You are still in the releases sub-directory. From there you next run "make" and it does build.

You also do need to have cmake installed in your system.
 
Old 07-23-2015, 12:36 AM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,612

Rep: Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649Reputation: 2649
libeigen2-devel
is the RPM redhat os name

rpm distros use -devel

Debian distros use -dev

install what is correct for your unknown operating system

also other than a minor bug fix 7 months ago this is 3 YEAR OLD code

on opensuse 13.2 using gcc 4.8 this builds


please POST !!! the output of the FIRST command to cmake
-- this--
Code:
cmake ../
it should look like this
Code:
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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
-- Configuring done
-- Generating done
-- Build files have been written to:

also seeing as this IS A LIBRARY there will NOT be a /bin folder
this builds a library !!!
clustering-master/build/lib/libclustering.so

Last edited by John VV; 07-23-2015 at 12:39 AM.
 
1 members found this post helpful.
Old 07-23-2015, 01:09 AM   #4
Mikibelavista
LQ Newbie
 
Registered: Mar 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
John VV,yes I got the same output as you.I am on Ubuntu 14.04.The initial confusion was why my exe file is located in CmakeFile/2.8.12/ directory. I guess than that I should put my input files(for clustering) in same folder.
 
Old 07-23-2015, 03:25 AM   #5
Mikibelavista
LQ Newbie
 
Registered: Mar 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
I am listing my 2.8.12.2 folder:
CMakeCCompiler.cmake CMakeDetermineCompilerABI_C.bin CMakeSystem.cmake CompilerIdCXX
CMakeCXXCompiler.cmake CMakeDetermineCompilerABI_CXX.bin CompilerIdC

I still do not know how to execute the code.
 
Old 07-23-2015, 09:44 AM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,813
Blog Entries: 13

Rep: Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875Reputation: 4875
Since OP is using Ubuntu, then they'll need the "-dev" package.

Either case you have it, and since you get the same output from cmake, then all you next need do is run the make.

And then you have a shared object library which you need to link with some other code to make use of the functions provided by that library. Re-Review the documentation provided by the author on the capabilities of that library.
Code:
myuser@rt-linux-desktop:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 12.04.5 LTS
Release:	12.04
Codename:	precise
myuser@rt-linux-desktop:~$ mkdir eigen
myuser@rt-linux-desktop:~$ cd eigen
myuser@rt-linux-desktop:~/eigen$ unzip ../Downloads/clustering-master.zip 
Archive:  ../Downloads/clustering-master.zip
06ac475b3da2c90ab0f24c4a5b64c8c80b74de23
   creating: clustering-master/
  inflating: clustering-master/.gitignore  
  inflating: clustering-master/CMakeLists.txt  
  inflating: clustering-master/ClusterRotate.cpp  
  inflating: clustering-master/ClusterRotate.h  
  inflating: clustering-master/Evrot.cpp  
  inflating: clustering-master/Evrot.h  
  inflating: clustering-master/FindEigen2.cmake  
  inflating: clustering-master/Kmeans.cpp  
  inflating: clustering-master/Kmeans.h  
  inflating: clustering-master/LICENSE  
  inflating: clustering-master/README.md  
  inflating: clustering-master/SpectralClustering.cpp  
  inflating: clustering-master/SpectralClustering.h  
myuser@rt-linux-desktop:~/eigen$ cd clustering-master
myuser@rt-linux-desktop:~/eigen/clustering-master$ mkdir release
myuser@rt-linux-desktop:~/eigen/clustering-master$ cd release
myuser@rt-linux-desktop:~/eigen/clustering-master/release$ cmake ../
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- 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
-- Configuring done
-- Generating done
-- Build files have been written to: /home/myuser/eigen/clustering-master/release
myuser@rt-linux-desktop:~/eigen/clustering-master/release$ make
Scanning dependencies of target clustering
[ 25%] Building CXX object CMakeFiles/clustering.dir/Kmeans.cpp.o
[ 50%] Building CXX object CMakeFiles/clustering.dir/ClusterRotate.cpp.o
[ 75%] Building CXX object CMakeFiles/clustering.dir/SpectralClustering.cpp.o
[100%] Building CXX object CMakeFiles/clustering.dir/Evrot.cpp.o
Linking CXX shared library lib/libclustering.so
[100%] Built target clustering
myuser@rt-linux-desktop:~/eigen/clustering-master/release$
 
  


Reply

Tags
c++, cmake


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Building UV-CDAT, cmake problem does not update Zaheer304 Linux - Newbie 6 04-23-2013 04:07 AM
Help Building One KDE Component with CMake Trip in VA Programming 2 06-22-2011 12:46 AM
Compiling source code for debugging (KDevelop/cmake) deadeyes Programming 5 12-14-2010 02:49 PM
Building and Installing Cmake borntofish61 Linux - Newbie 4 05-09-2010 09:50 PM
Problem in Building socket code from Stevens book Prakhardeep Linux - Networking 1 12-22-2004 04:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration