alus-it / AirspaceConverter

Tool to convert airspace files between different formats: OpenAir, openAIP, KML/KMZ, Polish and Garmin
https://www.alus.it/AirspaceConverter
GNU General Public License v3.0
37 stars 10 forks source link

macOS cross.build now fail #155

Closed efa closed 2 years ago

efa commented 2 years ago

Once worked, I just tested on branch master, but targeting darwin18 so SDK v10.14 like before, now I got this error:

...
CrossCompiling: src/SeeYou.cpp
src/SeeYou.cpp:355:39: error: loop variable 'pair' of type 'const std::pair<int, Waypoint *> &' binds to a temporary constructed from type 'std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::__value_type<int, Waypoint *>, std::__1::__tree_node<std::__1::__value_type<int, Waypoint *>, void *> *, long>>::reference' (aka 'pair<const int, Waypoint *> &') [-Werror,-Wrange-loop-construct]
        for (const std::pair<int,Waypoint*>& pair : waypoints) {
                                             ^
src/SeeYou.cpp:355:7: note: use non-reference type 'std::pair<int, Waypoint *>' to make construction explicit or type 'const std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::__value_type<int, Waypoint *>, std::__1::__tree_node<std::__1::__value_type<int, Waypoint *>, void *> *, long>>::value_type &' (aka 'const pair<const int, Waypoint *> &') to prevent copying
        for (const std::pair<int,Waypoint*>& pair : waypoints) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Makefile.darwin-clang++:123: Release/SeeYou.o] Errore 1

I do not know if it is related to updated "osxcross" cross-compiler I'm using (git version), but it work well on other cross-built project, like my Wilderland: https://github.com/efa/Wilderland Generation for Linux work as before.

efa commented 2 years ago

I tryed to branch tags/v0.3.8 or tags/v0.3.7, but I got the same error. So maybe related to the updated Clang/LLVM that find more errors or is pedantic

alus- commented 2 years ago

It's probably due to a new version of the compiler, I had the same problem on Ubuntu 22.04 it now fixed making the int key also as const.

efa commented 2 years ago

re-building with gcc 12.2 all of my old code in many projects, it find a lot of errors I never noticed. Well. CLang/LLVM is ever more pedantic