Am 12.07.25 um 20:46 schrieb Georg-Johann Lay via Gcc-help:
Maybe someone can give a hint what goes wrong building a canadian cross.
build = x86_64-pc-linux-gnu
host = i686-w64-mingw32
target = avr
$ g++ --version
g++ (Debian 14.2.0-19) 14.2.0
$ i686-w64-mingw32-g++ --version
i686-w64-mingw32-g++ (GCC) 14-win32
What works:
* Building a v15.1 native-cross (B=H=x86_64-pc-linux-gnu, T=avr)
* Building a v15.1 canadian-cross
* Building a v8.5 native-cross (B=H=x86_64-pc-linux-gnu, T=avr)
What fails:
* Building a v8.5 canadian-cross
In any case:
* configure options for native and canadian are the same (except for
--host --enable-mingw-wildcard and --prefix)
* The native-cross is installed and in front of PATH when the canadian
is configured / build.
* builddir is outside of srcdir
The error occurs when building gcc/diagnostic-color.c:
i686-w64-mingw32-g++ -fno-PIE -c -g -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings
-DHAVE_CONFIG_H -I. -I. -I../../src-gcc/gcc -I../../src-gcc/gcc/.
-I../../src-gcc/gcc/../include -I../../src-gcc/gcc/../libcpp/include
-I/home/gjl/boo8/obj-gcc-w32/./gmp -I/home/gjl/boo8/src-gcc/gmp
-I/home/gjl/boo8/obj-gcc-w32/./mpfr/src
-I/home/gjl/boo8/src-gcc/mpfr/src -I/home/gjl/boo8/src-gcc/mpc/src
-I../../src-gcc/gcc/../libdecnumber
-I../../src-gcc/gcc/../libdecnumber/dpd -I../libdecnumber
-I../../src-gcc/gcc/../libbacktrace
-I/home/gjl/boo8/obj-gcc-w32/./isl/include
-I/home/gjl/boo8/src-gcc/isl/include -o diagnostic-color.o -MT
diagnostic-color.o -MMD -MP -MF ./.deps/diagnostic-color.TPo
../../src-gcc/gcc/diagnostic-color.c
../../src-gcc/gcc/system.h:737:30: error: expected identifier before
string constant
737 | #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
| ^~~~~~~~
../../src-gcc/gcc/system.h:737:30: error: expected ‘,’ or ‘...’ before
string constant
../../src-gcc/gcc/system.h:737:30: error: expected identifier before
string constant
737 | #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
| ^~~~~~~~
../../src-gcc/gcc/system.h:737:30: error: expected ‘,’ or ‘...’ before
string constant
As it seems, the error goes like this:
gcc-8/gcc/system.h defines abort():
extern void fancy_abort (const char *, int, const char *)
ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
This is then plugged in /usr/share/mingw-w64/include/msxml.h
which has
IXMLDOMDocument : public IXMLDOMNode
{
...
virtual HRESULT STDMETHODCALLTYPE abort(
) = 0;
...
};
This results in a syntax error of course.
For now I am building with CXXFLAGS=-D__msxml_h__ so that
msxml.h is skipped.
...But setting CXXFLAGS kicks out flags like -g -O2. Is there
a better way? I find CXXFLAGS_FOR_BUILD in Makefile but it
has no effect. https://gcc.gnu.org/install/ doesn't mention
anything either. Or was is CXXFLAGS_FOR_HOST or BUILD_CXXFLAGS ...?
Johann
Maybe this rings a bell and someone knows how to fix that. Compiling by
hand and adding -save-temps -dumpbase "" -g3 changes the error message to
In file included from /usr/share/mingw-w64/include/urlmon.h:458,
from /usr/share/mingw-w64/include/objbase.h:163,
from /usr/share/mingw-w64/include/ole2.h:17,
from /usr/share/mingw-w64/include/wtypes.h:13,
from /usr/share/mingw-w64/include/winscard.h:10,
from /usr/share/mingw-w64/include/windows.h:97,
from ../../src-gcc/gcc/diagnostic-color.c:24:
/usr/share/mingw-w64/include/msxml.h:1104:51: error: expected identifier
before string constant
1104 | virtual HRESULT STDMETHODCALLTYPE abort(
| ^
/usr/share/mingw-w64/include/msxml.h:1104:51: error: expected ‘,’ or
‘...’ before string constant
/usr/share/mingw-w64/include/msxml.h:8309:51: error: expected identifier
before string constant
8309 | virtual HRESULT STDMETHODCALLTYPE abort(
| ^
/usr/share/mingw-w64/include/msxml.h:8309:51: error: expected ‘,’ or
‘...’ before string constant
Attached you find diagnostic-color.ii as generated with -g3 for
reference. When I remove all line notes from the ii so that
the real lines are displayed, the error message is:
diagnostic-color-ii.c:84249:51: error: expected identifier before string
constant
84249 | fancy_abort
("/usr/share/mingw-w64/include/msxml.h", 1104, __FUNCTION__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diagnostic-color-ii.c:84249:51: error: expected ‘,’ or ‘...’ before
string constant
diagnostic-color-ii.c:84724:51: error: expected identifier before string
constant
84724 | fancy_abort
("/usr/share/mingw-w64/include/msxml.h", 8309, __FUNCTION__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diagnostic-color-ii.c:84724:51: error: expected ‘,’ or ‘...’ before
string constant
This is the code:
virtual HRESULT __attribute__((__stdcall__))
fancy_abort
("/usr/share/mingw-w64/include/msxml.h", 1104, __FUNCTION__)
= 0;
For reference, here is I configured GCC v8.5:
$ ../src-gcc/configure --target=avr --enable-languages=c,c++
--with-gnu-as --with-gnu-ld --with-dwarf2 --disable-nls --disable-libcc1
--disable-libssp --disable-plugin --enable-checking=release
--host=i686-w64-mingw32 --build=x86_64-pc-linux-gnu --enable-mingw-wildcard
Thank you
Johann