crosstool-ng icon indicating copy to clipboard operation
crosstool-ng copied to clipboard

some successful build report from host Windows build msys2/mingw-w64

Open class101 opened this issue 10 years ago • 29 comments

Built everything in Windows host, builders x86_64-w64-mingw32 and i686-w64-mingw32 (msys2 bases with export PATH=/mingw64/bin:${PATH} before building)

gcc-4.8.2-i686-unknown-linux-dw2 (targets linux 32-bit) gcc-4.8.2-x86_64-unknown-linux-dw2 (targets linux 64-bit) gcc-4.8.2-x86_64-w64-mingw32-seh (targets windows 64-bit) gcc-4.8.2-i686-w64-mingw32-dw2 (targets windows 32-bit) gcc-5666.3-x86_64-apple-darwin10-dw2 (targets mac 64-bit)

To reproduce

  1. Checkout diorcety/crosstool-ng
  2. Checkout and apply the patches seen here https://github.com/mingwandroid/ctng-firefox-builds/branches/ps3.wip/patches/crosstool-ng (svn link)
  3. Apply custom patches and use config files from https://drive.google.com/folderview?id=0B4dcRcayW88VakstaUdkU2tCbXc&usp=sharing

For Ray Donelly:

Most patches are my personal not intended to be pushed but if you think some of them are interesting feel free to re-use at your will

Patch marked as:

update-* => just version updates srcpatch-* => packages source patches (most are old port to new versions) fix-* => Patches bugs I have encountered feature-* => feature I believe missing, whether you statically build or not, you may need both --enable-static and --enable-shared for lib redistributions

Target x86_64-apple-darwin10-dw2:

had a small "Invalid Syntax" issue with Python 3.3 which I have fixed with 150-python-print.patch

diff -durN llvm-3.4.orig/Makefile.rules llvm-3.4/Makefile.rules
--- llvm-3.4.orig/Makefile.rules    2013-11-15 00:51:29.000000000 +0100
+++ llvm-3.4/Makefile.rules 2014-01-31 14:39:32.581437400 +0100
@@ -794,7 +794,7 @@
 #----------------------------------------------------------

 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
-  ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
+  ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print(' '.join(sys.argv[1:]))"
 else
   ECHOPATH := $(Verb)$(ECHO)
 endif
diff -durN llvm-3.4.orig/projects/sample/Makefile.llvm.rules llvm-3.4/projects/sample/Makefile.llvm.rules
--- llvm-3.4.orig/projects/sample/Makefile.llvm.rules   2013-08-05 00:06:11.000000000 +0200
+++ llvm-3.4/projects/sample/Makefile.llvm.rules    2014-01-31 14:40:08.021034000 +0100
@@ -724,7 +724,7 @@
 #----------------------------------------------------------

 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
-  ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
+  ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print(' '.join(sys.argv[1:]))"
 else
   ECHOPATH := $(Verb)$(ECHO)
 endif

Another issue in building final gcc near the end:

ld: warning: could not create compact unwind for __Unwind_Resume: non-standard register 0 being saved in prolog
ld: warning: could not create compact unwind for __Unwind_ForcedUnwind: non-standard register 0 being saved in prolog
ld: warning: could not create compact unwind for __Unwind_RaiseException: non-standard register 0 being saved in prolog
ld: warning: could not create compact unwind for __Unwind_Resume_or_Rethrow: non-standard register 0 being saved in prolog
ld: in X:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sysroot/usr/lib/libc.dylib, file too small for architecture x86_64

fixed by deleting the libc.dylib link and duplicated libSystem.B.dylib and renamed the duplication to libc.dylib

No more issues after that

Target i686-unknown-linux-dw2 / x86_64-unknown-linux-dw2:

at steps libc_start_files and libc you will have to edit the generated file stdio_lim.d which has in it the Windows drive letter which you need to replace in a mingw path, in my case I replace X: to /x

The same for a elf/librtld.map generated file, just need to replace some Windows to unix path

Target Windows : no special issues except one when you use the 32 or 64-bit compiler, it does not find gcc-4.8.2-x86_64-w64-mingw32-seh\lib\gcc\x86_64-w64-mingw32\lib\libgcc_s.a

It first look in X:\libs\gcc-4.8.2-x86_64-w64-mingw32-seh\lib\gcc\x86_64-w64-mingw32\4.8.2 but never in the lib folder near the 4.8.2 one so copying

gcc-4.8.2-x86_64-w64-mingw32-seh\lib\gcc\x86_64-w64-mingw32\lib\libgcc_s.a

to

gcc-4.8.2-x86_64-w64-mingw32-seh\lib\gcc\x86_64-w64-mingw32\4.8.2\libgcc_s.a

fixes the issue

class101 avatar Jan 31 '14 16:01 class101

@class101 this is great we are nearly ready for a ct-ng PKGBUILD and integration into gcc packman package building by the sounds of this.

I successfully built a gcc 4.8.2 newlib toolchain targeting the PS3 yesterday with help from Ray. Things are getting exciting :)

martell avatar Jan 31 '14 16:01 martell

Yes, thanks for helping test this stuff out guys, remaining bugs on my radar (feel free to grab them; I'm currently looking at number 4) are:

  1. Clang and/or Clang++ doesn't find C and/or C++ headers correctly (AFAIK on both Linux or Win64).
  2. Win64-hosted Darwin cross compilers have a bug somewhere in cctools. I think the assembler is OK now, it's some of the subsequent tools (e.g. ld64, ar, ranlib or otool) that read the object files incorrectly.
  3. Clang SEH support for Win64 target. We have a patch that does some of the work, but not all yet. I am hoping by the time I get back to this, people who know LLVM/Clang better than I do will have it all working :-)
  4. glibc-2.15 needs to support multilib (the headers are in conflict, this was fixed for glibc-2.16 by H.J. Lu, and I am in the process of trying to backport the changes).
  5. Longer term we need to figure out how to merge all this with upstream.

mingwandroid avatar Jan 31 '14 17:01 mingwandroid

There is something strange when attempting to use them to compile helloworld c++

#include <iostream>

using namespace std;

main()
{
    cout << "Hello World!";
    return 0;
}

Windows target:

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/bin/x86_64-w64-mingw32-g++.exe helloworld.cpp -o helloworld-win64
X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
collect2.exe: error: ld returned 1 exit status

Success with -L/x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/lib

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/bin/x86_64-w64-mingw32-g++.exe helloworld.cpp -o helloworld-win64 -L/x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/lib

Linux target:

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/bin/x86_64-unknown-linux-gnu-g++.exe helloworld.cpp -o helloworld-linux64
In file included from X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/x86_64-unknown-linux-gnu/bits/c++config.h:426:0,
                 from X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/iostream:38,
                 from helloworld.cpp:1:
X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/x86_64-unknown-linux-gnu/bits/os_defines.h:39:22: fatal error: features.h: No such file or directory
 #include <features.h>
                      ^
compilation terminated.

With -I/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysroot/usr/include

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/bin/x86_64-unknown-linux-gnu-g++.exe helloworld.cpp -o helloworld-linux64 -I/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysroot/usr/include
X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../x86_64-unknown-linux-gnu/bin/ld.exe: cannot find -lgcc_s
collect2.exe: error: ld returned 1 exit status

Success with -I/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysroot/usr/include -L/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/lib64

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/bin/x86_64-unknown-linux-gnu-g++.exe helloworld.cpp -o helloworld-linux64 -I/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysroot/usr/include -L/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/lib64

Darwin does not find lstdc++

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/x86_64-apple-darwin10-g++.exe -O2 -s helloworld.cpp -o helloworld-mac64
ld: warning: option -s is obsolete and being ignored
ld: library not found for -lstdc++
collect2: ld returned 1 exit status

And when adding the libstdc++.dylib (copy of full lib libstdc++.6.0.9.dylib), it can't read all the other dylib links

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/x86_64-apple-darwin10-g++.exe -O2 -s helloworld.cpp -o helloworld-mac64
ld: warning: option -s is obsolete and being ignored
ld: in x:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/../x86_64-apple-darwin10/sysroot//usr/lib/libgcc_s.10.4.dylib, file too small for architecture x86_64
collect2: ld returned 1 exit status

Any idea for Win/Linux targets what I could have done wrong for the need of -I and -L on simple helloworld compilation ?

class101 avatar Jan 31 '14 18:01 class101

To help with getting to the bottom of these simple testcase failures, you should add -v to the command line to see what header paths are being searched. You could also try compilations with -m32 and -m64 to see if either of those work.

I'm guessing you are using the flosoft SDK? If so, your Darwin issues are because of extraction failure due to how the tarball is created and then extracted on Windows, due to it not supporting symlinks properly. There exists no extraction method that I know of on Windows that can do it correctly. 7zip can't do it, creating instead a file with the name of the target in it. MSYS2's tar possibly also can't do it. You could try adding "set MSYS=winsymlinks:nativestrict" in msys2_shell.bat if you have UAC disabled and re-running that batch file and then trying tar. Even if it then works I can't guarantee that using symlinks will work right in the compilers on Windows.

If you have access to a real mac or Linux, to make a good tarball, I would install gnutar (via homebrew on OSX) then do: tar -cjhf macosx10.6.sdk.tar.bz2 MacOSX10.6.sdk

.. the -h option dereferences the symlinks at creation time. IMHO a patch should be written for gnutar to add an option on Windows so that symlinks are handled in a final pass after 'normal' files and directories, but symlinks to symlinks are an extra complication here!

The full details of the problem is that proper symlinks can support a target not existing at time of creation of symlink (the target is created soon afterwards so it is ok) whereas implementations of symlink-as-copy fail in this scenario (I'm not sure about Windows native symlinks, whether this is possible or not - in theory it should be as it's not really a symlink otherwise);

mingwandroid avatar Jan 31 '14 19:01 mingwandroid

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/bin/x86_64-w64-mingw32-g++.exe -v
Using built-in specs.
COLLECT_GCC=X:\libs\gcc-4.8.2-x86_64-w64-mingw32-seh\bin\x86_64-w64-mingw32-g++.exe
COLLECT_LTO_WRAPPER=X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/libexec/gcc/x86_64-w64-mingw32/4.8.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --build=x86_64-build_w64-mingw32 --host=x86_64-build_w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh --with-sysroot=/x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot --enable-languages=c,c++ --with-arch=x86-64 --enable-shared --enable-static --with-pkgversion='crosstool-NG hg+unknown-20140130.120229' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/x/tmp/.build/x86_64-w64-mingw32/buildtools --with-mpfr=/x/tmp/.build/x86_64-w64-mingw32/buildtools --with-mpc=/x/tmp/.build/x86_64-w64-mingw32/buildtools --with-isl=/x/tmp/.build/x86_64-w64-mingw32/buildtools --with-cloog=/x/tmp/.build/x86_64-w64-mingw32/buildtools --with-libelf=/x/tmp/.build/x86_64-w64-mingw32/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++ -lm' --enable-threads=win32 --disable-win32-registry --enable-target-optspace --disable-nls --disable-multilib --with-local-prefix=/x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot --enable-c99 --enable-long-long --with-arch=nocona --with-tune=core2 --disable-win32-registry --disable-libstdcxx-debug --disable-werror --disable-symvers --enable-version-specific-runtime-libs --enable-static --enable-fully-dynamic-string --enable-seh-exceptions
Thread model: win32
gcc version 4.8.2 (crosstool-NG hg+unknown-20140130.120229)

Well not really a problem for libgcc_s because I have checked the msys2 base in msys64\mingw64\lib\gcc\x86_64-w64-mingw32\ and there is no lib folder, libgcc_s.a is in the 4.8.2 folder with other lib, so I manually moves all in the $version folder since it is the first path checked and lib is never checked (checked with Process Monitor)

I see for Darwin If I remember https://github.com/phracker/MacOSX-SDKs, I took the 10.6 on the mediafire links he provides, and then my mistake I think I have used 7-zip, will try again based on your recommendations and tar this time because indeed I experienced some other issues extracting tars with 7z in the past, thanks for pointing out this.

class101 avatar Jan 31 '14 20:01 class101

Wow set MSYS=winsymlinks:nativestrict is wonderful this is what I was looking for makes true links ! I think I'm going to rebuild with this

class101 avatar Jan 31 '14 20:01 class101

If you use -v but also supply a c/c++ file to compile you will get the paths printed out:

e.g:

/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/bin/x86_64-unknown-linux-gnu-g++.exe helloworld.cpp -o helloworld-linux64 -v

.. I think this (host=Win64 target=Linux) is the most interesting case to fix first. Most likely something went wrong with either kernel headers or libc build. I built an eglibc-2.18 with GCC 4.8.2 cross compiler that you can find here:

https://www.dropbox.com/s/66pevpija3731ly/steamos-gcc-4.8.2-eglibc-2.18-win64.7z

(you need to add /mingw64/bin to your PATH before running it!)

.. this one works fine for me with both helloworld.c and helloworld.cpp without needing any -I or -L arguments. I tested both -m32 and -m64 and all cases generated executables that ran correctly on Arch Linux x86-64. Please compare your build.log with build.log.bz2 in that 7z to see if you can figure out what's different. Also, I've not had a chance to check over your patches yet and they're probably fine, but it might be a good idea to try a build using just:

./build.sh --target-os=linux

to see if you get compilers that work the same as mine.

I'm interested to know your results with Darwin SDK extracted with native symlinks, was everything ok?

I will be taking a break from hacking for the next day and a half, but I'll try to respond to any questions via email.

mingwandroid avatar Jan 31 '14 23:01 mingwandroid

On Darwin I have just attempted yet to extract with msys tar the xz he mades but it was the same type of links just a filename inside the file Now I test with checking out directly from the git repo because I see on github they are symlinks but on windows they are converted into files with this time "link" in front of the filename so I m running a new build attempt with these files instead to test

For Linux interesting with -v look what I get

ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysrootX:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../include"

$ /x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/bin/x86_64-unknown-linux-gnu-g++.exe -O2 -s helloworld.cpp -o helloworld-linux64 -v
Using built-in specs.
COLLECT_GCC=X:\libs\gcc-4.8.2-x86_64-unknown-linux-dw2\bin\x86_64-unknown-linux-gnu-g++.exe
COLLECT_LTO_WRAPPER=X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper.exe
Target: x86_64-unknown-linux-gnu
Configured with: ../../../src/gcc-4.8.2/configure --build=x86_64-build_w64-mingw32 --host=x86_64-build_w64-mingw32 --target=x86_64-unknown-linux-gnu --prefix=/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2 --with-sysroot=/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysroot --enable-languages=c,c++ --with-arch=x86-64 --enable-shared --enable-static --with-pkgversion='crosstool-NG hg+unknown-20140201.013659' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/x/tmp/.build/x86_64-unknown-linux-gnu/buildtools --with-mpfr=/x/tmp/.build/x86_64-unknown-linux-gnu/buildtools --with-mpc=/x/tmp/.build/x86_64-unknown-linux-gnu/buildtools --with-isl=/x/tmp/.build/x86_64-unknown-linux-gnu/buildtools --with-cloog=/x/tmp/.build/x86_64-unknown-linux-gnu/buildtools --with-libelf=/x/tmp/.build/x86_64-unknown-linux-gnu/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++ -lm' --enable-threads=posix --enable-target-optspace --disable-nls --disable-multilib --with-local-prefix=/x/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysroot --enable-c99 --enable-long-long --with-arch=nocona --with-tune=core2 --disable-win32-registry --disable-libstdcxx-debug --disable-werror --disable-symvers --enable-version-specific-runtime-libs --enable-static --enable-fully-dynamic-string --enable-dw2-exceptions --disable-sjlj-exceptions
Thread model: posix
gcc version 4.8.2 (crosstool-NG hg+unknown-20140201.013659)
COLLECT_GCC_OPTIONS='-O2' '-s' '-o' 'helloworld-linux64' '-v' '-shared-libgcc' '-mtune=core2' '-march=nocona'
 X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/cc1plus.exe -quiet -v -D_GNU_SOURCE helloworld.cpp -quiet -dumpbase helloworld.cpp -mtune=core2 -march=nocona -auxbase helloworld -O2 -version -o X:\libs\msys64\tmp\ccxTcuTt.s
GNU C++ (crosstool-NG hg+unknown-20140201.013659) version 4.8.2 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysrootX:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../include"
ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../x86_64-unknown-linux-gnu/include"
ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/x86_64-unknown-linux-gnu/sysrootX:/libs/msys64/include"
#include "..." search starts here:
#include <...> search starts here:
 X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++
 X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/x86_64-unknown-linux-gnu
 X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/backward
 X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include
 X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed
End of search list.
GNU C++ (crosstool-NG hg+unknown-20140201.013659) version 4.8.2 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3822c7805f0e7ca94c37950f1b977540
In file included from X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/x86_64-unknown-linux-gnu/bits/c++config.h:426:0,
                 from X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/iostream:38,
                 from helloworld.cpp:1:
X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include/c++/x86_64-unknown-linux-gnu/bits/os_defines.h:39:22: fatal error: features.h: No such file or directory
 #include <features.h>
                      ^
compilation terminated.

class101 avatar Feb 01 '14 03:02 class101

I think I see when the bug happens, when it is building gcc final it fails and when I have used process monitor I realize it is looking for

X:\libs\gcc-4.8.2-x86_64-unknown-linux-dw2\x86_64-unknown-linux-gnu\include or X:\libs\gcc-4.8.2-x86_64-unknown-linux-dw2\x86_64-unknown-linux-gnu\sys-include

but they do not exists, so to fix I have made junction sys-include sysroot\usr\include but instead I must have done junction include sysroot\usr\include

It compiles fine now without -I because the previous nonexistent directory is now junction:

ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-unknown-linux-dw2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../x86_64-unknown-linux-gnu/include"

class101 avatar Feb 01 '14 03:02 class101

The windows symlinks didn't cause problems to build windows and linux targets

For Darwin not sure yet I fail at another point

make[5]: Leaving directory '/x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/gcc'
/x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/./gcc/xgcc -B/x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/./gcc/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/bin/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/lib/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/lib/system -isystem /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/include -isystem /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sys-include  -O2  -g -Os -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -dynamiclib -nodefaultlibs -install_name /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/lib/gcc/x86_64-apple-darwin10/4.2.1/libgcc_s`if test . = ppc64 ; then echo _. ; fi`.1.dylib -single_module -o ./libgcc_s.1.dylib.tmp -Wl,-exported_symbols_list,libgcc/./libgcc.map -compatibility_version 1 -current_version 1.0  libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lshrdi3_s.o libgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o libgcc/./_ucmpdi2_s.o libgcc/./_clear_cache_s.o libgcc/./_enable_execute_stack_s.o libgcc/./_trampoline_s.o libgcc/./__main_s.o libgcc/./_absvsi2_s.o libgcc/./_absvdi2_s.o libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o libgcc/./_subvsi3_s.o libgcc/./_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvdi3_s.o libgcc/./_negvsi2_s.o libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o libgcc/./_ffssi2_s.o libgcc/./_ffsdi2_s.o libgcc/./_clz_s.o libgcc/./_clzsi2_s.o libgcc/./_clzdi2_s.o libgcc/./_ctzsi2_s.o libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.o libgcc/./_popcountsi2_s.o libgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o libgcc/./_paritydi2_s.o libgcc/./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powixf2_s.o libgcc/./_powitf2_s.o libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o libgcc/./_mulxc3_s.o libgcc/./_multc3_s.o libgcc/./_divsc3_s.o libgcc/./_divdc3_s.o libgcc/./_divxc3_s.o libgcc/./_divtc3_s.o libgcc/./_bswapsi2_s.o libgcc/./_bswapdi2_s.o libgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfsi_s.o libgcc/./_fixunsxfsi_s.o libgcc/./_fixsfdi_s.o libgcc/./_fixsfti_s.o libgcc/./_fixunssfdi_s.o libgcc/./_fixunssfti_s.o libgcc/./_floatdisf_s.o libgcc/./_floattisf_s.o libgcc/./_floatundisf_s.o libgcc/./_floatuntisf_s.o libgcc/./_fixdfdi_s.o libgcc/./_fixdfti_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_fixunsdfti_s.o libgcc/./_floatdidf_s.o libgcc/./_floattidf_s.o libgcc/./_floatundidf_s.o libgcc/./_floatuntidf_s.o libgcc/./_fixxfdi_s.o libgcc/./_fixxfti_s.o libgcc/./_fixunsxfdi_s.o libgcc/./_fixunsxfti_s.o libgcc/./_floatdixf_s.o libgcc/./_floattixf_s.o libgcc/./_floatundixf_s.o libgcc/./_floatuntixf_s.o libgcc/./_fixtfdi_s.o libgcc/./_fixtfti_s.o libgcc/./_fixunstfdi_s.o libgcc/./_fixunstfti_s.o libgcc/./_floatditf_s.o libgcc/./_floattitf_s.o libgcc/./_floatunditf_s.o libgcc/./_floatuntitf_s.o libgcc/./_divdi3_s.o libgcc/./_moddi3_s.o libgcc/./_udivdi3_s.o libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o libgcc/./_udivmoddi4_s.o libgcc/./darwin-64_s.o libgcc/./unwind-dw2_s.o libgcc/./unwind-dw2-fde-darwin_s.o libgcc/./unwind-sjlj_s.o libgcc/./unwind-c_s.o -lc
ld: library not found for -ldylib1.o
collect2: ld returned 1 exit status
libgcc.mk:795: recipe for target 'libgcc_s.dylib' failed

with -v

 /x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/./gcc/xgcc -B/x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/./gcc/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/bin/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/lib/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/lib/system -isystem /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/include -isystem /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sys-include  -O2  -g -Os -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -dynamiclib -nodefaultlibs -install_name /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/lib/gcc/x86_64-apple-darwin10/4.2.1/libgcc_s`if test . = ppc64 ; then echo _. ; fi`.1.dylib -single_module -o ./libgcc_s.1.dylib.tmp -Wl,-exported_symbols_list,libgcc/./libgcc.map -compatibility_version 1 -current_version 1.0  libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lshrdi3_s.o libgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o libgcc/./_ucmpdi2_s.o libgcc/./_clear_cache_s.o libgcc/./_enable_execute_stack_s.o libgcc/./_trampoline_s.o libgcc/./__main_s.o libgcc/./_absvsi2_s.o libgcc/./_absvdi2_s.o libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o libgcc/./_subvsi3_s.o libgcc/./_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvdi3_s.o libgcc/./_negvsi2_s.o libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o libgcc/./_ffssi2_s.o libgcc/./_ffsdi2_s.o libgcc/./_clz_s.o libgcc/./_clzsi2_s.o libgcc/./_clzdi2_s.o libgcc/./_ctzsi2_s.o libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.o libgcc/./_popcountsi2_s.o libgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o libgcc/./_paritydi2_s.o libgcc/./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powixf2_s.o libgcc/./_powitf2_s.o libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o libgcc/./_mulxc3_s.o libgcc/./_multc3_s.o libgcc/./_divsc3_s.o libgcc/./_divdc3_s.o libgcc/./_divxc3_s.o libgcc/./_divtc3_s.o libgcc/./_bswapsi2_s.o libgcc/./_bswapdi2_s.o libgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfsi_s.o libgcc/./_fixunsxfsi_s.o libgcc/./_fixsfdi_s.o libgcc/./_fixsfti_s.o libgcc/./_fixunssfdi_s.o libgcc/./_fixunssfti_s.o libgcc/./_floatdisf_s.o libgcc/./_floattisf_s.o libgcc/./_floatundisf_s.o libgcc/./_floatuntisf_s.o libgcc/./_fixdfdi_s.o libgcc/./_fixdfti_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_fixunsdfti_s.o libgcc/./_floatdidf_s.o libgcc/./_floattidf_s.o libgcc/./_floatundidf_s.o libgcc/./_floatuntidf_s.o libgcc/./_fixxfdi_s.o libgcc/./_fixxfti_s.o libgcc/./_fixunsxfdi_s.o libgcc/./_fixunsxfti_s.o libgcc/./_floatdixf_s.o libgcc/./_floattixf_s.o libgcc/./_floatundixf_s.o libgcc/./_floatuntixf_s.o libgcc/./_fixtfdi_s.o libgcc/./_fixtfti_s.o libgcc/./_fixunstfdi_s.o libgcc/./_fixunstfti_s.o libgcc/./_floatditf_s.o libgcc/./_floattitf_s.o libgcc/./_floatunditf_s.o libgcc/./_floatuntitf_s.o libgcc/./_divdi3_s.o libgcc/./_moddi3_s.o libgcc/./_udivdi3_s.o libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o libgcc/./_udivmoddi4_s.o libgcc/./darwin-64_s.o libgcc/./unwind-dw2_s.o libgcc/./unwind-dw2-fde-darwin_s.o libgcc/./unwind-sjlj_s.o libgcc/./unwind-c_s.o -lc -v
Reading specs from X:/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/gcc/specs
Target: x86_64-apple-darwin10
Configured with: ../../../src/gcc-5666.3/configure --build=x86_64-build_w64-mingw32 --host=x86_64-build_w64-mingw32 --target=x86_64-apple-darwin10 --prefix=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2 --with-sysroot=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sysroot --enable-languages=c,c++ --with-arch=x86-64 --enable-shared --enable-static --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-cloog=/x/tmp/.build/x86_64-apple-darwin10/buildtools --with-libelf=/x/tmp/.build/x86_64-apple-darwin10/buildtools --with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm --enable-threads=posix --enable-target-optspace --without-long-double-128 --disable-nls --disable-multilib --with-gxx-include-dir=./usr/include/c++/4.2.1 --with-ld=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/x86_64-apple-darwin10-ld.exe --with-ar=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/x86_64-apple-darwin10-ar.exe --with-as=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/x86_64-apple-darwin10-as.exe --with-ranlib=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/x86_64-apple-darwin10-ranlib.exe --with-lipo=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/bin/x86_64-apple-darwin10-lipo.exe --with-local-prefix=/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sysroot --enable-c99 --enable-long-long --with-arch=nocona --with-tune=core2 --disable-win32-registry --disable-libstdcxx-debug --disable-werror --disable-symvers --enable-version-specific-runtime-libs --enable-static --enable-fully-dynamic-string --enable-dw2-exceptions --disable-sjlj-exceptions
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
 X:/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/gcc/collect2.exe -dynamic -dylib -dylib_compatibility_version 1 -dylib_current_version 1.0 -arch x86_64 -dylib_install_name X:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/lib/gcc/x86_64-apple-darwin10/4.2.1/libgcc_s.1.dylib -macosx_version_min 10.4 -single_module -syslibroot X:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sysroot -weak_reference_mismatches non-weak -o ./libgcc_s.1.dylib.tmp -ldylib1.o -LX:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sysroot/lib -LX:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sysroot/usr/lib -LX:/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/gcc -LX:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/bin -LX:/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sysroot/lib -exported_symbols_list libgcc/./libgcc.map libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lshrdi3_s.o libgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o libgcc/./_ucmpdi2_s.o libgcc/./_clear_cache_s.o libgcc/./_enable_execute_stack_s.o libgcc/./_trampoline_s.o libgcc/./__main_s.o libgcc/./_absvsi2_s.o libgcc/./_absvdi2_s.o libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o libgcc/./_subvsi3_s.o libgcc/./_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvdi3_s.o libgcc/./_negvsi2_s.o libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o libgcc/./_ffssi2_s.o libgcc/./_ffsdi2_s.o libgcc/./_clz_s.o libgcc/./_clzsi2_s.o libgcc/./_clzdi2_s.o libgcc/./_ctzsi2_s.o libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.o libgcc/./_popcountsi2_s.o libgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o libgcc/./_paritydi2_s.o libgcc/./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powixf2_s.o libgcc/./_powitf2_s.o libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o libgcc/./_mulxc3_s.o libgcc/./_multc3_s.o libgcc/./_divsc3_s.o libgcc/./_divdc3_s.o libgcc/./_divxc3_s.o libgcc/./_divtc3_s.o libgcc/./_bswapsi2_s.o libgcc/./_bswapdi2_s.o libgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfsi_s.o libgcc/./_fixunsxfsi_s.o libgcc/./_fixsfdi_s.o libgcc/./_fixsfti_s.o libgcc/./_fixunssfdi_s.o libgcc/./_fixunssfti_s.o libgcc/./_floatdisf_s.o libgcc/./_floattisf_s.o libgcc/./_floatundisf_s.o libgcc/./_floatuntisf_s.o libgcc/./_fixdfdi_s.o libgcc/./_fixdfti_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_fixunsdfti_s.o libgcc/./_floatdidf_s.o libgcc/./_floattidf_s.o libgcc/./_floatundidf_s.o libgcc/./_floatuntidf_s.o libgcc/./_fixxfdi_s.o libgcc/./_fixxfti_s.o libgcc/./_fixunsxfdi_s.o libgcc/./_fixunsxfti_s.o libgcc/./_floatdixf_s.o libgcc/./_floattixf_s.o libgcc/./_floatundixf_s.o libgcc/./_floatuntixf_s.o libgcc/./_fixtfdi_s.o libgcc/./_fixtfti_s.o libgcc/./_fixunstfdi_s.o libgcc/./_fixunstfti_s.o libgcc/./_floatditf_s.o libgcc/./_floattitf_s.o libgcc/./_floatunditf_s.o libgcc/./_floatuntitf_s.o libgcc/./_divdi3_s.o libgcc/./_moddi3_s.o libgcc/./_udivdi3_s.o libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o libgcc/./_udivmoddi4_s.o libgcc/./darwin-64_s.o libgcc/./unwind-dw2_s.o libgcc/./unwind-dw2-fde-darwin_s.o libgcc/./unwind-sjlj_s.o libgcc/./unwind-c_s.o -lc
ld: library not found for -ldylib1.o
collect2: ld returned 1 exit status

class101 avatar Feb 01 '14 04:02 class101

Let's focus on Linux for now. I don't need to make any junction points. Why are you making any? Which kernel version and libc version are you building? On Feb 1, 2014 4:58 AM, "Arnaud.Dovi" [email protected] wrote:

The windows symlinks didn't cause problems to build windows and linux targets

For Darwin not sure yet I fail at another point

make[5]: Leaving directory '/x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/gcc' /x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/./gcc/xgcc -B/x/tmp/.build/x86_64-apple-darwin10/build/build-cc-gcc-final/./gcc/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/bin/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/lib/ -B/x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/lib/system -isystem /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/include -isystem /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/x86_64-apple-darwin10/sys-include -O2 -g -Os -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -dynamiclib -nodefaultlibs -install_name /x/libs/gcc-5666.3-x86_64-apple-darwin10-dw2/lib/gcc/x86_64-apple-darwin10/4.2.1/libgcc_sif test . = ppc64 ; then echo _. ; fi.1.dylib -single_module -o ./libgcc_s.1.dylib.tmp - Wl,-exported_symbols_list,libgcc/./libgcc.map -compatibility_version 1 -current_version 1.0 libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lshrdi3_s.o libgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o libgcc/./_ucmpdi2_s.o libgcc/./_clear_cache_s.o libgcc/./_enable_execute_stack_s.o libgcc/./_trampoline_s.o libgcc/./__main_s.o libgcc/./_absvsi2_s.o libgcc/./_absvdi2_s.o libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o libgcc/./_subvsi3_s.o libgcc/./_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvdi3_s.o libgcc/./_negvsi2_s.o libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o libgcc/./_ffssi2_s.o libgcc/./_ffsdi2_s.o libgcc/./_clz_s.o libgcc/./_clzsi2_s.o libgcc/./_clzdi2_s.o libgcc/./_ctzsi2_s.o libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.o libgcc/./_popcountsi2_s.o libgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o libgcc/./_paritydi2_s.o libgcc/./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powixf2_s.o libgcc/./_powitf2_s.o libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o libgcc /./_mulxc3_s.o libgcc/./_multc3_s.o libgcc/./_divsc3_s.o libgcc/./_divdc3_s.o libgcc/./_divxc3_s.o libgcc/./_divtc3_s.o libgcc/./_bswapsi2_s.o libgcc/./_bswapdi2_s.o libgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfsi_s.o libgcc/./_fixunsxfsi_s.o libgcc/./_fixsfdi_s.o libgcc/./_fixsfti_s.o libgcc/./_fixunssfdi_s.o libgcc/./_fixunssfti_s.o libgcc/./_floatdisf_s.o libgcc/./_floattisf_s.o libgcc/./_floatundisf_s.o libgcc/./_floatuntisf_s.o libgcc/./_fixdfdi_s.o libgcc/./_fixdfti_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_fixunsdfti_s.o libgcc/./_floatdidf_s.o libgcc/./_floattidf_s.o libgcc/./_floatundidf_s.o libgcc/./_floatuntidf_s.o libgcc/./_fixxfdi_s.o libgcc/./_fixxfti_s.o libgcc/./_fixunsxfdi_s.o libgcc/./_fixunsxfti_s.o libgcc/./_floatdixf_s.o libgcc/./_floattixf_s.o libgcc/./_floatundixf_s.o libgcc/./_floatuntixf_s.o libgcc/./_fixtfdi_s.o libgcc/./_fixtfti_s.o libgcc/./_fixunstfdi_s.o libgcc/./_fixunstfti_s.o libgcc/./_floatditf_s.o libgcc/./_floattitf_s.o libgcc/./_floatunditf_s.o libgcc /./_floatuntitf_s.o libgcc/./_divdi3_s.o libgcc/./_moddi3_s.o libgcc/./_udivdi3_s.o libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o libgcc/./_udivmoddi4_s.o libgcc/./darwin-64_s.o libgcc/./unwind-dw2_s.o libgcc/./unwind-dw2-fde-darwin_s.o libgcc/./unwind-sjlj_s.o libgcc/./unwind-c_s.o -lc ld: library not found for -ldylib1.o collect2: ld returned 1 exit statuslibgcc.mk:795: recipe for target 'libgcc_s.dylib' failed

Reply to this email directly or view it on GitHubhttps://github.com/diorcety/crosstool-ng/issues/13#issuecomment-33863801 .

mingwandroid avatar Feb 01 '14 08:02 mingwandroid

3.13 and glibc 2.18, because it fails at final compiler for not finding some headers in x86_64-unknown-linux-gnu\include or x86_64-unknown-linux-gnu\sys-include so I made it just junction instead of patching

class101 avatar Feb 01 '14 11:02 class101

OK when I get back I will try 3.13. As I say I didn't have this problem and it would be good if you can try just with build.sh.. Modify the version number for the kernel in that script and copy my kernel patches across for 3.13 only. On Feb 1, 2014 11:38 AM, "Arnaud.Dovi" [email protected] wrote:

3.13 and glibc 2.18, because it fails at final compiler for not finding some headers in x86_64-unknown-linux-gnu\include or x86_64-unknown-linux-gnu\sys-include so I made it just junction instead of patching

Reply to this email directly or view it on GitHubhttps://github.com/diorcety/crosstool-ng/issues/13#issuecomment-33869412 .

mingwandroid avatar Feb 01 '14 11:02 mingwandroid

yeah but build.sh is too problematic, hardcoding version , uses multilib and I'm not, compiling gettext and libiconv twice so only the compilation of both of these package is as long or maybe longuer than building the whole gcc process so it is boring to do this on windows. Btw I have found your osx tarball in build.sh to correctly extract symlinks under a msys2 with nativestrict links so I will use this one that's cool. While try instead to compare the the build.logs at the configuration stage to see if I can notice important difference , will probably be faster

class101 avatar Feb 01 '14 13:02 class101

I have uploaded my build.log for linux64 nomultilib and yours here:

https://drive.google.com/folderview?id=0B4dcRcayW88VakstaUdkU2tCbXc&usp=sharing

if you can help me find the diff

class101 avatar Feb 01 '14 13:02 class101

compared both build log and the main difference I note is me using '--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' instead of you using '-lstdc++ -lm' in LDFLAGS

Also I'm building in a posix=1 environment and you not I think

So below are the changes of my build.log with your build.log


[WARN ] Your file system in '/c/ctng-build-x-l-none-4_8_2-x86_64-213be3fb/.build' is not case-sensitive!

libiconv: no gettext: no GMP: no -g, -pipe to LDFLAGS MPFR: no -g, -pipe to LDFLAGS ISL: no -g, -pipe to LDFLAGS CLOOG: no -g, -pipe to LDFLAGS MPC: no -g, -pipe to LDFLAGS binutils: no -g, -pipe to LDFLAGS, --disable-multilib pass-1 core C gcc compiler: no -g, -pipe to LDFLAGS, no "-lstdc++ -lm" in LDFLAGS, with '--with-arch=x86-64', no '--enable-targets=all', with '--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm', --disable-multilib '--with-arch=nocona' '--with-tune=core2' '--disable-win32-registry' '--disable-libstdcxx-debug' '--disable-werror' '--disable-symvers' '--enable-version-specific-runtime-libs' '--enable-static' '--enable-fully-dynamic-string' '--enable-dw2-exceptions' '--disable-sjlj-exceptions' libc_start (glibc 2.18 not "e"): with -march=x86-64 '--disable-debug' '--disable-sanity-checks', no '--enable-obsolete-rpc' '--enable-kernel=3.13.0' '--enable-static' pass-2 core C gcc compiler: no -g, -pipe to LDFLAGS, no "-lstdc++ -lm" in LDFLAGS, with '--with-arch=x86-64', no '--enable-targets=all', with '--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm', --disable-multilib '--with-arch=nocona' '--with-tune=core2' '--disable-win32-registry' '--disable-libstdcxx-debug' '--disable-werror' '--disable-symvers' '--enable-version-specific-runtime-libs' '--enable-static' '--enable-fully-dynamic-string' '--enable-dw2-exceptions' '--disable-sjlj-exceptions' libc (glibc 2.18 not "e"): with -march=x86-64 '--disable-debug' '--disable-sanity-checks', no '--enable-obsolete-rpc' '--enable-kernel=3.13.0' '--enable-static' final gcc: no -g, -pipe to LDFLAGS, no "-lstdc++ -lm" in LDFLAGS, with '--with-arch=x86-64', no '--enable-targets=all', with '--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm', --disable-multilib '--with-arch=nocona' '--with-tune=core2' '--disable-win32-registry' '--disable-libstdcxx-debug' '--disable-werror' '--disable-symvers' '--enable-version-specific-runtime-libs' '--enable-static' '--enable-fully-dynamic-string' '--enable-dw2-exceptions' '--disable-sjlj-exceptions'

class101 avatar Feb 01 '14 15:02 class101

Btw I have found an explanation why libgcc_s is installed in wrong folders, this is due to --enable-version-specific-runtime-libs

=== Build libgcc === [BLIBGCC]

Reenter the build directory used earlier in [BCORGCC], and issue
"make all-target-libgcc", then "make install-target-libgcc".

This will install libgcc. As of writing, there is a minor bug when
--enable-version-specific-runtime-libs is used, libgcc_s.a is
installed incorrectly.

Move it from:
<prefix>/lib/gcc/<arch>/lib32/libgcc_s.a to 
<prefix>/lib/gcc/<arch>/<version>/32/libgcc_s.a
and
<prefix>/lib/gcc/<arch>/lib64/libgcc_s.a to
<prefix>/lib/gcc/<arch>/<version>/libgcc_s.a

The libgcc dll is also clobbered during install, search the build
directory for the dll and install it to separate directories as you
see fit. Make sure 32bit apps only see the 32bit variant, same for
64bit apps.

https://sourceforge.net/p/mingw-w64/code/HEAD/tree/trunk/mingw-w64-doc/howto-build/mingw-w64-howto-build-adv.txt

class101 avatar Feb 01 '14 16:02 class101

I am taking a day off from hacking today. I will try to look at it later on tomorrow. Perhaps I did break noon multilib. I will add an option for system gettext and iconv too. On Feb 1, 2014 1:07 PM, "Arnaud.Dovi" [email protected] wrote:

I have uploaded my build.log for linux64 nomultilib and yours here:

https://drive.google.com/folderview?id=0B4dcRcayW88VakstaUdkU2tCbXc&usp=sharing

if you can help me find the diff

Reply to this email directly or view it on GitHubhttps://github.com/diorcety/crosstool-ng/issues/13#issuecomment-33871173 .

mingwandroid avatar Feb 01 '14 16:02 mingwandroid

In meantimes since I added bunch of custom args as --enable-version-specific-runtime-libs I will remove them to check if I can get better results because indeed I smell it is hiding a more general issue because in all of my 3 targets, I don't have any tupleDir\include at all and in place of tupleDir\lib I have a symlink to sysroot\lib where in yours you have tupleDir\include\c++ and your tupleDir\lib is not symlink but contains libs directly, I'm probably causing this with a custom option Im using everywhere like --enable-version-specific-runtime-libs , will do more tests

//edit:Even my win target returns strange things when compiling with -v so It is not really linux issue

ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysrootX:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../include"
ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/include/c++
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/include/c++/x86_64-w64-mingw32
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/include/c++/backward
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/include
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/include-fixed
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot/mingw/include
End of search list.

class101 avatar Feb 01 '14 16:02 class101

also is it normal that with set MSYS=winsymlinks:nativestrict the configure scripts does not detect ln -s working ? because when building I still get a no for ln -s , using cp -Rr instead

class101 avatar Feb 01 '14 16:02 class101

I never tried with that option.. On Feb 1, 2014 4:54 PM, "Arnaud.Dovi" [email protected] wrote:

also is it normal that with set MSYS=winsymlinks:nativestrict the configure scripts does not detect ln -s working ? because when building I still get a no for ln -s , using cp -Rr instead

Reply to this email directly or view it on GitHubhttps://github.com/diorcety/crosstool-ng/issues/13#issuecomment-33876657 .

mingwandroid avatar Feb 01 '14 18:02 mingwandroid

nvm I should have read configure, I always forget there is the line number that is showable for this purpose. In case you wonder to know why this is a known issue : On MSYS, both "ln -s file dir" and "ln file dir" fail.

this is the ln -s test done

rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
  rm -f conf$$.dir/conf$$.file
else
  rm -f conf$$.dir
  mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
  if ln -s conf$$.file conf$$ 2>/dev/null; then
    as_ln_s='ln -s'
    # ... but there are two gotchas:
    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    # In both cases, we have to default to `cp -pR'.
    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
      as_ln_s='cp -pR'
  elif ln conf$$.file conf$$ 2>/dev/null; then
    as_ln_s=ln
  else
    as_ln_s='cp -pR'
  fi
else
  as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null

class101 avatar Feb 01 '14 21:02 class101

I confirm removing --enable-version-specific-runtime-libs I had added as custom option changes a lot of folder position, looks much better without and as it finds includes and libs without any special argument, still a non existent directory being searched but not a big deal I believe since sysroot\mingw is in the search path already

Administrator@WIN81PRO /x/helloworld
$ /x/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/bin/x86_64-w64-mingw32-g++.exe -O2 -s helloworld.cpp -o helloworld-win64 -v
Using built-in specs.
COLLECT_GCC=X:\libs\gcc-4.8.2-x86_64-w64-mingw32-seh\bin\x86_64-w64-mingw32-g++.exe
COLLECT_LTO_WRAPPER=X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/libexec/gcc/x86_64-w64-mingw32/4.8.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --build=x86_64-build_w64-mingw32 --host=x86_64-build_w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/libs/gcc-4.8.2-x86_64-w64-mingw32-seh --with-sysroot=/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysro  ot --enable-languages=c,c++ --with-arch=x86-64 --enable-shared --enable-static --with-pkgversion='crosstool-NG hg+unknown-20140202.130831' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support   --with-gmp=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-mpfr=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-mpc=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-isl=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-cloog=/libs/tmp/.build/x86_64  -w64-mingw32/buildtools --with-libelf=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++ -lm' --enable-threads=win32 --disable-win32-registry --enable-target-optspace --disable-nls --disable-multilib --with-local-  prefix=/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot --enable-c99 --enable-long-long --with-arch=nocona --with-tune=core2 --enable-seh-exceptions
Thread model: win32
gcc version 4.8.2 (crosstool-NG hg+unknown-20140202.130831)
COLLECT_GCC_OPTIONS='-O2' '-s' '-o' 'helloworld-win64.exe' '-v' '-shared-libgcc' '-mtune=core2' '-march=nocona'
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/libexec/gcc/x86_64-w64-mingw32/4.8.2/cc1plus.exe -quiet -v -U_REENTRANT helloworld.cpp -quiet -dumpbase helloworld.cpp -mtune=core2 -march=nocona -auxbase helloworld -O2 -version -o X:\libs\msys64\tmp\cc7TXyME.s
GNU C++ (crosstool-NG hg+unknown-20140202.130831) version 4.8.2 (x86_64-w64-mingw32)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysrootX:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../include"
#include "..." search starts here:
#include <...> search starts here:
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/include/c++/4.8.2
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/include/c++/4.8.2/x86_64-w64-mingw32
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/include/c++/4.8.2/backward
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/include
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/include-fixed
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/include
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot/mingw/include
End of search list.
GNU C++ (crosstool-NG hg+unknown-20140202.130831) version 4.8.2 (x86_64-w64-mingw32)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: a29a845e492c796f144251ed251401f0
COLLECT_GCC_OPTIONS='-O2' '-s' '-o' 'helloworld-win64.exe' '-v' '-shared-libgcc' '-mtune=core2' '-march=nocona'
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/as.exe -v -o X:\libs\msys64\tmp\ccWBwnMg.o X:\libs\msys64\tmp\cc7TXyME.s
GNU assembler version 2.24 (x86_64-w64-mingw32) using BFD version (crosstool-NG hg+unknown-20140202.130831) 2.24
COMPILER_PATH=X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/libexec/gcc/x86_64-w64-mingw32/4.8.2/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/libexec/gcc/x86_64-w64-mingw32/4.8.2/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/libexec/gcc/x86_64-w64-mingw32/;X:/libs/gcc-4.8.2-x86_64  -w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/lib/../lib/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysr  oot/mingw/lib/../lib/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/lib/;X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot/mingw/lib/
COLLECT_GCC_OPTIONS='-O2' '-s' '-o' 'helloworld-win64.exe' '-v' '-shared-libgcc' '-mtune=core2' '-march=nocona'
 X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/libexec/gcc/x86_64-w64-mingw32/4.8.2/collect2.exe --sysroot=X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot -m i386pep -Bdynamic -o helloworld-win64.exe -s X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64  -mingw32/sysroot/mingw/lib/../lib/crt2.o X:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot/mingw/lib/../lib/crtbegin.o -LX:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2 -LX:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_6  4-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/lib/../lib -LX:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot/mingw/lib/../lib -LX:/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/lib -LX:/libs  /gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot/mingw/lib X:\libs\msys64\tmp\ccWBwnMg.o -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt X:/libs/gc  c-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32/sysroot/mingw/lib/../lib/crtend.o

class101 avatar Feb 02 '14 13:02 class101

I can reproduce the include bug I have on target linux64 include bug with also a target windows64 but non-sysrooted(did not happen with sysroot active), took the complete logs this time

[INFO ]  Installing pass-2 core C gcc compiler
[EXTRA]    Configuring core C gcc compiler
[EXTRA]    Building core C gcc compiler
[ERROR]    xgcc.exe: error: CreateProcess: No such file or directory
[ERROR]    X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include/stddef.h:1:25: fatal error: stddef.h: No such file or directory
[ERROR]    X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include/stddef.h:1:25: fatal error: stddef.h: No such file or directory
[ERROR]    X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include/stddef.h:1:25: fatal error: stddef.h: No such file or directory
[ERROR]    X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include/stddef.h:1:25: fatal error: stddef.h: No such file or directory
[ERROR]    make[2]: *** [_muldi3.o] Error 1
[ERROR]    make[2]: *** [_negdi2.o] Error 1
[ERROR]    make[2]: *** [_lshrdi3.o] Error 1
[ERROR]    make[2]: *** [_ashldi3.o] Error 1
[ERROR]    make[1]: *** [all-target-libgcc] Error 2
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing pass-2 core C gcc compiler'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_gcc_core_backend[scripts/build/cc/100-gcc.sh@515]
[ERROR]  >>        called from: do_gcc_core_pass_2[scripts/build/cc/100-gcc.sh@150]
[ERROR]  >>        called from: do_cc_core_pass_2[scripts/build/cc.sh@42]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@694]

and if I execute the failing command with -v I get

ct-ng:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/x86_64-w64-mingw32/libgcc> /libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/./gcc/xgcc -B/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/./gcc/ -L/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/lib -L/libs/tmp/.build/x86_64-w64-mingw32/buildtools/mingw/lib -isystem /libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include -isystem /libs/tmp/.build/x86_64-w64-mingw32/buildtools/mingw/include -B/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/bin/ -B/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/lib/ -isystem /libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include -isystem /libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/sys-include    -g -Os -O2  -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -I. -I. -I../.././gcc -I../../../../../src/gcc-4.8.2/libgcc -I../../../../../src/gcc-4.8.2/libgcc/. -I../../../../../src/gcc-4.8.2/libgcc/../gcc -I../../../../../src/gcc-4.8.2/libgcc/../include -I../../../../../src/gcc-4.8.2/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_EMUTLS -o _ashldi3.o -MT _ashldi3.o -MD -MP -MF _ashldi3.dep -DL_ashldi3 -c ../../../../../src/gcc-4.8.2/libgcc/libgcc2.c -v
Reading specs from X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/specs
COLLECT_GCC=X:\libs\tmp\.build\x86_64-w64-mingw32\build\build-cc-gcc-core-pass-2\gcc\xgcc.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --build=x86_64-build_w64-mingw32 --host=x86_64-build_w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-local-prefix=/libs/gcc-4.8.2-x86_64-w64-mingw32-seh/x86_64-w64-mingw32 --disable-libmudflap --without-headers --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG hg+unknown-20140203.141113' --with-arch=x86-64 --enable-__cxa_atexit --with-gmp=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-mpfr=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-mpc=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-isl=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-cloog=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --with-libelf=/libs/tmp/.build/x86_64-w64-mingw32/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-target-optspace --disable-libgomp --disable-libmudflap --disable-nls --disable-multilib --with-gxx-include-dir=/libs/tmp/.build/x86_64-w64-mingw32/buildtools/include/c++/4.8.2 --enable-languages=c --with-arch=nocona --with-tune=core2 --enable-seh-exceptions
Thread model: single
gcc version 4.8.2 (crosstool-NG hg+unknown-20140203.141113)
COLLECT_GCC_OPTIONS='-B' 'X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/' '-LX:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/lib' '-LX:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/mingw/lib' '-isystem' 'X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include' '-isystem' 'X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/mingw/include' '-B' 'X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/bin/' '-B' 'X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/lib/' '-isystem' 'X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include' '-isystem' 'X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/sys-include' '-g' '-Os' '-O2' '-D' 'IN_GCC' '-D' 'CROSS_DIRECTORY_STRUCTURE' '-Wextra' '-Wall' '-Wno-narrowing' '-Wwrite-strings' '-Wcast-qual' '-Wstrict-prototypes' '-Wmissing-prototypes' '-Wold-style-definition' '-isystem' './include' '-g' '-D' 'IN_LIBGCC2' '-fbuilding-libgcc' '-fno-stack-protector' '-D' 'inhibit_libc' '-I' '.' '-I' '.' '-I' '../.././gcc' '-I' '../../../../../src/gcc-4.8.2/libgcc' '-I' '../../../../../src/gcc-4.8.2/libgcc/.' '-I' '../../../../../src/gcc-4.8.2/libgcc/../gcc' '-I' '../../../../../src/gcc-4.8.2/libgcc/../include' '-I' '../../../../../src/gcc-4.8.2/libgcc/config/libbid' '-D' 'ENABLE_DECIMAL_BID_FORMAT' '-D' 'HAVE_CC_TLS' '-D' 'USE_EMUTLS' '-o' '_ashldi3.o' '-MT' '_ashldi3.o' '-MD' '-MP' '-MF' '_ashldi3.dep' '-D' 'L_ashldi3' '-c' '-v' '-mtune=core2' '-march=nocona'
 X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/cc1.exe -quiet -v -I . -I . -I ../.././gcc -I ../../../../../src/gcc-4.8.2/libgcc -I ../../../../../src/gcc-4.8.2/libgcc/. -I ../../../../../src/gcc-4.8.2/libgcc/../gcc -I ../../../../../src/gcc-4.8.2/libgcc/../include -I ../../../../../src/gcc-4.8.2/libgcc/config/libbid -iprefix X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/../lib/gcc/x86_64-w64-mingw32/4.8.2/ -isystem X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include -isystem X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include-fixed -MD _ashldi3.d -MF _ashldi3.dep -MP -MT _ashldi3.o -U_REENTRANT -D IN_GCC -D CROSS_DIRECTORY_STRUCTURE -D IN_LIBGCC2 -D inhibit_libc -D ENABLE_DECIMAL_BID_FORMAT -D HAVE_CC_TLS -D USE_EMUTLS -D L_ashldi3 -isystem X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include -isystem X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/mingw/include -isystem X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include -isystem X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/sys-include -isystem ./include ../../../../../src/gcc-4.8.2/libgcc/libgcc2.c -quiet -dumpbase libgcc2.c -mtune=core2 -march=nocona -auxbase-strip _ashldi3.o -g -g -Os -O2 -Wextra -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -version -fbuilding-libgcc -fno-stack-protector -o X:\libs\msys64\tmp\cc49CBcJ.s
GNU C (crosstool-NG hg+unknown-20140203.141113) version 4.8.2 (x86_64-w64-mingw32)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/mingw/include"
ignoring duplicate directory "X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/sys-include"
ignoring nonexistent directory "./include"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/../lib/gcc/x86_64-w64-mingw32/4.8.2/include"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/../lib/gcc/x86_64-w64-mingw32/4.8.2/include-fixed"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/../lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/sys-include"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/../lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/lib/gcc/x86_64-w64-mingw32/4.8.2/include"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/lib/gcc/x86_64-w64-mingw32/4.8.2/include-fixed"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/x86_64-w64-mingw32/sys-include"
ignoring nonexistent directory "X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/x86_64-w64-mingw32/include"
ignoring duplicate directory "."
ignoring duplicate directory "../../../../../src/gcc-4.8.2/libgcc/."
#include "..." search starts here:
#include <...> search starts here:
 .
 ../.././gcc
 ../../../../../src/gcc-4.8.2/libgcc
 ../../../../../src/gcc-4.8.2/libgcc/../gcc
 ../../../../../src/gcc-4.8.2/libgcc/../include
 ../../../../../src/gcc-4.8.2/libgcc/config/libbid
 X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include
 X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include-fixed
 X:/libs/tmp/.build/x86_64-w64-mingw32/buildtools/x86_64-w64-mingw32/include
End of search list.
GNU C (crosstool-NG hg+unknown-20140203.141113) version 4.8.2 (x86_64-w64-mingw32)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b26ff2792dcebcce8fc70b965ba7ae98
In file included from ../../../../../src/gcc-4.8.2/libgcc/../gcc/tsystem.h:44:0,
                 from ../../../../../src/gcc-4.8.2/libgcc/libgcc2.c:27:
X:/libs/tmp/.build/x86_64-w64-mingw32/build/build-cc-gcc-core-pass-2/gcc/include/stddef.h:1:25: fatal error: stddef.h: No such file or directory
 #include_next <stddef.h>
                         ^
compilation terminated.

class101 avatar Feb 03 '14 13:02 class101

crosstool-ng doesn't work non-sysrooted (which implies native), in fact it should refuse to build in that scenario. How did you get it to start building, and also, why do you want to avoid using a sysroot?

mingwandroid avatar Feb 03 '14 14:02 mingwandroid

Answering my own question here, I'm guessing that you are trying without a sysroot because sysrooted versions end up with X:/blah/blah/blahX/:/blah/blah in their search paths?

If so this is due to a limitation of MSYS and MSYS2. Again, you should use my build.sh script as that avoids the problem in the least intrusive way I could manage it.

We added an env. var to MSYS2 to prevent specific path transformations and in build.sh this is done with:

I put a hack into MSYS2 in the interests of pragmatism

to allow arguments to be blacklisted from being converted

between their MSYS2 and Windows representations:

export MSYS2_ARG_CONV_EXCL="-DNATIVE_SYSTEM_HEADER_DIR="

mingwandroid avatar Feb 03 '14 15:02 mingwandroid

I don't really need and like sysroot because it is creating lots of subfolders levels, you finally have multiple libs, include folders everywhere etc you finally don't know what is used, what is not. When you look the architecture of TDM GCC that is not sysrooted, it's much cleaner. Anyway I have one folder of each GCC so I don't see why I need to enclose again this in a sysroot.

Or I would have preferred you sysroot this in the whole folder, not in a sysroot subfolder, like mingw-w64 pubbed builds they do sysroot=/mingw64

Also while trying winsymlinks:nativestrict I realize your build.sh patches assumes ln -s does not work so I realize a few of the patch here conflicts with what I'm trying yet and I will just apply the minimum patches from this project

I have tested commenting in all the configure scripts of all packages, the configuration detected fine ln -s and it worked perfectly without more patches

#ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
  #as_ln_s='cp -pR'

and it worked for all the packages because I believe ln -s file dir or ln -s dir file is rarely used, it is not a big help for WIndows target, but very good for linux targets, I don't need to patch rellns script anymore when it is about to create links

class101 avatar Feb 03 '14 17:02 class101

What you prefer and what crosstool-ng is capable of are two different things I'm afraid.

You will have to make changes to crosstool-ng to get what you want to work.

I also think crosstool-ng's folder layout is weird and a bit broken and would be happy if you were to fix it. I guess we are in agreement that specifying a prefix is enough of a sysroot already and having subfolders beyond that serves no useful purpose. There is one exception to that though, which with Clang where the same Clang binaries can compile software for many different systems. In that case, suddenly sysroot subfolders are sensible things again.

I am fairly sure that some of the sysroot folders that are created do not need to be created too.

As for "ln -s", I'm not going to expend effort on that because even if you get it to work nicely, end users of your cross compilers may not have the administrator permissions necessary to create symlinks which makes them quite pointless from a software distribution perspective.

I don't think I've patched anything in any way that's destructive to "ln -s" working, but please correct me if I'm wrong in that.

mingwandroid avatar Feb 03 '14 17:02 mingwandroid

(Includes a mingw-w64 crt build fix at the end of post, you should not build multilib crt when not needed)

Instead I have successfully built sysroot=prefix build with winsymlinks:nativestrict, makes muuch cleaner directory architecture

gcc-4.8.2-x86_64-w64-mingw32-seh-sysroot-prefix-winsymlinks.tar.xz (extracts with tar -xJvf) https://drive.google.com/file/d/0B4dcRcayW88VZnNSYWgyaUhBR3c/edit?usp=sharing

Notable patches used:

feature-ctng-same-sysroot-and-prefix.patch : same short --with-sysroot and --prefix dirs

Index: scripts/build/cc/100-gcc.sh
===================================================================
--- scripts/build/cc/100-gcc.sh (revision 273)
+++ scripts/build/cc/100-gcc.sh (working copy)
@@ -400,6 +400,10 @@
         # mingw32 and mingw64 as MinGW-w64 itself does now-a-days so until
         # I decide on these issues this workaround will suffice.
         if [ ! -d ${CT_SYSROOT_DIR}/${CT_TARGET_MINGW_SYSROOT_TOP}/include ]; then
+            # <root>/mingw [link to neighbor x86_64-w64-mingw32]
+            # as suggested by Mingw-w64 folks, much cleaner
+            # http://sourceforge.net/p/mingw-w64/code/HEAD/tree/trunk/mingw-w64-doc/howto-build/mingw-w64-howto-build-adv.txt#l286
+            CT_DoExecLog ALL ln -sf ${CT_SYSROOT_DIR}/${CT_TARGET} ${CT_SYSROOT_DIR}/${CT_TARGET_MINGW_SYSROOT_TOP}
             CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/${CT_TARGET_MINGW_SYSROOT_TOP}/include
         fi
     fi
Index: scripts/crosstool-NG.sh.in
===================================================================
--- scripts/crosstool-NG.sh.in  (revision 273)
+++ scripts/crosstool-NG.sh.in  (working copy)
@@ -289,11 +289,11 @@

     # Arrange paths depending on wether we use sysroot or not.
     if [ "${CT_USE_SYSROOT}" = "y" ]; then
-        CT_SYSROOT_REL_DIR="${CT_SYSROOT_DIR_PREFIX:+${CT_SYSROOT_DIR_PREFIX}/}${CT_SYSROOT_NAME}"
-        CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_REL_DIR}"
-        CT_DEBUGROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/debug-root"
-        CT_HEADERS_DIR="${CT_SYSROOT_DIR}/usr/include"
-        CT_SanitiseVarDir CT_SYSROOT_REL_DIR CT_SYSROOT_DIR CT_DEBUGROOT_DIR CT_HEADERS_DIR 
+        #CT_SYSROOT_REL_DIR="${CT_SYSROOT_DIR_PREFIX:+${CT_SYSROOT_DIR_PREFIX}/}${CT_SYSROOT_NAME}"
+        CT_SYSROOT_DIR="${CT_PREFIX_DIR}"
+        CT_DEBUGROOT_DIR="${CT_SYSROOT_DIR}"
+        CT_HEADERS_DIR="${CT_SYSROOT_DIR}/include"
+        CT_SanitiseVarDir CT_SYSROOT_DIR CT_DEBUGROOT_DIR CT_HEADERS_DIR 
         BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
         CC_CORE_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
         CC_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
@@ -330,11 +330,12 @@
     CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/lib"
     CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
     CT_DoExecLog ALL mkdir -p "${CT_HEADERS_DIR}"
+    [ ! -d "${CT_PREFIX_DIR}/${CT_TARGET}" ] && CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/${CT_TARGET}"

     if [ "${CT_USE_SYSROOT}" = "y" ]; then
         # Prevent gcc from installing its libraries outside of the sysroot
         CT_Pushd "${CT_PREFIX_DIR}/${CT_TARGET}"
-        CT_DoExecLog ALL ln -sf "${CT_SYSROOT_REL_DIR}/lib" "lib"
+        CT_DoExecLog ALL ln -sf "${CT_PREFIX_DIR}/lib" "lib"
         CT_Popd
     fi

fix-buildsh-wrong-multilib-condition.patch

--- scripts/crosstool-NG.sh.in.orig 2014-02-04 13:22:30.469906600 +0100
+++ scripts/crosstool-NG.sh.in  2014-02-04 13:23:15.136465600 +0100
@@ -345,7 +345,7 @@
     #
     # Not all of these symlinks are necessary, but better safe than
     # sorry. They are summarily removed by build/internals.sh:do_finish.
-    if [ "${CT_MULTILIB}" = "n" ]; then
+    if [ ! "${CT_MULTILIB}" = "y" ]; then
         for d in                            \
             "${CT_PREFIX_DIR}"              \
             "${CT_SYSROOT_DIR}"             \

fix-mingw-only-install-required-lib-arch.patch : It is wrong to assume we all do multilib, you must include the switches to disable the generation of one of both when we dont want multilib

Index: scripts/build/libc/mingw.sh
===================================================================
--- scripts/build/libc/mingw.sh (revision 273)
+++ scripts/build/libc/mingw.sh (working copy)
@@ -52,10 +52,17 @@
 }

 do_libc() {
+    local -a arch_opts
     CT_DoStep INFO "Building mingw-w64 files"

     CT_DoLog EXTRA "Configuring mingw-w64-crt"

+    case "${CT_MULTILIB}:${CT_ARCH_BITNESS}" in
+        y:*)    arch_opts+=( "" );;
+        *:64)   arch_opts+=( "--disable-lib32" );;
+        *:*)    arch_opts+=( "--disable-lib64" );;
+    esac
+
     CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-crt"

     CT_DoExecLog CFG                                                        \
@@ -63,6 +70,7 @@
         --prefix=/${CT_TARGET_MINGW_SYSROOT_TOP}                            \
         --build=${CT_BUILD}                                                 \
         --host=${CT_TARGET}                                                 \
+        "${arch_opts[@]}"

     CT_DoLog EXTRA "Building mingw-w64-crt"
     CT_DoExecLog ALL make ${JOBSFLAGS}

class101 avatar Feb 04 '14 15:02 class101