From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48141 invoked by alias); 15 Jul 2019 22:27:43 -0000 Mailing-List: contact bzip2-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Sender: bzip2-devel-owner@sourceware.org Received: (qmail 48129 invoked by uid 89); 15 Jul 2019 22:27:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=compressor, integrity X-Spam-Status: No, score=-6.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Message-ID: Subject: Re: _stati64 patch (Was: [PATCH] Fix include path separator) From: Mark Wielaard To: Joshua Watt Cc: bzip2-devel@sourceware.org, Phil Ross Date: Tue, 01 Jan 2019 00:00:00 -0000 In-Reply-To: References: <20190702200544.27137-1-JPEW.hacker@gmail.com> <20190705083857.GF4777@wildebeest.org> <5867f77d-36b1-5ae2-1b53-5e1ee5a63323@gmail.com> <03e0c9b1537ea400554213a7caef8855cc73aa04.camel@klomp.org> <047e4d94-9223-b411-bc83-429ba458fa67@gmail.com> <23197ac342d44166d9ae1824d5e4d6b6bd9cbfaf.camel@klomp.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-2.el7) Mime-Version: 1.0 X-Spam-Flag: NO X-SW-Source: 2019-q3/txt/msg00034.txt.bz2 Hi Joshua, On Mon, 2019-07-15 at 08:58 -0500, Joshua Watt wrote: > On 7/14/19 4:23 PM, Mark Wielaard wrote: > >=20 > > That is really awesome. Thanks so much for testing that out. > > Can a cross build bzip2 using MinGw (and msys) be run under Wine? > > That might give us a build CI pipeline for testing bzip2 using the > > buildbot. It might not be identical to running under actual Windows. > > But it might be scripted/automated. >=20 > We do something similar to that to test our MinGW SDKs for the Yocto=20 > Project. We cross compile the SDK using the MinGW toolchain on Linux=20 > (note that MSYS is not required; the Linux system already has all the=20 > POSIX tools), then run a set of automated tests under Wine. OK nice. So for testing you can just use the normal scripts/tools, just make sure the binary itself is ran through wine? > You might be able to take this approach also. It wouldn't verify that=20 > you can actually compile under Windows (as stated, it is a cross compile= =20 > from Linux), but it would give some amount of confidence that you can=20 > actually run the cross compiled bzip2 on Windows and it will pass the=20 > tests. You are correct that Wine isn't a fully faithful reproduction of=20 > Windows; I've found a few things that just refuse to run properly under=20 > wine, but do fine on actual Windows. Right. We only want to test that it builds as if for Windows. That is test the code with BZ_UNIX 0 and BZ_LCCWIN32 1 compiles correctly. > Most distros have a ready-made MinGW GCC compiler that can be installed.= =20 > The harder part is getting any additional dependencies. Most of the=20 > distros I've seen don't have very many of the MinGW cross compiled=20 > library (why would they?) so if your trying to cross compile a large=20 > codebase, you can easily get into trouble with missing dependencies. The= =20 > Yocto project has an advantage in this regard because we are already=20 > compiling everything from source anyway, so cross compiling the=20 > requisite dependencies for MinGW isn't any additional work. I think that= =20 > bzip2 might also be able to be cross compiled easily because it doesn't=20 > have very many dependencies. As far as I know bzip2 really shouldn't have any dependencies except for what is provided by MinGW GCC itself. > If you want to verify that you can compile under Windows, you might be=20 > able to install MSVC in wine and use it to build bzip2. You *might* also= =20 > be able to install the Windows version of MinGW and MSYS in wine. I=20 > don't know how stable this would be or if it would work at all. Both may go a bit too far. Just being able to (cross) compile to a Windows binary and then check it works as expected seems all that is really necessary to make sure we don't break thing (too much). Lets see... So I installed mingw32-gcc and wine for my distro. $ make CC=3Di686-w64-mingw32-gcc [... mostly seems to work ...] i686-w64-mingw32-gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=3D64 -o bzip2 bzip2.o -L. -lbz2 ./libbz2.a: error adding symbols: Archive has no index; run ranlib to add one collect2: error: ld returned 1 exit status make: *** [bzip2] Error 1 OK, that is odd, but lets do what it says: $ i686-w64-mingw32-ranlib ./libbz2.a $ i686-w64-mingw32-gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=3D64 \ -o bzip2 bzip2.o -L. -lbz2 $ file bzip2 ./bzip2: PE32 executable (console) Intel 80386, for MS Windows Nice! But... $ wine ./bzip2 wine: Bad EXE format for Z:\home\mark\src\bzip2-work\bzip2.. OK, apparently I needed mingw64-gcc. So, same as above with make CC=3Di686-w64-mingw32-gcc x86_64-w64-mingw32-ranlib ./libbz2.a and x86_64-w64-mingw32-gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=3D64 -o=20 bzip2 bzip2.o -L. -lbz2 $ file bzip2 bzip2: PE32+ executable (console) x86-64, for MS Windows $ wine ./bzip2 --help bzip2, a block-sorting file compressor. Version 1.0.8, 13-Jul-2019. usage: bzip2 [flags and input files in any order] -h --help print this message -d --decompress force decompression -z --compress force compression -k --keep keep (don't delete) input files -f --force overwrite existing output files -t --test test compressed file integrity -c --stdout output to standard out -q --quiet suppress noncritical error messages -v --verbose be verbose (a 2nd -v gives more) -L --license display software version & license -V --version display software version & license -s --small use less memory (at most 2500k) -1 .. -9 set block size to 100k .. 900k --fast alias for -1 --best alias for -9 If invoked as `bzip2', default action is to compress. as `bunzip2', default action is to decompress. as `bzcat', default action is to decompress to stdout. If no file names are given, bzip2 compresses or decompresses from standard input to standard output. You can combine short flags, so `-v -4' means the same as -v4 or -4v, &c. That is so awesome! Even though I am not exactly sure what I did. But it seems possible with some tweaks to get this working. Could you share some hints and tips on your setup? Or simply explain what went wrong in the above or what accidentally worked and why? Also is there a "command line wine"? The first time you run wine it seems to spawn all kinds of windows setup thingies. That would work on the buildbots of course. Thanks, Mark