It is widely documented, mostly for Windows, that one should never mix a debug and release mode with static library or non ABI libraries in general. Among the reason cited, there is a couple of macro definitions, various optimizations, that could trigger weird compilation behaviour and unmatching symbols.
Now, in Linux with Gcc or Clang, what are the options that may break the compatibility? I guess it is not "-g" as it is used in release mode with debug informations.
And is there some "-O1" with "-O2" mixes that are allowed?