Hi Everyone,

First of all, thankyou Oscar for having a look at my earlier pacman issues
- I did not have time to further investigate, and have simply bypassed its
installation for the time being.

My motivation to use MinGW64 is to build a custom GCC cross compiler
toolchain for a custom architecture. However, before I do this, I would
like to try installing a straightforward-as-possible native GCC toolchain,
just to make sure that I understand the differences. I am currently having
some difficulty doing this and would appreciate some pointers.

The GCC source is a git clone of the upstream git repo, with the
"releases/gcc-9.3.0" tag checked out.

First of all, I install the native GCC through pacman base-devel. I then do
$ gcc -v
in order to retrieve the default configuration options. I decided, if I use
the same options as the pacman version, I have maximum chance of everything
working OK.

* I then change --enable-bootstrap to --disable-bootstrap, to save time. This
hopefully isn't known to cause problems?
* also add CFLAGS='-ggdb3 -O0' CXXFLAGS='-ggdb3 -O0'  to set everything up
for debugging (I plan on debugging the custom arch compiler in the future)
* I also changed the --with-pkgversion to "built by Maxim" for
disambiguation (as seen in later logs)

Then I decided to change the --prefix to a directory on my filesystem
"C:\Users\Maxim\Documents\prj\mingw64\install". However I quickly realised
this screws with a lot of things, since during compilation GCC fails to
find `/lib/cpp` directory, and some other stuff.
So instead I decided to leave --prefix to the default '/mingw64', and
configure and make.

The configuration stage goes OK, and so does the build. However I still
would like to install my toolchain to a separate prefix, so I tried using
the advice from the following StackOverflow thread:
https://stackoverflow.com/questions/11307465/destdir-and-prefix-of-make

$ make install prefix=C:\Users\Maxim\Documents\prj\mingw64\install

The install process *almost* finishes, but fails at the following step:

/bin/sh ../../gcc/gcc/../mkinstalldirs
/c/Users/Maxim/Documents/prj/mingw64/install/lib/gcc/x86_64-w64-mingw32/9.3.0/plugin
/usr/bin/install -c -m 644 cc1.exe.a
//c/Users/Maxim/Documents/prj/mingw64/install/lib/gcc/x86_64-w64-mingw32/9.3.0/plugin/cc1.exe.a
/usr/bin/install: cannot create regular file
'//c/Users/Maxim/Documents/prj/mingw64/install/lib/gcc/x86_64-w64-mingw32/9.3.0/plugin/cc1.exe.a':
No such file or directory
make[2]: *** [../../gcc/gcc/c/Make-lang.in:165: c.install-plugin] Error 1
make[2]: Leaving directory '/c/Users/Maxim/Documents/prj/mingw64/build/gcc'
make[1]: *** [Makefile:4416: install-gcc] Error 2
make[1]: Leaving directory '/c/Users/Maxim/Documents/prj/mingw64/build'
make: *** [Makefile:2346: install] Error 2

Still, I do get g++.exe and gcc.exe in my
C:\Users\Maxim\Documents\prj\mingw64\install\bin directory. When I invoke
them with
$ gcc -v
I get
Using built-in specs.
COLLECT_GCC=C:\Users\Maxim\Documents\prj\mingw64\install\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc/configure --prefix=/mingw64
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
--libexecdir=/mingw64/lib --disable-bootstrap --with-arch=x86-64
--with-tune=generic --enable-languages=c,lto,c++ --enable-shared
--enable-static --enable-libatomic --enable-threads=posix --enable-graphite
--enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes
--enable-libstdcxx-time=yes --disable-libstdcxx-pch
--disable-libstdcxx-debug --disable-isl-version-check --enable-lto
--enable-libgomp --disable-multilib --enable-checking=release
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --enable-plugin --with-libiconv --with-system-zlib
--with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64
--with-isl=/mingw64 --with-pkgversion='Built by Maxim' --with-bugurl=
https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
CFLAGS='-ggdb3 -O0' CXXFLAGS='-ggdb3 -O0'
Thread model: posix
gcc version 9.3.0 (Built by Maxim)

But if i try to build something I get
$ gcc -o hello hello.c
gcc.exe: fatal error: cannot execute 'cc1': CreateProcess: No such file or
directory
compilation terminated.

In more detail:
$ gcc -v -o hello hello.c
Using built-in specs.
COLLECT_GCC=C:\Users\Maxim\Documents\prj\mingw64\install\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc/configure --prefix=/mingw64
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
--libexecdir=/mingw64/lib --disable-bootstrap --with-arch=x86-64
--with-tune=generic --enable-languages=c,lto,c++ --enable-shared
--enable-static --enable-libatomic --enable-threads=posix --enable-graphite
--enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes
--enable-libstdcxx-time=yes --disable-libstdcxx-pch
--disable-libstdcxx-debug --disable-isl-version-check --enable-lto
--enable-libgomp --disable-multilib --enable-checking=release
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --enable-plugin --with-libiconv --with-system-zlib
--with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64
--with-isl=/mingw64 --with-pkgversion='Built by Maxim' --with-bugurl=
https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
CFLAGS='-ggdb3 -O0' CXXFLAGS='-ggdb3 -O0'
Thread model: posix
gcc version 9.3.0 (Built by Maxim)
COLLECT_GCC_OPTIONS='-v' '-o' 'hello.exe' '-mtune=generic' '-march=x86-64'
 cc1 -quiet -v -iprefix
c:\users\maxim\documents\prj\mingw64\install\bin\../lib/gcc/x86_64-w64-mingw32/9.3.0/
-D_REENTRANT hello.c -quiet -dumpbase hello.c -mtune=generic -march=x86-64
-auxbase hello -version -o C:\msys64\tmp\ccFyGqWi.s
gcc.exe: fatal error: cannot execute 'cc1': CreateProcess: No such file or
directory
compilation terminated.

One other thing I found worying, is that the -print-prog-name argument
didn't seem to find anything:
$ gcc -print-prog-name cc1
cc1

Compared with the pacman-installed mingw64 gcc:
$ gcc -print-prog-name cc1
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/cc1.exe

And a native Ubuntu:
/usr/lib/gcc/x86_64-linux-gnu/7/cc1

Ultimately what I would like to do is get a 100% clean build and install
into a directory of my choice.
I anticipate that the --with-prefix, --with-bindir, --with-libdir,
--with-sysroot, --with-native-system-headers, etc, will require very fine
cherry-picking to get gcc to pick up just the right set of native headers
vs the newly-built libstdc++ headers, so I will try experimenting with
these configure flags. But mingw64 world is very new to me.

Will greatly appreciate any pointers what so ever,
Maxim
_______________________________________________
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to