micmacIGN / micmac

Free open-source photogrammetry software tools
http://micmac.ensg.eu
Other
718 stars 153 forks source link

micmac compile error on Ubuntu 20.04 #166

Open IDSipalGit opened 3 years ago

IDSipalGit commented 3 years ago

Hi Everyone, I'm Trying to compile micmac on Ubuntu 20.04, but i get the following error:

[100%] Linking CXX static library libelise.a make[2]: Leaving directory '/home/cm324/micmac/build' [100%] Built target elise make[2]: Entering directory '/home/cm324/micmac/build' Scanning dependencies of target mm3d make[2]: Leaving directory '/home/cm324/micmac/build' make[2]: Entering directory '/home/cm324/micmac/build' [100%] Building CXX object src/CBinaires/CMakeFiles/mm3d.dir/mm3d.cpp.o [100%] Linking CXX executable mm3d /usr/bin/ld: ../libelise.a(cEtapeMecComp.cpp.o): in function cEtapeMecComp::InterpFloat() const': cEtapeMecComp.cpp:(.text+0xf55): undefined reference tocInterpolateurIm2D InterpoleOfEtape<float, double>(cEtapeMEC const&, float, double*)' collect2: error: ld returned 1 exit status make[2]: [src/CBinaires/CMakeFiles/mm3d.dir/build.make:87: src/CBinaires/mm3d] Error 1 make[2]: Leaving directory '/home/cm324/micmac/build' make[1]: [CMakeFiles/Makefile2:608: src/CBinaires/CMakeFiles/mm3d.dir/all] Error 2 make[1]: Leaving directory '/home/cm324/micmac/build' make: *** [Makefile:130: all] Error 2

I'm using cmake version 3.16.3 and gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0 Please, can you give me some suggestions? Thkyou, bye

erupnik commented 3 years ago

Hi, please pull MicMac now and let us know if the problem persists. cheers, e

IDSipalGit commented 3 years ago

Hi erupnik, after clone command i still get this error:

[`` 100%] Linking CXX executable mm3d /usr/bin/ld: ../libelise.a(cEtapeMecComp.cpp.o): in functioncEtapeMecComp::InterpFloat() const': cEtapeMecComp.cpp:(.text+0xf55): undefined reference to `cInterpolateurIm2D InterpoleOfEtape<float, double>(cEtapeMEC const&, float, double*)' collect2: error: ld returned 1 exit status make[2]: [src/CBinaires/CMakeFiles/mm3d.dir/build.make:87: src/CBinaires/mm3d] Error 1 make[2]: Leaving directory '/home/cm324/micmac/build' make[1]: [CMakeFiles/Makefile2:608: src/CBinaires/CMakeFiles/mm3d.dir/all] Error 2 make[1]: Leaving directory '/home/cm324/micmac/build' make: *** [Makefile:130: all] Error 2


My Ubuntu version is 20.10 and not 20.04.

if I lunch sudo git pull form minmac folder i get the following:

cm324@SIPAL-1316-U:~/micmac$ sudo git pull [sudo] password for cm324: warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull:

git config pull.rebase false # merge (the default strategy) git config pull.rebase true # rebase git config pull.ff only # fast-forward only

You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation.



Already up to date.
erupnik commented 3 years ago

Hi, delete all source files and download everyhting from scratch if you're facing merge issues; best, e

MBunel commented 3 years ago

Hello,

For info I have the same issue on compiling on fedora 33 :

/usr/bin/ld : ../libelise.a(cEtapeMecComp.cpp.o) : dans la fonction « cEtapeMecComp::InterpFloat() const » :
cEtapeMecComp.cpp:(.text+0xded) : référence indéfinie vers « cInterpolateurIm2D<float>* InterpoleOfEtape<float, double>(cEtapeMEC const&, float*, double*) »
collect2: erreur: ld a retourné le statut de sortie 1
make[2]: *** [src/CBinaires/CMakeFiles/mm3d.dir/build.make:106 : src/CBinaires/mm3d] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:627 : src/CBinaires/CMakeFiles/mm3d.dir/all] Erreur 2
make: *** [Makefile:149 : all] Erreur 2
Micmac-test commented 3 years ago
jmfriedt commented 3 years ago

Clean git clone will still have the dependency problem cEtapeMecComp.cpp:(.text+0xdcd): undefined reference to `cInterpolateurIm2D InterpoleOfEtape<float, double>(cEtapeMEC const&, float, double*)' when linking mm3d from the IncludeALGLIB branch to SaisieQT. Same for master branch (clean clone and cmake .. -DWITH_QT5=1 -DWERROR=0 -DWITH_CCACHE=OFF in both cases). Even disabling QT5 will not allow for completion of the compilation sequence. Might be an issue related to using the stricter gcc/g++ 10.2.1 ?

trabucayre commented 3 years ago

Try

diff --git a/src/uti_phgrm/MICMAC/cLoadedImage.cpp b/src/uti_phgrm/MICMAC/cLoadedImage.cpp
index 4db327315..55855c068 100644
--- a/src/uti_phgrm/MICMAC/cLoadedImage.cpp
+++ b/src/uti_phgrm/MICMAC/cLoadedImage.cpp
@@ -194,7 +194,7 @@ template <class TypeEl> Im2D_REAL4 * cTplLoadedImage<TypeEl>::FirstFloatIm()

-
+template cInterpolateurIm2D<float> *InterpoleOfEtape(const cEtapeMEC & anEt,float *t1,double *t2);

 template <class TypeEl,class tBase> cInterpolateurIm2D<TypeEl>  * InterpoleOfEtape(const cEtapeMEC & anEt,TypeEl *,tBase *)
 // template <class TypeEl,class tBase> cInterpolateurIm2D<TypeEl>  InterpoleOfEtape(const cEtapeMEC & anEt)

in src/uti_phgrm/MICMAC/cLoadedImage.cpp around line 197, to force g++ to generate required function based on template

jmfriedt commented 3 years ago

That solves the issue on g++ 10 without breaking g++ 9, so problem solved from my perspective. Thanks.