File omp.h does not exist #161

Closed
FiReTiTi opened this Issue Nov 24, 2013 · 22 comments

Projects

None yet

2 participants

@FiReTiTi

Hi,
I downloaded openann and tried to install it.
The cmake runs correctly without error.
But when I perform the "sudo make install", I have the following error:

Scanning dependencies of target python_extension_install
[100%] Generating python_extension_install_command
Installing Python extension...
running install
running build
running build_ext
cythoning openann.pyx to openann.cpp
building 'openann' extension
creating build
creating build/temp.macosx-10.9-x86_64-2.7
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -pipe -Os -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -UNDEBUG -I/Users/FiReTiTi/Softwares/OpenANN -I/Users/FiReTiTi/Softwares/OpenANN/lib/ALGLIB -I/Users/FiReTiTi/Softwares/OpenANN/test/lib/CPP-Test -I/opt/local/include/eigen3 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c openann.cpp -o build/temp.macosx-10.9-x86_64-2.7/openann.o -g0 -s -O3 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -fopenmp -DPARALLEL_CORES=4 -DOPENANN_LOGLEVEL=OpenANN::Log::INFO -Wno-enum-compare
clang: warning: argument unused during compilation: '-s'
clang: warning: argument unused during compilation: '-fopenmp'
In file included from openann.cpp:320:
/Users/FiReTiTi/Softwares/OpenANN/OpenANN/OpenANN:5:10: fatal error: 'omp.h' file not found

include <omp.h>

     ^

1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
gmake[4]: *** [python/python_extension_install_command] Erreur 1
gmake[3]: *** [python/CMakeFiles/python_extension_install.dir/all] Erreur 2
gmake[2]: *** [python/CMakeFiles/python_extension_install.dir/rule] Erreur 2
gmake[1]: *** [python_extension_install] Erreur 2

So it seems that the file omp.h is missing!
I downloaded OpenANN using all possible methods and the file is nowhere.

Do you know how to fix this error ?
Thank you for your help...

