Pre-compiled headers don't work at all when building on Ubuntu Bionic (w/GCC 7.3.0)
Username: Jeff Hansen
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=2041
To reproduce:
- Make a file test.h:
#define test 1
- Make a file test.c:
void main() { return; }
- Try to create and use a precompiled header
mips-...g++ -c -x c++-header -o test.gch test.h
mips-...g++ -o prog -Winvalid-pch -include test test.c
I get:
cc1plus: warning: test.gch: had text segment at different address
So it appears that something Bionic/GCC7.3 is doing to gcc causes gcc 5.4.0 PCH to break completely. PCH works fine on GCC 7.3 on the host, so it’s likely something that was fixed upstream, but I’m having difficulty finding the fix in gcc’s git history.