MISS3D / s2p

This repository is not maintained, please use https://github.com/centreborelli/s2p instead.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compiling unsuccessful

elskedezeeeuw opened this issue · comments

New to all this, so sorry if making obvious mistakes...
Running on ubuntu 16.04

When compiling following error occurs:

elske@laptop:~/software/s2p$ make all
make -j -C c/homography
make[1]: Entering directory '/home/elske/software/s2p/c/homography'
g++ -o homography main.o LibImages/LibImages.o Utilities/Utilities.o Utilities/Memory.o Utilities/Parameters.o Utilities/Time.o LibHomography/Homography.o LibHomography/Splines.o gdal-config --libs
LibImages/LibImages.o: In function Image::Image()': LibImages.cpp:(.text+0x2c): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::Image(unsigned long, unsigned long, unsigned long, unsigned long)': LibImages.cpp:(.text+0x82): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::Image(float const*, unsigned long, unsigned long, unsigned long)': LibImages.cpp:(.text+0x146): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::readGDAL(char const*, unsigned long)': LibImages.cpp:(.text+0xda7): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::copyInner(Image&, int) const': LibImages.cpp:(.text+0x2960): undefined reference to omp_get_max_threads'
LibImages/LibImages.o:LibImages.cpp:(.text+0x486e): more undefined references to `omp_get_max_threads' follow
collect2: error: ld returned 1 exit status
Makefile:15: recipe for target 'homography' failed
make[1]: *** [homography] Error 1
make[1]: Leaving directory '/home/elske/software/s2p/c/homography'
makefile:45: recipe for target 'homography' failed
make: *** [homography] Error 2

Please advice....

Thanks,
Elske

This kind of error happens when this flag "-fopenmp" is set somewhere but not everywhere. Can you please :

(1) run "make clean", then "make homography", and post the output
(2) post the output of "gdal-config --version", "gdal-config --cflags" and "gdal-config --libs"

Thanks for your response.
See output below.

elske@laptop:/software/s2p$ make homography
make -j -C c/homography
make[1]: Entering directory '/home/elske/software/s2p/c/homography'
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o main.o main.cpp
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o LibImages/LibImages.o LibImages/LibImages.cpp
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o Utilities/Utilities.o Utilities/Utilities.cpp
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o Utilities/Memory.o Utilities/Memory.cpp
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o Utilities/Parameters.o Utilities/Parameters.cpp
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o Utilities/Time.o Utilities/Time.cpp
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o LibHomography/Homography.o LibHomography/Homography.cpp
g++ -march=native -O3 gdal-config --cflags -DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp -c -o LibHomography/Splines.o LibHomography/Splines.cpp
g++ -o homography main.o LibImages/LibImages.o Utilities/Utilities.o Utilities/Memory.o Utilities/Parameters.o Utilities/Time.o LibHomography/Homography.o LibHomography/Splines.o gdal-config --libs
LibImages/LibImages.o: In function Image::Image()': LibImages.cpp:(.text+0x2c): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::Image(unsigned long, unsigned long, unsigned long, unsigned long)': LibImages.cpp:(.text+0x82): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::Image(float const*, unsigned long, unsigned long, unsigned long)': LibImages.cpp:(.text+0x146): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::readGDAL(char const*, unsigned long)': LibImages.cpp:(.text+0xda7): undefined reference to omp_get_max_threads'
LibImages/LibImages.o: In function Image::copyInner(Image&, int) const': LibImages.cpp:(.text+0x2960): undefined reference to omp_get_max_threads'
LibImages/LibImages.o:LibImages.cpp:(.text+0x486e): more undefined references to `omp_get_max_threads' follow
collect2: error: ld returned 1 exit status
Makefile:15: recipe for target 'homography' failed
make[1]: *** [homography] Error 1
make[1]: Leaving directory '/home/elske/software/s2p/c/homography'
makefile:45: recipe for target 'homography' failed
make: *** [homography] Error 2
elske@laptop:
/software/s2p$ gdal-config --version
1.11.3
elske@laptop:/software/s2p$ gdal-config --cflags
-I/usr/include/gdal
elske@laptop:
/software/s2p$ gdal-config --libs
-L/usr/lib -lgdal

It looks like you have set some variables that affect the compilation (for example CPPFLAGS, or TARGET_ARCH).

The settings "-DCPU_LITTLE_END -mtune=native -msse2 -mfpmath=sse -fopenmp" that appear on your compilation lines never appear inside the s2p code, nor they are produced by your installation of gdal, so they must have been set by your system.

You can look at all your variables by running "env", and then check for the offending ones by, for example "env | grep CPU". If you remove these variables the compilation should work.

Setting variables to direct the compilation is alright, but in your case they seem to be in an inconsistent state, because "-fopenmp" is only added to the compilation, and not to the link settings.

Thanks.

  1. unset CPPFLAGS
  2. make clean
  3. make all
    worked