@AlexanderFabisch AlexanderFabisch added a commit to AlexanderFabisch/OpenANN that referenced this issue Nov 25, 2013
@AlexanderFabisch AlexanderFabisch Check if compiler supports OpenMP (issue #161). 4fcb8bb
@AlexanderFabisch
Member

Hi,
"omp.h" is required for multicore parallelization with OpenMP. Usually CMake checks if OpenMP is available on your system but it did not check if it is available for your compiler. That should be fixed now. Could you pull the latest commit?

@FiReTiTi

Hi,
thank you for your answer.
I got rid of my old version and I downloaded the new one.
Unfortunately I have exactly the same error.

Moreover, it seems that OpenANN uses systematically Clang for compilation.
But I have installed gcc 4.7, which support OpenMP, so I would like to use it. That could fix my problem. But how can I do that?

@AlexanderFabisch
Member

Execute CMake with CC=gcc CXX=g++ cmake ...

@FiReTiTi

I have an other error with gcc :-(
I know that the last numpy version is installed on my computer.

[100%] Generating python_extension_install_command
Installing Python extension...
running install
running build
running build_ext
skipping 'openann.cpp' Cython extension (up-to-date)
building 'openann' extension
gcc -fno-strict-aliasing -fno-common -dynamic -pipe -Os -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -UNDEBUG -I/Users/FiReTiTi/Softwares/OpenANN -I/Users/FiReTiTi/Softwares/OpenANN/lib/ALGLIB -I/Users/FiReTiTi/Softwares/OpenANN/test/lib/CPP-Test -I/opt/local/include/eigen3 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c openann.cpp -o build/temp.macosx-10.9-x86_64-2.7/openann.o -g0 -s -O3 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -fopenmp -DPARALLEL_CORES=4 -DOPENANN_LOGLEVEL=OpenANN::Log::INFO -Wno-enum-compare
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]
openann.cpp:357:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
gmake[4]: *** [python/python_extension_install_command] Erreur 1
gmake[3]: *** [python/CMakeFiles/python_extension_install.dir/all] Erreur 2
gmake[2]: *** [python/CMakeFiles/python_extension_install.dir/rule] Erreur 2
gmake[1]: *** [python_extension_install] Erreur 2

@AlexanderFabisch
Member

Could you try to add to python / setup.py.in an import numpy and change

    include_dirs=["${PROJECT_SOURCE_DIR}",
                          "${PROJECT_SOURCE_DIR}/lib/ALGLIB",
                          "${PROJECT_SOURCE_DIR}/test/lib/CPP-Test",
                          "${EIGEN3_INCLUDE_DIRS}"],

to

    include_dirs=[numpy.get_include(),
                          "${PROJECT_SOURCE_DIR}",
                          "${PROJECT_SOURCE_DIR}/lib/ALGLIB",
                          "${PROJECT_SOURCE_DIR}/test/lib/CPP-Test",
                          "${EIGEN3_INCLUDE_DIRS}"],

If this works I will add it to the main repository.

@FiReTiTi

Hi,
that seems to work, I just have a warning when I execute "sudo make install CC=gcc CXX=g++":

[100%] Generating python_extension_install_command
Installing Python extension...
running install
running build
running build_ext
skipping 'openann.cpp' Cython extension (up-to-date)
building 'openann' extension
gcc -fno-strict-aliasing -fno-common -dynamic -pipe -Os -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -UNDEBUG -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/Users/FiReTiTi/Softwares/OpenANN -I/Users/FiReTiTi/Softwares/OpenANN/lib/ALGLIB -I/Users/FiReTiTi/Softwares/OpenANN/test/lib/CPP-Test -I/opt/local/include/eigen3 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c openann.cpp -o build/temp.macosx-10.9-x86_64-2.7/openann.o -g0 -s -O3 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -fopenmp -DPARALLEL_CORES=4 -DOPENANN_LOGLEVEL=OpenANN::Log::INFO -Wno-enum-compare
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]
In file included from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,
from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from openann.cpp:357:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
creating build/lib.macosx-10.9-x86_64-2.7
g++ -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/lib/db46 build/temp.macosx-10.9-x86_64-2.7/openann.o -L/Users/FiReTiTi/Softwares/OpenANN/build/lib -L/Users/FiReTiTi/Softwares/OpenANN/build/src -lopenann -lalglib -o build/lib.macosx-10.9-x86_64-2.7/openann.so
running install_lib
copying build/lib.macosx-10.9-x86_64-2.7/openann.so -> /usr/local/lib/python2.7/site-packages
running install_egg_info
Writing /usr/local/lib/python2.7/site-packages/OpenANN-1.1.0-py2.7.egg-info
Done.
[100%] Built target python_extension_install

However, I don't know if it is related, but the command line "sudo ldconfig" doesn't work: "sudo: ldconfig: command not found".
Does it have a serious impact on OpennANN use?

@AlexanderFabisch
Member

Not yet, I get the same warning.

Thanks for your help. Can I close the issue?

@AlexanderFabisch AlexanderFabisch added a commit to AlexanderFabisch/OpenANN that referenced this issue Nov 25, 2013
@AlexanderFabisch AlexanderFabisch Include numpy headers (issue #161). c66570e
@FiReTiTi

I think this issue can be closed.
I was able to run the first example (XOR), but I have an issue for the second (two spirals).
It seems that it is an issue with QT, but I know that QT4 is installed on my computer: TwoSpiralsVisualization.h:6:21: fatal error: QGLWidget: No such file or directory
Do you wish I open an other issue?

@AlexanderFabisch
Member

You need GLUT, libxmu, OpenGL and libqt4-opengl for this example.

@FiReTiTi

Thank you so much for your help, but the example doesn't compile :-(
I use this command line:

g++ twospirals.cpp -o TwoSpirals pkg-config --cflags --libs openann QtOpenGL glu xmu -framework OpenGL

But I get this error:

Undefined symbols for architecture x86_64:
"TwoSpiralsVisualization::TwoSpiralsVisualization(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&)", referenced from:
_main in ccB3ddOw.o
"TwoSpiralsVisualization::~TwoSpiralsVisualization()", referenced from:
_main in ccB3ddOw.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

@AlexanderFabisch
Member

Usually CMake+Make should do the linking etc. for you: make TwoSpirals. You could also deactivate the CMake flag EXCLUDE_TESTS_FROM_ALL to build the examples, benchmarks and tests with make all.

@FiReTiTi

I am sorry, but I think that the issue come from the fact I don't use to use CMake :-(

So I tried to compile directly without cake with the command line:

g++ twospirals.cpp -o TwoSpirals pkg-config --cflags --libs openann QtOpenGL glu xmu -framework OpenGL

And I got the error I cited previously.

Next, I tried to start with a "cmake .", some files are generated, but how can I compile the example? All the make options doesn't seem to provide any result.

@AlexanderFabisch
Member

The best way to build OpenANN is

git clone git@github.com:OpenANN/OpenANN.git
cd OpenANN
mkdir build # out of source build
cd build
cmake -D CMAKE_BUILD_TYPE=Release ..
sudo make install
sudo ldconfig
make TwoSpirals # will build the example in OpenANN/build/examples/twospirals/TwoSpirals

If this option is not available CMake could not find all required libraries.

@FiReTiTi
  • The "sudo ldconfig" does not work ("sudo: ldconfig: command not found").
  • The examples are not available, only the sources are copied. Indeed, I think it is a librairies issue. Even the XOR example is not built.
    How can I build/install OpenANN with the required librairies (which are already installed)?
  • Moreover, during the installation, I had a message saying something like that "file endian.h not found, so example mnist not copied". I want to install OpenANN for this typical kink of problems (process images).
@AlexanderFabisch
Member
  • OK, probably ldconfig is not available on Mac. That should not be a problem.
  • This is the intended behavior. CMake is a build management tool. It generates makefiles for you. It does not build libraries or executables. This is make's task. The makefiles have a target all that will build the library and other targets for the examples (XOR, TwoSpirals, ...). The configuration of the makefile is quite complex. This is the reason why I use CMake.
  • "endian.h" is not available on Mac. That is correct. I don't have an implementation of the MNIST example that works for Mac.
@FiReTiTi

Thank you for your help.

@FiReTiTi

Sorry, but I am still trying to run the TwoSpiral problem.
I have linked some missing files, but at least one seems to be missing, because I get this error:

Undefined symbols for architecture x86_64:
"TwoSpiralsVisualization::updatedData()", referenced from:
TwoSpiralsVisualization::predictClass(int, int, double) in ccXnMIcR.o
"vtable for TwoSpiralsVisualization", referenced from:
TwoSpiralsVisualization::TwoSpiralsVisualization(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&) in ccXnMIcR.o
TwoSpiralsVisualization::TwoSpiralsVisualization(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&) in ccXnMIcR.o
TwoSpiralsVisualization::~TwoSpiralsVisualization() in ccXnMIcR.o
TwoSpiralsVisualization::~TwoSpiralsVisualization() in ccXnMIcR.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

Which library "updatedData" is from?

@AlexanderFabisch
Member

updateData is a Qt signal. Compiling Qt stuff without qmake or CMake is very difficult.

Btw. that's how it should look like when it works: http://www.youtube.com/watch?v=MkLJ-9MubKQ

@FiReTiTi

ok, but I do need to compile the mnist example, because it is quite exactly what I would like to do with OpenANN.
Btw, can you share this example, because I don't see it in the sources.

@AlexanderFabisch
Member

It is here: https://github.com/OpenANN/OpenANN/tree/master/benchmarks/mnist

The problem is in this file: https://github.com/OpenANN/OpenANN/blob/master/benchmarks/mnist/IDXLoader.h

The function htobe32 from endian.h is required. It would be great if you could provide a version for Mac.

@FiReTiTi

If I am able to run it on my mac, I will share it with pleasure.
But I will need some help, because it seems that I have to compile everything using lot of dependencies.

Btw, where can I find the file endian.h?

@AlexanderFabisch
Member

That is exactly the problem. It is usually not available on Mac. We need a replacement for htobe32. It might be possible that you just have to include another header on Mac.

From the man page about "endian.h":

   These  functions  convert  the byte encoding of integer values from the
   byte order that the current CPU (the "host") uses, to and from  little-
   endian and big-endian byte order.

   The  number,  nn,  in  the  name of each function indicates the size of
   integer handled by the function, either 16, 32, or 64 bits.

   The functions with names of the form "htobenn" convert from  host  byte
   order to big-endian order.

First of all, you must remove the part

check_include_files("endian.h" HAVE_ENDIAN_H)

if(HAVE_ENDIAN_H)
....
endif()

(without the "...") from "benchmarks/mnist/CMakeLists.txt" and regenerate the makefiles. Then you have to compile the benchmark with make MNIST. It will fail. Then you have to fix the error. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment