GCC vs G++? Failed to build at travis-CI, success locally

Edit: Okay, it is using G++, and now I’m completely stumped.
Edit 2: Solved. Down to a compiler version difference

I had to delete my old topic because the save edit button was simply missing. I’ve been trying to recreate this post and until now Create Topic was missing. Anyway, here goes:

I’ve got a relatively complicated file that requires C++14 to compile. It uses constexpr very particularly and certain expressions must resolve at compile time. When I “pio test” under native, it works fine locally. Similarly when I include this (it’s a library) in one of my projects, the project compiles fine locally.

When it goes to build under the travis-CI environment i get errors that strongly suggest to me that it’s using GCC instead of G++ to compile. For one thing, putc was defined as a macro and that’s a no no in C++.

Currently the build error I’m getting boils down to a nasty constexpr function not being compile time capable under travis-CI (but it works locally, again)

Here’s the rather nasty build error which I will endeavor to explain
https://pastebin.com/raw/pXf0Nwj8

The final function that’s causing the error is a constexpr template function called convert<>(). It’s being invoked in a compile-time only context in other places in my code. It should work and does locally, but the compiler at travis-CI is unable to resolve it as a compile time capable function. At least that’s my best attempt at interpretating it.

I suspect GCC is being invoked rather than G++ but I’m not sure why that would be.

Here’s the project being built: GitHub - codewitch-honey-crisis/gfx: GFX is a device independent graphics library primarily intended for IoT MCUs but not limited to that.

Right near the end of this file is where the dragons live

Travis build says

gcc version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609

Your local compiler might have different behavior because it’s not the same GCC version. 5.4.0 seems ancient to me with the most recent one being 10 or 11.

Yeah I eventually tracked it down to a compiler version difference. I’ve since resolved it by adjusting the distro I was using at travis-CI

1 Like