Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site. Si vous continuez à utiliser ce dernier, nous considèrerons que vous acceptez l'utilisation des cookies. J'ai compris ! ou En savoir plus !.
banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

Suite à un problème technique intervenu entre le 22 et le 23 mars, nous avons du procéder dans la soirée du 25 mars, à la restauration de la base de données du 24 mars (matinée).

En clair, nous avons perdu vos contributions et inscriptions du dimanche 24 et du lundi 25 mars.
Nous vous prions de nous excuser.

#1 Tue 29 October 2019 16:50

image95
Participant assidu
Date d'inscription: 6 Sep 2014
Messages: 246

DGGRID et gdal : problème de compilation gdal (Linux)

Bonjour à tous,

Je souhaite installer l'outil dggrid permettant de générer des grilles globales discrètes :

https://github.com/sahrk/DGGRID


L'outil nécessite 4 dépendances (3 sont inclues avec l'outil) et une n'est pas incluse : gdal, la cause de mon problème.


Je travaille sur linuxMint (ubuntu) version 19.1 (tessa).


Voici les quelques lignes d'instructions d'installation de l'outil dggrid  :

https://github.com/sahrk/DGGRID/blob/master/README.MAKE


J'ai fait l'étape 1 et 2 (j'ai édité simplement les deux path gdal du fichier MakeIncludes) :

Ci dessous ma version actuelle du fichier MakeInclude (si besoin, la version brute du fichier : https://github.com/sahrk/DGGRID/blob/ma … keIncludes  :

Code:

# MakeIncludes
# Version 7.01 - Kevin Sahr, 9/30/19

### these GDAL location variables must be correctly set ###
# location of GDAL header files
GDAL_HDR_DIR = /opt/local/include
# location of libgdal.a
GDAL_LIB = /opt/local/lib/libgdal.dylib

### most users won't need to change anything below ###

# compilers
CCOMP = gcc 
CPPCOMP = g++ 

# flags for debugging vs. production
DEBUG_CC_FLAGS = -g -O0 -Wall -fno-inline -fno-eliminate-unused-debug-types 
SHIP_CC_FLAGS = -O3

# choose which to use; comment out the one you don't want
ADD_CC_FLAGS = $(SHIP_CC_FLAGS)
#ADD_CC_FLAGS = $(DEBUG_CC_FLAGS)

### the variables below are used by the Makefiles ###
# any extra C++ flags
ADD_CPP_FLAGS = $(ADD_CC_FLAGS) -std=c++11

# external include search paths 
ADD_INC_DIRS = -I$(GDAL_HDR_DIR)

# external libraries to link when linking a standard dglib executable
ADD_LD_LIBS= $(GDAL_LIB)

La commande make s'execute (etape 3) mais j'ai quelques messages d'erreur :

Code:

IC
/usr/bin/ld: /usr/lib/libgdal.a(gfstemplate.o): relocation R_X86_64_32S against hidden symbol `_ZNK9GMLReader13GetClassCountEv' can not be used when making a PIE object
/usr/bin/ld: /usr/lib/libgdal.a(gmlhandler.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/libgdal.a(ili2handler.o): relocation R_X86_64_32S against hidden symbol `_ZTV11ILI2Handler' can not be used when making a PIE object
/usr/bin/ld: /usr/lib/libgdal.a(nashandler.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/libgdal.a(ntf_codelist.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/libgdal.a(ntf_estlayers.o): relocation R_X86_64_32S against hidden symbol `_ZN11OGRNTFLayer12GetLayerDefnEv' can not be used when making a PIE object
/usr/bin/ld: /usr/lib/libgdal.a(ntf_raster.o): relocation R_X86_64_32S against hidden symbol `_ZTV17OGRNTFRasterLayer' can not be used when making a PIE object
/usr/bin/ld: /usr/lib/libgdal.a(ogrmssqlgeometryparser.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:21: recipe for target 'dggrid' failed
make: *** [dggrid] Error 1

Le problème vient très probablement de mon installation / parametrage gdal.

Le développeur de l'outil dggrid m'invite : à recompiler la bibliothèque gdal avec l'indicateur -fPIC. Et dans dans MakeIncludes, ajouter l'indicateur suivant à la fin de ADD_CPP_FLAGS: -no-pie (ce que j'ai fait). Mais je bloque pour l'étape de compilation gdal avec l'indicateur -fPIC.

Une personne saurait elle me dire la procédure (commandes) pour compiler gdal avec l'indicateur -fPIC  ? PLus généralement, la manière de compiler gdal ? Actuellement, lorsque je fais un gdalinfo --version : j'obtiens DGAL 2.2.3, released 2017/11/20. Pour l'installation gdal, j'avais fait cette commande : sudo apt-get install libgdal-dev

J'espère avoir été clair.
Je vous remercie beaucoup.
IMAGE

Dernière modification par image95 (Tue 29 October 2019 17:02)

Hors ligne

 

#2 Tue 29 October 2019 17:21

rouault
Participant assidu
Date d'inscription: 26 Apr 2009
Messages: 166

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Au lieu de linker dggrid vers la librairie statiquel libgdal.a, essaye plutôt de linker vers libgdal.so

Sinon, pour compiler GDAL de tel sorte que son .a utilise -fPIC, il faut faire
./configure [options éventuelles] CFLAGS=-fPIC CXXFLAGS=-fPIC

Hors ligne

 

#3 Wed 30 October 2019 10:50

image95
Participant assidu
Date d'inscription: 6 Sep 2014
Messages: 246

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Bonjour,
Merci.

Lorsque je fais

Code:

find / -iname "libgdal*"

/usr/lib/libgdal.so
/usr/lib/libgdal.so.20.3.2
/usr/lib/ogdi/libgdal.so
/usr/lib/libgdal.so.20
/usr/lib/libgdal.a
/usr/share/doc/libgdal-dev
/usr/share/doc/libgdal20
/usr/share/lintian/overrides/libgdal-dev
/usr/share/lintian/overrides/libgdal20

J'ai donc édité le fichier MakeIncludes comme celà :

Code:

# MakeIncludes
# Version 7.01 - Kevin Sahr, 9/30/19

### these GDAL location variables must be correctly set ###
# location of GDAL header files
GDAL_HDR_DIR = /usr/include/gdal
# location of libgdal.a
GDAL_LIB = /usr/lib/libgdal.so

### most users won't need to change anything below ###

# compilers
CCOMP = gcc 
CPPCOMP = g++ 

# flags for debugging vs. production
DEBUG_CC_FLAGS = -g -O0 -Wall -fno-inline -fno-eliminate-unused-debug-types 
SHIP_CC_FLAGS = -O3

# choose which to use; comment out the one you don't want
ADD_CC_FLAGS = $(SHIP_CC_FLAGS)
#ADD_CC_FLAGS = $(DEBUG_CC_FLAGS)

### the variables below are used by the Makefiles ###
# any extra C++ flags
ADD_CPP_FLAGS = $(ADD_CC_FLAGS) -std=c++11 -no-pie

# external include search paths 
ADD_INC_DIRS = -I$(GDAL_HDR_DIR)

# external libraries to link when linking a standard dglib executable
ADD_LD_LIBS= $(GDAL_LIB)

Puis j'ai fait un make clean :

Code:

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ make clean
rm -rf binvals.o quadclip.o dggrid.o param.o transform.o binpres.o gridgen.o DgHexSF.o clipper.o table.o util.o binvals.depends quadclip.depends dggrid.depends param.depends transform.depends binpres.depends gridgen.depends DgHexSF.depends clipper.depends table.depends util.depends dggrid core ti_files ii_fil

Puis un make :

Code:

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ make
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  util.cpp > util.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  table.cpp > table.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  clipper.cpp > clipper.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  DgHexSF.cpp > DgHexSF.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  gridgen.cpp > gridgen.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  binpres.cpp > binpres.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  transform.cpp > transform.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  quadclip.cpp > quadclip.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  dggrid.cpp > dggrid.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  param.cpp > param.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  binvals.cpp > binvals.depends
g++  -c binvals.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o binvals.o
g++  -c param.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o param.o
g++  -c dggrid.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o dggrid.o
g++  -c quadclip.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o quadclip.o
g++  -c transform.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o transform.o
g++  -c binpres.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o binpres.o
g++  -c gridgen.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o gridgen.o
g++  -c DgHexSF.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o DgHexSF.o
g++  -c clipper.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o clipper.o
g++  -c table.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o table.o
g++  -c util.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie  -o util.o
g++  -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -no-pie   -o dggrid binvals.o param.o dggrid.o quadclip.o transform.o binpres.o gridgen.o DgHexSF.o clipper.o table.o util.o ../../lib/dglib/lib/dglib.a ../../lib/shapelib/lib/shapelib.a ../../lib/proj4lib/lib/proj4lib.a /usr/lib/libgdal.so

Lorsque je tente une commande dggrid :

Code:

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ dggrid
dggrid: command not foun

Pour l'étape avec ./confire, il y a une message d'erreur (désolé, je suis pas un utilsateur de linux en temps normal) :


Code:

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ ./ configure /usr/local CFLAGS=-fPIC CXXFLAGS=-fPIC
bash: ./: Is a directory

Dernière modification par image95 (Wed 30 October 2019 10:52)

Hors ligne

 

#4 Wed 30 October 2019 11:20

tumasgiu
Membre
Lieu: Ajaccio
Date d'inscription: 5 Jul 2010
Messages: 1129

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Salut,

pour l'étape configure, c'est l'espace entre ./ et configure qui provoque l'erreur.

Pour l'appel à votre commande dggrid essayez plutôt :

Code:

./dggrid

( il faut que vous vous trouviez dans le répertoire ~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid )

Pour que vous puissiez lancer le programme en tapant seulement dggrid,
peu importe dans quel répertoire vous vous trouviez,
il faut que le binaire que vous avez compilé soit dans votre PATH.
Vous pouvez essayer de copier le binaire /usr/bin par exemple,
et voir si çà fonctionne.

Dernière modification par tumasgiu (Wed 30 October 2019 11:56)

Hors ligne

 

#5 Wed 30 October 2019 11:35

image95
Participant assidu
Date d'inscription: 6 Sep 2014
Messages: 246

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Bonjour,

je viens de refaire un test :

Code:

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ ./configure /usr/local CFLAGS=-fPIC
bash: ./configure: No such file or directory

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ make clean
rm -rf binvals.o quadclip.o dggrid.o param.o transform.o binpres.o gridgen.o DgHexSF.o clipper.o table.o util.o binvals.depends quadclip.depends dggrid.depends param.depends transform.depends binpres.depends gridgen.depends DgHexSF.depends clipper.depends table.depends util.depends dggrid core ti_files ii_files

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ make
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  util.cpp > util.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  table.cpp > table.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  clipper.cpp > clipper.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  DgHexSF.cpp > DgHexSF.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  gridgen.cpp > gridgen.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  binpres.cpp > binpres.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  transform.cpp > transform.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  quadclip.cpp > quadclip.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  dggrid.cpp > dggrid.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  param.cpp > param.depends
g++  -M -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  binvals.cpp > binvals.depends
g++  -c binvals.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o binvals.o
g++  -c param.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o param.o
g++  -c dggrid.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o dggrid.o
g++  -c quadclip.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o quadclip.o
g++  -c transform.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o transform.o
g++  -c binpres.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o binpres.o
g++  -c gridgen.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o gridgen.o
g++  -c DgHexSF.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o DgHexSF.o
g++  -c clipper.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o clipper.o
g++  -c table.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o table.o
g++  -c util.cpp -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11  -o util.o
g++  -I../../lib/dglib/include -I../../lib/shapelib/include -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11   -o dggrid binvals.o param.o dggrid.o quadclip.o transform.o binpres.o gridgen.o DgHexSF.o clipper.o table.o util.o ../../lib/dglib/lib/dglib.a ../../lib/shapelib/lib/shapelib.a ../../lib/proj4lib/lib/proj4lib.a /usr/lib/libgdal.so

osboxes@normalisation:~/DGGS/DGGRID/DGGRID-master/src/apps/dggrid$ ./dggrid
FATAL ERROR: usage: ./dggrid metaFileName

Dernière modification par image95 (Wed 30 October 2019 11:38)

Hors ligne

 

#6 Wed 30 October 2019 11:54

tumasgiu
Membre
Lieu: Ajaccio
Date d'inscription: 5 Jul 2010
Messages: 1129

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Le programme à l'air de fonctionner mais indique
qu'il faut lui donner comme argument un nom de metafile.
je ne sais pas trop comment fonctionne dggrid, il faudrait lire le manuel d'utilisation.

Hors ligne

 

#7 Wed 30 October 2019 14:34

image95
Participant assidu
Date d'inscription: 6 Sep 2014
Messages: 246

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Merci pour vos réponses.
Vous avez probablement raison, l'etape de compilation a dû fonctionner car il y a bien un fichier dggrid executable qui a été créé.

Concernant gdal, la version qui a été téléchargé par le paquet / installée (gdalinfo --version : DGAL 2.2.3, released 2017/11/20) (installée avec sudo apt-get install libgdal-dev) est assez ancienne. Il faudrait regarder si refaire une compilation de l'outil avec une version de gdal plus récente pourrait etre intéressant.

Hors ligne

 

#8 Wed 30 October 2019 14:34

image95
Participant assidu
Date d'inscription: 6 Sep 2014
Messages: 246

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Après un ultime échange avec le developpeur de l'outil :

a. configure ne fonctionne pas car DGGRID n'utilise pas cmake

b. Il semble que mon dernier test a bien permis de compiler dggrid.

c. Concernant le message d'erreur lors de l'execution de ./dggrid : DGGRID requiert un unique argument de ligne de commande, le nom d'un "métafichier" DGGRID. (cf. la première section du manuel DGGRID : https://webpages.sou.edu/~sahrk/docs/dg … ualV70.pdf )

Dernière modification par image95 (Wed 30 October 2019 15:05)

Hors ligne

 

#9 Wed 30 October 2019 14:34

image95
Participant assidu
Date d'inscription: 6 Sep 2014
Messages: 246

Re: DGGRID et gdal : problème de compilation gdal (Linux)

delete

Dernière modification par image95 (Wed 30 October 2019 14:58)

Hors ligne

 

#10 Wed 30 October 2019 16:46

tumasgiu
Membre
Lieu: Ajaccio
Date d'inscription: 5 Jul 2010
Messages: 1129

Re: DGGRID et gdal : problème de compilation gdal (Linux)

Concernant gdal, la version qui a été téléchargé par le paquet / installée (gdalinfo --version : DGAL 2.2.3, released 2017/11/20) (installée avec sudo apt-get install libgdal-dev) est assez ancienne. Il faudrait regarder si refaire une compilation de l'outil avec une version de gdal plus récente pourrait etre intéressant.


Bonne idée, on compte sur vous pour tester çà et nous faire un retour wink

Hors ligne

 

Pied de page des forums

Powered by FluxBB