Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling on Mac fails with message "use of undeclared identifier 'CLOCK_REALTIME'" #45

Open
drhalftone opened this issue Jan 12, 2016 · 17 comments

Comments

@drhalftone
Copy link

In file included from ../nabo/kdtree_cpu.cpp:42:
In file included from /usr/local/include/boost/format.hpp:38:
In file included from /usr/local/include/boost/format/internals.hpp:20:
In file included from /usr/local/include/boost/optional.hpp:15:
/usr/local/include/boost/optional/optional.hpp:1276:3: warning: unused typedef 'boost_static_assert_typedef_1276' [-Wunused-local-typedef]
BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header <boost/optional/optional_io.hpp>");
^
/usr/local/include/boost/static_assert.hpp:36:48: note: expanded from macro 'BOOST_STATIC_ASSERT_MSG'

define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B )

                                           ^

/usr/local/include/boost/static_assert.hpp:170:16: note: expanded from macro 'BOOST_STATIC_ASSERT'
BOOST_JOIN(boost_static_assert_typedef_, LINE) BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE
^
/usr/local/include/boost/config/suffix.hpp:544:28: note: expanded from macro 'BOOST_JOIN'

define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )

                       ^

/usr/local/include/boost/config/suffix.hpp:545:31: note: expanded from macro 'BOOST_DO_JOIN'

define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)

                          ^

/usr/local/include/boost/config/suffix.hpp:546:32: note: expanded from macro 'BOOST_DO_JOIN2'

define BOOST_DO_JOIN2( X, Y ) X##Y

                           ^

:123:1: note: expanded from here
boost_static_assert_typedef_1276
^
4 warnings generated.
[ 31%] Building CXX object CMakeFiles/nabo.dir/nabo/kdtree_opencl.cpp.o
Linking CXX static library libnabo.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libnabo.a(kdtree_opencl.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libnabo.a(kdtree_opencl.cpp.o) has no symbols
[ 31%] Built target nabo
Scanning dependencies of target trivial
[ 37%] Building CXX object examples/CMakeFiles/trivial.dir/trivial.cpp.o
Linking CXX executable trivial
[ 37%] Built target trivial
Scanning dependencies of target usage
[ 43%] Building CXX object examples/CMakeFiles/usage.dir/usage.cpp.o
Linking CXX executable usage
[ 43%] Built target usage
Scanning dependencies of target knnbench
[ 50%] Building CXX object tests/CMakeFiles/knnbench.dir/knnbench.cpp.o
../../tests/knnbench.cpp:69:18: error: use of undeclared identifier 'CLOCK_REALTIME'
clock_gettime(CLOCK_REALTIME, &ts);
^
1 error generated.
make[2]: *** [tests/CMakeFiles/knnbench.dir/knnbench.cpp.o] Error 1
make[1]: *** [tests/CMakeFiles/knnbench.dir/all] Error 2
make: *** [all] Error 2

@simonlynen
Copy link
Collaborator

Can you give #46 a try please?

@drhalftone
Copy link
Author

I’m not entirely clear how to do this, but here is what I did. I used SourceTree to download a fresh copy of your repository (HEAD -> fix/clock_realtime_include origin/fix/clock_realtime_include).

I then ran the following commands in terminal:

SRC_DIR=pwd
BUILD_DIR=${SRC_DIR}/build
mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${SRC_DIR}

And then got the errors described in the attached log files.

@simonlynen
Copy link
Collaborator

@drhalftone so you still get the same error message?

@simonlynen
Copy link
Collaborator

@drhalftone actually just saw that there is one more fix to patch. Can you update the branch fix/clock_realtime_include and try again?

@drhalftone
Copy link
Author

yes same error

On Jan 12, 2016, at 8:10 PM, Simon Lynen notifications@github.com wrote:

@drhalftone https://github.com/drhalftone actually just saw that there is one more fix to patch. Can you update the branch fix/clock_realtime_include and try again?


Reply to this email directly or view it on GitHub #45 (comment).

@drhalftone
Copy link
Author

Something worth noting is that Mac OS X’s native compilers no longer support OpenMP. Should this matter? Here is a snippet from the error log:

Performing C++ SOURCE FILE Test OpenMP_FLAG_DETECTED failed with the following output:
Change Dir: /Users/dllau/Libraries/libnabo/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_85263/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_85263.dir/build.make CMakeFiles/cmTC_85263.dir/build
Building CXX object CMakeFiles/cmTC_85263.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DOpenMP_FLAG_DETECTED -mp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o CMakeFiles/cmTC_85263.dir/src.cxx.o -c /Users/dllau/Libraries/libnabo/build/CMakeFiles/CMakeTmp/src.cxx
clang: error: unknown argument: '-mp'
make[1]: *** [CMakeFiles/cmTC_85263.dir/src.cxx.o] Error 1
make: *** [cmTC_85263/fast] Error 2

Source file was:

#include <omp.h>
int main() {
#ifdef _OPENMP
return 0;
#else
breaks_on_purpose
#endif
}

On Jan 12, 2016, at 8:16 PM, Daniel L. Lau lauconsulting@windstream.net wrote:

yes same error

<CMakeError.log>
<CMakeOutput.log>

On Jan 12, 2016, at 8:10 PM, Simon Lynen <notifications@github.com mailto:notifications@github.com> wrote:

@drhalftone https://github.com/drhalftone actually just saw that there is one more fix to patch. Can you update the branch fix/clock_realtime_include and try again?


Reply to this email directly or view it on GitHub #45 (comment).

@simonlynen
Copy link
Collaborator

@drhalftone I am not sure which version of the code you are on. The lines you have in the error output don't match with what I see on the master branch. Also we have handling for OSX in the codebase since a while. Which branch are you using?

@simonlynen
Copy link
Collaborator

@drhalftone the same is the case for open-mp handling. This also is done separately for osx.

@simonlynen
Copy link
Collaborator

@drhalftone also I can see a verified build of the repository from master on OSX here: http://129.132.38.183:8080/job/libnabo/37/

@drhalftone
Copy link
Author

I followed the instructions on the libnabo github page. Here is the terminal commands that I used to delete the copy I had been working with, and cloning the github respository and then running the cmake commands that are listed on the github page:

DrHalftone:Libraries dllau$ rm -r libnabo/
override r--r--r-- dllau/pulse for libnabo//.git/objects/01/48b8a237be7eb2e3901e23eb66dda6c64656a9? y
override r--r--r-- dllau/pulse for libnabo//.git/objects/1b/e693929522a8272ea00b42cdefc38849318863? y
override r--r--r-- dllau/pulse for libnabo//.git/objects/39/a0c33c2522d201156a77125034349842d877a7? y
override r--r--r-- dllau/pulse for libnabo//.git/objects/e9/9e4fa8a134b6b5bd470512fad19df1b1049ba6? y
override r--r--r-- dllau/pulse for libnabo//.git/objects/pack/pack-4cc30b1bf628b5c4b222618a952c7caf182bd662.idx? y
override r--r--r-- dllau/pulse for libnabo//.git/objects/pack/pack-4cc30b1bf628b5c4b222618a952c7caf182bd662.pack? y
DrHalftone:Libraries dllau$ ls
libpointmatcher
DrHalftone:Libraries dllau$ git clone git://github.com/ethz-asl/libnabo.git
Cloning into 'libnabo'...
remote: Counting objects: 1612, done.
remote: Total 1612 (delta 0), reused 0 (delta 0), pack-reused 1611
Receiving objects: 100% (1612/1612), 1.40 MiB | 922.00 KiB/s, done.
Resolving deltas: 100% (948/948), done.
Checking connectivity... done.
DrHalftone:Libraries dllau$ cd libnabo/
DrHalftone:libnabo dllau$ ls
CHANGELOG.rst cmake_uninstall.cmake.in libnaboConfigVersion.cmake.in
CMakeLists.txt debian nabo
Doxyfile.in examples package.xml
README.md experimental python
UseDoxygen.cmake libnaboConfig.cmake.in tests
DrHalftone:libnabo dllau$ SRC_DIR=pwd
DrHalftone:libnabo dllau$ BUILD_DIR=${SRC_DIR}/build
DrHalftone:libnabo dllau$ mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
DrHalftone:build dllau$ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${SRC_DIR}
-- The C compiler identification is AppleClang 7.0.2.7000181
-- The CXX compiler identification is AppleClang 7.0.2.7000181
-- 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
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.10")
-- Found DOXYFILE_IN: /Users/dllau/Libraries/libnabo/Doxyfile.in
-- Found LATEX: /Library/TeX/texbin/latex
CMake Warning (dev) at UseDoxygen.cmake:112 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property. Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

get_target_property() called with non-existent target "doc".
Call Stack (most recent call first):
CMakeLists.txt:40 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Boost version: 1.59.0
-- 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 = [ ]
-- 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
-- Could NOT find OpenMP (missing: OpenMP_C_FLAGS OpenMP_CXX_FLAGS)
OpenCL disabled, not looking for it
ANN found, enabling it in benchmarks
FLANN found, enabling it in benchmarks
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
CMake Error at tests/CMakeLists.txt:95 (message):
Compiling a test executable failed.
Call Stack (most recent call first):
tests/CMakeLists.txt:105 (try_compile_cloud_types)

-- Configuring incomplete, errors occurred!
See also "/Users/dllau/Libraries/libnabo/build/CMakeFiles/CMakeOutput.log".
See also "/Users/dllau/Libraries/libnabo/build/CMakeFiles/CMakeError.log".
DrHalftone:build dllau$

On Jan 12, 2016, at 8:40 PM, Simon Lynen notifications@github.com wrote:

@drhalftone https://github.com/drhalftone I am not sure which version of the code you are on. The lines you have in the error output don't match with what I see on the master branch. Also we have handling for OSX in the codebase since a while. Which branch are you using?


Reply to this email directly or view it on GitHub #45 (comment).

@simonlynen
Copy link
Collaborator

@drhalftone ok, I think you are missing a few dependencies. You will need to make sure you have eigen and boost installed.

i.e. in case you use homebrew:

brew install eigen
brew install boost

@drhalftone
Copy link
Author

DrHalftone:build dllau$ brew install eigen
Warning: eigen-3.2.6 already installed
DrHalftone:build dllau$ brew install boost
Warning: boost-1.59.0 already installed

On Jan 13, 2016, at 10:51 AM, Simon Lynen notifications@github.com wrote:

@drhalftone https://github.com/drhalftone ok, I think you are missing a few dependencies. You will need to make sure you have eigen and boost installed.

i.e. in case you use homebrew:

brew install eigen
brew install boost

Reply to this email directly or view it on GitHub #45 (comment).

@simonlynen
Copy link
Collaborator

I see. Ok it seems the compilation of one of the verification targets fails. Can you post the contents of

"/Users/dllau/Libraries/libnabo/build/CMakeFiles/CMakeOutput.log".
"/Users/dllau/Libraries/libnabo/build/CMakeFiles/CMakeError.log".

Here?

@drhalftone
Copy link
Author

Archive.zip

@simonlynen
Copy link
Collaborator

ok, there seems to be some issue with the way the open-mp detection breaks on your machine. I suggest commenting this line here: https://github.com/ethz-asl/libnabo/blob/master/CMakeLists.txt#L52

@drhalftone
Copy link
Author

DrHalftone:libnabo dllau$ rm -r build
DrHalftone:libnabo dllau$ SRC_DIR=pwd
DrHalftone:libnabo dllau$ BUILD_DIR=${SRC_DIR}/build
DrHalftone:libnabo dllau$ mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
DrHalftone:build dllau$ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${SRC_DIR}
CMake Warning (dev) at UseDoxygen.cmake:112 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property. Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

get_target_property() called with non-existent target "doc".
Call Stack (most recent call first):
CMakeLists.txt:40 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Boost version: 1.59.0
OpenCL disabled, not looking for it
ANN found, enabling it in benchmarks
FLANN found, enabling it in benchmarks
CMake Error at tests/CMakeLists.txt:95 (message):
Compiling a test executable failed.
Call Stack (most recent call first):
tests/CMakeLists.txt:105 (try_compile_cloud_types)

-- Configuring incomplete, errors occurred!
See also "/Users/dllau/Libraries/libnabo/CMakeFiles/CMakeOutput.log".
DrHalftone:build dllau$

openmp

find_package(OpenMP)

if (OPENMP_FOUND)
add_definitions(-fopenmp -DHAVE_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
if (CMAKE_COMPILER_IS_GNUCC)
set(EXTRA_LIBS ${EXTRA_LIBS} gomp)
endif(CMAKE_COMPILER_IS_GNUCC)
endif(OPENMP_FOUND)

On Jan 13, 2016, at 11:56 AM, Simon Lynen notifications@github.com wrote:

ok, there seems to be some issue with the way the open-mp detection breaks on your machine. I suggest commenting this line here: https://github.com/ethz-asl/libnabo/blob/master/CMakeLists.txt#L52 https://github.com/ethz-asl/libnabo/blob/master/CMakeLists.txt#L52

Reply to this email directly or view it on GitHub #45 (comment).

@simonlynen
Copy link
Collaborator

@drhalftone since I cannot reproduce the problem here and in the interest of time I suggest you disable the compile time tests in:
https://github.com/ethz-asl/libnabo/blob/master/tests/CMakeLists.txt#L105-L113 by deleting the lines. These are meant for developers which change libnabo and don't impact the runtime of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants