pprepair on Ubuntu GCC 4.5+
pvernier opened this issue · 21 comments
When trying to compile pprepair, I get the next message:
c++ -Wall -O3 -frounding-math -fno-strict-aliasing -I/usr/include/gdal -L/usr/lib -c PolygonHandle.cpp
In file included from PolygonHandle.h:25:0,
from PolygonHandle.cpp:22:
definitions/definitions.h:26:30: erreur fatale: gdal/ogrsf_frmts.h : Aucun fichier ou dossier de ce type
compilation terminée.
make: *** [PolygonHandle.o] Erreur 1
Which means in english: fatal error: gdal/ogrsf_frmts.h : No such file or directory of that type
compilation ended
I am under ubuntu 13.04 with GDAL 1.9.2 and CGAL 4.0.2.
Hi,
It seems like you don't have GDAL/OGR installed. You can get it through apt-get :-).
Hi,
GDAL is installed:
$ gdalinfo --version
GDAL 1.9.2, released 2012/10/08
Could you try and see if you have ogrsf_frmts.h in /usr/include/gdal ?
I didn't have a gdal folder in /usr/include so I uninstalled GDAL (which was installed with qgis) and installed it again.
Just installing GDAL (apt-get install gdal-bin) gave me the same result
I had to install libgdal-dev to solve the problem. I now have version 1.9.0.
But now I have an other one. When I complie I get:
$ make -f Makefile.linux
c++ -Wall -O3 -frounding-math -fno-strict-aliasing -I/usr/include/gdal -L/usr/lib -c PolygonHandle.cpp
c++ -Wall -O3 -frounding-math -fno-strict-aliasing -I/usr/include/gdal -L/usr/lib -c FaceInfo.cpp
c++ -Wall -O3 -frounding-math -fno-strict-aliasing -I/usr/include/gdal -L/usr/lib -c IOWorker.cpp
c++ -Wall -O3 -frounding-math -fno-strict-aliasing -I/usr/include/gdal -L/usr/lib -c PlanarPartition.cpp
c++ -Wall -O3 -frounding-math -fno-strict-aliasing -I/usr/include/gdal -L/usr/lib -c pprepair.cpp
pprepair.cpp: In function ‘int main(int, const char*)’:
pprepair.cpp:319:61: attention : ‘splitRegionsRatio’ may be used uninitialized in this function [-Wmaybe-uninitialized]
c++ -g -O3 -D_REENTRANT -frounding-math -Wl,-Bsymbolic-functions -L/usr/lib -lCGAL_Core -lCGAL -lgmpxx -lmpfr -lgmp -lboost_thread-mt -lCGAL_Core -lCGAL -lgmpxx -lmpfr -lgmp -lboost_thread-mt -lgdal1.6.0 PolygonHandle.o FaceInfo.o IOWorker.o PlanarPartition.o pprepair.o -o pprepair
/usr/bin/ld: ne peut trouver -lgdal1.6.0
collect2: erreur: ld a retourné 1 code d'état d'exécution
make: ** [pprepair] Erreur 1
Should I open an other issue?
It's fine in this one :-). Since you have GDAL 1.9.0 now, please change -lgdal1.6.0 to -lgdal1.9.0.
I had put 1.6.0 before since it was the latest version available using apt-get some time ago.
I have edited Makefile to replace -lgdal1.6.0 by -lgdal1.9.0 but I have the same issue:
/usr/bin/ld: ne peut trouver -lgdal1.9.0
collect2: erreur: ld a retourné 1 code d'état d'exécution
make: *** [pprepair] Erreur 1
That's quite strange... could you check if you have a gdal1.9.0.so file in /usr/lib? It could also be in /usr/local/lib.
I do not have gdal1.9.0.so in /usr/lib.
But I have libgdal.so, libgdal.so.1 and libgdal.so.1.16.0
It is not in /usr/local/lib neither.
Then change -lgdal1.6.0 to -llibgdal in the Makefile.
Doing so gave me the same error:
/usr/bin/ld: ne peut trouver -libgdal
collect2: erreur: ld a retourné 1 code d'état d'exécution
make: *** [pprepair] Erreur 1
One more l, -llibgdal
Ok sorry. But it give me the same result:
/usr/bin/ld: ne peut trouver -llibgdal
collect2: erreur: ld a retourné 1 code d'état d'exécution
make: *** [pprepair] Erreur 1
I guess it's some kind of path error. I'll check on my Linux machine on Monday.
Sorry, you have to put -lgdal, not -llibgdal.
Then it works for me.
It now works. But I have an other error related to CGAL.
There is a lot of text in the output of the compilation and at the end:
[clone .part.382] »:
PlanarPartition.cpp:(.text.unlikely+0x27a): référence indéfinie vers « CGAL::precondition_fail(char const_, char const_, int, char const_) »
collect2: erreur: ld a retourné 1 code d'état d'exécution
make: *_* [pprepair] Erreur 1
It seems like this is a problem with gcc 4.7 as contained in Ubuntu. The same version in Debian seems to manage it fine.
Try changing the CC=c++ line in the Makefile to point to a different compiler. Putting CC=g++-4.4 fixed the problem for me.
Doing like you say (or with 4.5) give me this error:
g++-4.4 -Wall -O3 -frounding-math -fno-strict-aliasing -c PolygonHandle.cpp
make: g++-4.4 : commande introuvable
make: *** [PolygonHandle.o] Erreur 127
With 4.6, I get an output similar to the one I had in my last comment but with this error:
pprepair.o: dans la fonction « GLOBAL__sub_I_main »:
pprepair.cpp:(.text.startup+0x1898): référence indéfinie vers « CGAL::assertion_fail(char const, char const_, int, char const_) »
pprepair.o:pprepair.cpp:(.text.startup+0x18c9): encore plus de références indéfinies suivent vers « CGAL::assertion_fail(char const_, char const_, int, char const_) »
collect2: ld returned 1 exit status
make: *** [pprepair] Erreur 1
Yes, apparently 4.4 is the last version that doesn't have this problem...
OK, installing version 4.4 works. Thanks!
No problem. Glad to hear that :-). I'll investigate this further when I can.
Fixed, pprepair now uses cmake to get the correct compiler and linker flags.