0

I have an issue with CMake and g++ in my Travis-Ci Ubuntu environment.

Compilation failed with the following error message:

In file included from /usr/include/c++/10/cinttypes:35,

                 from /home/travis/build/quicky2000/repositories/edge_matching_puzzle/include/light_border_pieces_db.h:21,

                 from /home/travis/build/quicky2000/repositories/edge_matching_puzzle/src/border_backtracker.cpp:19:

/usr/include/c++/10/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

   32 | #error This file requires compiler and library support \

      |  ^~~~~

In file included from /home/travis/build/quicky2000/repositories/edge_matching_puzzle/src/border_backtracker.cpp:19:

/home/travis/build/quicky2000/repositories/edge_matching_puzzle/include/light_border_pieces_db.h:48:7: error: ‘uint32_t’ has not been declared

   48 |       uint32_t p_left_color,

With g++ 10.5.0 the command line generated by CMake contains -std=c++17

With g++ 7.5.0 the command line generated by CMake contains -std=c++1z

so I assume it should compile. For uint32_t I include cinttypes that itself include cstdint so the declaration should be visible but it looks like if g++ ignore my -std requirement

Here is the compilation command

/usr/bin/g++ -DEDGE_MATCHING_PUZZLE_SELF_TEST \
 -I/home/travis/build/quicky2000/repositories/edge_matching_puzzle/include \
 -I/home/travis/build/quicky2000/repositories/quicky_exception/include \
 -I/home/travis/build/quicky2000/repositories/quicky_utils/include \
 -I/home/travis/build/quicky2000/repositories/simple_gui/include \
 -I/usr/include/SDL \
 -I/home/travis/build/quicky2000/repositories/lib_bmp/include\
 -I/home/travis/build/quicky2000/repositories/FSM_base/include \
 -I/home/travis/build/quicky2000/repositories/FSM_interfaces/include \
 -I/home/travis/build/quicky2000/repositories/FSM_framework/include \
 -I/home/travis/build/quicky2000/repositories/parameter_manager/include \
 -I/home/travis/build/quicky2000/repositories/combinatorics/include \
 -I/home/travis/build/quicky2000/repositories/simplex/include\
 -I/home/travis/build/quicky2000/repositories/my_cuda/include\
 -I/home/travis/build/quicky2000/repositories/EXT_xmlParser/include\
 -std=c++1z -Wall -ansi -pedantic -MD\
 -MT CMakeFiles/edge_matching_puzzle.dir/src/border_backtracker.cpp.o -MF CMakeFiles/edge_matching_puzzle.dir/src/border_backtracker.cpp.o.d\
 -o CMakeFiles/edge_matching_puzzle.dir/src/border_backtracker.cpp.o\
 -c /home/travis/build/quicky2000/repositories/edge_matching_puzzle/src/border_backtracker.cpp

Initially I was thinking that CMake was not using correct compiler due to message with skipped

-- The CXX compiler identification is GNU 10.5.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is GNU 10.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done

but according to Tsyvarev this is not an issue

I install g++-10 using the following commands

sudo apt-get -y install g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
sudo update-alternatives --set gcc /usr/bin/gcc-10

When compiling with my own makefile it works perfectly so I don't think g++ installation has an issue

The full log can be found here:

https://app.travis-ci.com/github/quicky2000/Travis_experiment/jobs/608451462

I have a build reference that was OK 4 months ago and the only things that changed compared to it was some upgrade on apt side including g++ moved from 10.3.0 to 10.5.0 for this Ubuntu version

The full log can be found here:

https://app.travis-ci.com/github/quicky2000/edge_matching_puzzle/jobs/600884943

I have the same issue with an older Travis Ubuntu version and gcc 7.5.0 that is the default gcc for this Ubuntu. According to log this version has not changed

https://app.travis-ci.com/github/quicky2000/Travis_experiment/jobs/608451463

with reference build here:

https://app.travis-ci.com/github/quicky2000/edge_matching_puzzle/jobs/600884944

Quicky
  • 403
  • 1
  • 4
  • 10
  • "Why do Cmake indicate /usr/bin/g++ skipped?" - Here "skipped" is not an error. It just means that CMake doesn't need to check whether the compiler is working, because it has already detected its ABI (see line `-- Detecting CXX compiler ABI info - done`): https://stackoverflow.com/questions/64212759/check-for-working-c-compiler-cl-exe-skipped-visual-studio-2019. You need to include actual **error message** into your post, otherwise it has no sense (or it is a plain duplicate). – Tsyvarev Aug 23 '23 at 10:55
  • OK I modified my question. Due tho this message I was thinking that my compilation errors were due to CMake not using the version of compiler I installed – Quicky Aug 23 '23 at 12:09
  • 1
    According to the log, **full command line** (which should be included into the question post) contains `-ansi` option. This option sets gcc standard to `-std=c++98` ([documentation](https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-ANSI-support)). – Tsyvarev Aug 23 '23 at 12:27
  • Yes you're right ! I was not an issue in the past so I guess that the compilation option order has changed. I will remove this legacy option. Thanks for your help ! Could you put your comment as answer so I can tag it as the solution ? – Quicky Aug 23 '23 at 12:57

0 Answers0