DIT112-V20 / group-09

Apache License 2.0
4 stars 1 forks source link

Discrepancies between build configuration and runtime configuration lead to ABI breaks #81

Open RuthgerD opened 4 years ago

RuthgerD commented 4 years ago

On linux cmake (or whoever is responsible) defaults to using gnus's libstdc++, this can be changed via: -DCMAKE_CXX_FLAGS="-stdlib=libc++"
but at the moment this settings does not get passed down when compiling sketches at runtime resulting in ABI mismatch

AeroStun commented 4 years ago

This is tied with a more general issue where the compiler used to compile SMCE and the one used at runtime might be completely different and use widely different settings We cannot afford to force users to use the same compiler to build SMCE and run it, since this would mean that we would be unable to produce redistributable binary packages.

IMO, the best solution would be to passthrough CMake options in our config file, so that users can control it directly (they already can with env-vars, but that's not ideal)

Of course, since we do not expect our users to be much familiar with CMake and the compilation process, we do still need to provide some guard fences:

This can be scripted in CMake

The most dangerous and probably most common case will be Windows users since they can use MinGW, Clang, Clang-cl, or MSVC; if they use a prebuilt binary (which they probably will), MinGW will break; therefore, we will need to additionally detect whether the MinGW version is high enough that it can compile the ArduinoRuntime from source.