Created attachment 144047 [details] Incomplete patch In attempting to update devel/mingw32-gcc to use gcc 4.8.1 and to support staging, I have encountered a problem. The port refuses to build. I am at a loss on how to fix this, as I want to make sure the port is updated to handle staging and not get deprecated at the end of the month. The first problem I was getting was it saying that it couldn't find stdio.h at all. After a bit of searching on Google, I found the --with-sysroot configure option. I had to patch gcc/config.gcc to use /mingw32/include instead of /mingw/include (since devel/mingw32-bin-msvcrt installs to ${PREFIX}/mingw32/include). I have attempted to build the port in poudriere. If I set --with-sysroot to ${PREFIX}, I get the following: The directory that should contain system headers does not exist: /prefix/mingw32-gcc-4.8.1_1/mingw32/include gmake[2]: *** [stmp-fixinc] Error 1 gmake[2]: Leaving directory `/wrkdirs/usr/ports/devel/mingw32-gcc/work/build/gcc' gmake[1]: *** [all-gcc] Error 2 gmake[1]: Leaving directory `/wrkdirs/usr/ports/devel/mingw32-gcc/work/build' gmake: *** [all] Error 2 If I set --with-sysroot to ${LOCALBASE}, I get the following instead: /wrkdirs/usr/ports/devel/mingw32-gcc/work/build/./gcc/xgcc -B/wrkdirs/usr/ports/devel/mingw32-gcc/work/build/./gcc/ -L/wrkdirs/usr/ports/devel/mingw32-gcc/work/build/mingw32/winsup/mingw -L/wrkdirs/usr/ports/devel/mingw32-gcc/work/build/mingw32/winsup/w32api/lib -isystem /wrkdirs/usr/ports/devel/mingw32-gcc/work/gcc-4.8.1/winsup/mingw/include -isystem /wrkdirs/usr/ports/devel/mingw32-gcc/work/gcc-4.8.1/winsup/w32api/include -B/prefix/mingw32-gcc-4.8.1_1/mingw32/bin/ -B/prefix/mingw32-gcc-4.8.1_1/mingw32/lib/ -isystem /prefix/mingw32-gcc-4.8.1_1/mingw32/include -isystem /prefix/mingw32-gcc-4.8.1_1/mingw32/sys-include -g -O2 -pipe -I/usr/local/include -fno-strict-aliasing -O2 -I../.././..//gcc-4.8.1/libgcc/../winsup/w32api/include -g -O2 -pipe -I/usr/local/include -fno-strict-aliasing -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -I. -I. -I../.././gcc -I../.././..//gcc-4.8.1/libgcc -I../.././..//gcc-4.8.1/libgcc/. -I../.././..//gcc-4.8.1/libgcc/../gcc -I../.././..//gcc-4.8.1/libgcc/../include -I../.././..//gcc-4.8.1/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_EMUTLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../.././..//gcc-4.8.1/libgcc/libgcc2.c In file included from ../.././..//gcc-4.8.1/libgcc/libgcc2.c:27:0: ../.././..//gcc-4.8.1/libgcc/../gcc/tsystem.h:87:19: fatal error: stdio.h: No such file or directory #include <stdio.h> ^ compilation terminated. gmake[2]: *** [_muldi3.o] Error 1 gmake[2]: Leaving directory `/wrkdirs/usr/ports/devel/mingw32-gcc/work/build/mingw32/libgcc' gmake[1]: *** [all-target-libgcc] Error 2 gmake[1]: Leaving directory `/wrkdirs/usr/ports/devel/mingw32-gcc/work/build' gmake: *** [all] Error 2 I am currently at a complete loss as to how to fix this problem. I am hoping someone well versed in gcc cross-compiling can help me fix this problem.
Created attachment 144569 [details] mingw32-gcc-4.8.1.patch OK, I think we can forget about the above. After scouring the web, I figured out how to correct that issue (I had to use --with-headers and --with-libs instead of --with-sysroot). I was then able to complete the pkg-plist changes and make sure the port was staged. NOW, the only problem is in tools like poudriere and porttools. Because of the whole PREFIX != LOCALBASE thing that those tools do, and because of my use of PLIST_SUB, both those tools complain about trying to remove the PREFIX directory. I believe that the error can be ignored, but should probably be fixed in the ports system itself, as my port is not at fault for this. Just something for the committer to keep in mind.
The port builds fine on FreeBSD 10 and 11, but fails on 8.4 and 9.2, see https://redports.org/buildarchive/20140722122201-43838 Changeset: https://redports.org/changeset/29560 Can you investigate?
The weirdest thing about this is that that file and folder aren't being created on 10 and 11. When I talked to mandree about it over the weekend, I think we determined it might've had something to do with 8 and 9 using pkg_* while 10 and 11 use pkgng, but it doesn't make much sense to begin with. I don't have these come up when I build the port via poudriere with jails for 9 and 10, both using pkgng. I've also had an odd issue when I build with poudriere using the -n flag to set PREFIX == LOCALBASE. Some of the files installed by devel/mingw32-bin-msvcrt were being clobbered into being nothing but NUL bytes and causing the build of devel/mingw32-gcc to fail. I don't even know why that would happen only when the -n flag is used. It's like gcc wants to do the most bizarre things ever or something. :/
I removed "staging" from the title because it shows in a search and the port was staged on 8 July. Incidentally, that also invalidates this patch.
Created attachment 148176 [details] mingw32-gcc-4.8.1.patch I'm updating the patch to be more current, including handling the latest pkg by removing the @dirrm* lines in pkg-plist. This current patch allows the port to finish on 9.x and earlier, although I've no idea why the COPIED file and the sys-include directory are created under PREFIX but never removed like they should be. Here is a poudriere log for this: http://kirby.cyberbotx.com/poudriere_logs/mingw32-gcc-4.8.1,1-FreeBSD9.3.log Now, I have a problem when it comes to building under 10.x. For some bizarre reason, some of the .a files installed by devel/mingw32-bin-msvcrt are clobbered (their contents becomes nothing but NUL bytes). There is nothing in the log of the build to show a reason for this, and the files are fine prior to the build of mingw32-gcc. This doesn't happen under 9.x at all. This is the log of that: http://kirby.cyberbotx.com/poudriere_logs/mingw32-gcc-4.8.1,1-FreeBSD10.0.log I'm at a loss as to what to do about this. gcc cross-compiler builds seem to be a pain in the ass. :/
Strange indeed why libuser32.a is invalid. Since I'm no gcc expert, maybe somebody at freebsd-toolchain@ knows?
Created attachment 151863 [details] mingw32-gcc-4.8.1.patch OK, I'm replacing the patch with another updated one. This one I think finally resolves all the issues that I had run into beforehand. I just hope that it works out, since I've been sitting on this for far too long now.
Apparently the poudriere log for this is too large to attach to Bugzilla, so I'm going to link to it instead: http://kirby.cyberbotx.com/poudriere_logs/mingw32-gcc-4.8.1,1.log
Created attachment 151865 [details] mingw32-gcc-4.8.1.patch Another updated patch, the only change from the last one is removing the CFLAGS+= line that was reported in bug #195490. The port still compiles without it. The poudriere link in my previous reply has also been updated.
Compiles fine on my box for 8,9,10 i386/amd64 (There was a false? error about pkg database changing size in-flight).
A commit references this bug: Author: rene Date: Wed Jan 21 21:45:45 UTC 2015 New revision: 377625 URL: https://svnweb.freebsd.org/changeset/ports/377625 Log: devel/mingw32-gcc: Update to 4.8.1 - add license (GPLv3 GPLv3RLE) - Support DragonflyBSD (untested here) - Strip binaries PR: 191291 Submitted by: maintainer (cyberbotx@cyberbotx.com) Changes: head/devel/mingw32-gcc/Makefile head/devel/mingw32-gcc/distinfo head/devel/mingw32-gcc/pkg-plist