tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Push reproducible builds script? (for windows)


From: avih
Subject: Re: [Tinycc-devel] Push reproducible builds script? (for windows)
Date: Tue, 26 Sep 2017 18:48:43 +0000 (UTC)

I'm not a big fan of keeping meaningful binaries at the sources repo. We could easily point users to the latest stable build of tcc for windows. Maybe even such build batch file can download it itself (even signed or with a known hash? :) ).

However, here are some numbers just in case, from my reproducible build of tcc32 (which works similar to win32/Makefile: builds possibly cross tcc which targets windows, and uses it to build the final windows native tcc):

Binaries:
tcc.exe: 250k
libtcc1.a: 15k

The rest (only .h/.def files which are at copied from the repo): 1.2M

All of this zipped is 360k, or 270k as 7z ,

It's not terribly big to include at the repo, but I still think we shouldn't.

FWIW, when I started with the reproducible build script, I also wanted it to produce identical binary using the official release of tcc 0.9.26 for windows. But it can't build the current tcc. At the time I maintained a patch (IIRC it's mostly about handling an empty macro - https://github.com/avih/tinycc/commit/631b3d2a331e5c73b0318d3ddde3720dc12996f2 ), but even with this patch, it produced a working binary but it wasn't bit identical to the output of any other compiler.




On Tuesday, September 26, 2017 9:14 PM, Christian Jullien <address@hidden> wrote:


On Windows, you need a working C compiler to bootstrap tcc which ranges from 100MB to 10GB in size. For most casual C developers, installing Cygwin/mingw or Visual C to build tcc is overkill, especially because they will get a C compiler and they will no more need tcc after that.
 
Why not to consider to add in repository (in win32/bin for example) a stable native tcc.exe and a bootstrap.bat that is able to recompile at any time a native tcc.exe from mod. Most programming languages bootstrap themselves from a previous version.
With this solution, tcc git repository will have all the material to bootstrap itself on Windows. If you like, win32/bin/tcc.exe could be named xtcc.exe as gcc does when it bootstraps. xtcc.exe can be very stable an requires an update only when it is no more able to boostrap mob (because for example mod sources code adds C11 features that xtcc.exe does not support).
 
Ok, I know it is not a good practice to add binaries in source code repository.
 
FYI win32/Makefile uses Cygwin/gcc to build tcc that in turn builds native tcc x86 and x64 which require no other libs or tools to run.
 
You end with a set of files you can copy on any Windows machines to make C dev (only a “make” program is missing).
 
From: avih [mailto:address@hidden
Sent: mardi 26 septembre 2017 18:32
To: Christian Jullien; address@hidden
Subject: Re: [Tinycc-devel] Push reproducible builds script? (for windows)
 
I think there are two main built targets on windows (ignoring 32/64), and three target audience.
 
Build targets are:
 
1. Fully native stand alone windows tcc compiler.
 
This can be done with a mingw dev env (with msys2 or even msys1), or build-tcc.bat and some compiler present (I'm assuming it also supports cl). I'm not too familiar with the latter, and also not with win32/Makefile so I don't know if that's what it does - I don't have cygwin env. My reproducible build script is also in this category.
 
2. Build a "posix"-ish tcc, such as native cygwin or msys2.
 
I don't know if tcc actually supports this kind of build on windows, and personally I'm not interested in it, but theoretically it should be possible. This will probably create a different binary (where _WIN32 is not defined when building or running tcc) and possibly needs different include files (no mingw, global cygwin/msys2 includes, etc).
 
Does tcc actually support this kind of build?
 
 
As for the target audience, I think these are the main ones:
 
1. Users of mainly microsoft dev tools.
2. Users with a mingw env and (posix) shell tools (these days probably msys2/mingw mode, maybe cygwin too).
3. Users without any dev tools which want to experiment with a small compiler.
 
 
In general, I think the main and official build setup for windows should be posix-y shell and mingw env. It provides the most control over the build properties, the tcc build setup is maintained together with the rest of the targets, and the mingw dev env is maintained independently and hopefully well.
 
However, as we saw recently, some issues can depend on the compiler version. E.g. currently some tests fail when building tcc with mingw gcc 64 7.2.0 .
 
Which is where my reproducible build could come into play, as It provides an independent and reproducible starting point which can be generated anywhere (besides other values of a reproducible build). It can be used on its own or be a bootstrap compiler for running ./configure && make .
 
I would not like to enforce it (using the reproducible tcc as input for configure && make), but It could for instance be used to build the official windows tcc binaries. I did not test whether such procedure is reproducible in itself - it might be, but it's hard to test and guarantee.
 
As for making the instructions simple, IMHO we should publish instructions for users with only microsoft tools, and for users with mingw shell dev env.
 
 
 
On Tuesday, September 26, 2017 6:45 PM, Christian Jullien <address@hidden> wrote:
 
Grischka,
It's difficult to give advice. It entirely depends on the C toolchain you
already have on your machine (or you're ready to install).
My **personal** choice is of course Cygwin/Makefile because I have Cygwin
installed with gcc for Cygwin and this Makefile, thanks to bash, lets me run
tests for x86 and x64 with one command.
Someone accustomed to Windows will prefer VC++.
I admit a "How to build" guide would be welcome because it's probably hard
for a noob to bootstrap a working tcc on Windows.



-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=address@hidden]
On Behalf Of grischka
Sent: mardi 26 septembre 2017 17:26
To: avih; address@hidden
Subject: Re: [Tinycc-devel] Push reproducible builds script? (for windows)

avih wrote:
> I'd like to push my reproducible build script to mob, are there
objections?

Not in principle.

Except I'd appreciate some concept to advise users which method to build tcc
on or for windows to use best in what situation.

We do support:
* msys with the normal ./configure && make && make install
* also cygwin with ./configure --cross-prefix=mingw32- && make && make
install
* also cygwin with Jullien's Makefile from win32
* just mingw's gcc or msvc's cl with build-tcc.bat from win32, including
  option to install, no sh-shell required.
* maybe your reproducible build script, with again its own advantages as
  well as drawbacks.

What is your recommendation?  And how (if any) can we make sure that it will
reach users?

-- gr



>
> In a nutshell, it's a shell script which builds windows tcc
> distribution (4 of them actually: 32, 64, cross 32->64 and 64->32)
> with reproducible output regardless of the host or initial CC (in
> fact, it just doesn't care at all what the host is or which CC is used),
and then prints a checksum of the output.
>
> Tested with several versions of gcc, clang, tcc, cl (msvc compiler),
> on different systems (linux 32/64, msys2/mingw, osx, freebsd, busybox
> on windows, and others), and it always produces identical output for any
git revision.
>
> I've been using this script for my tcc builds, and had no issues with
> it. The resulting tcc binaries can be used as CC for the normal
> configure && make && make test procedure and the result passes all tests.
>
> It's similar to win32/build-tcc.bat and win32/Makefile but I think it
> has few advantages over them:
>
> - Works on any OS and with any compiler
>
> - Deterministic/identical output regardless of the host/compiler.
>
> - Simple posix shell script which doesn't require dev tools (other than
>  a compiler binary), such that it can even run in busybox on windows
without
>  any further tools (and use a tcc or cl compiler).
>
> This is pretty much the same as I posted about a year ago:

> http://lists.nongnu.org/archive/html/tinycc-devel/2016-10/msg00146.htm
> l
>
> With the following minimal differences:
> - Try to find a compiler automatically (gcc/cc/tcc/cl) if CC is not set.
> - Use the new "tcc -ar" instead of tinylibmaker .
> - Now also works on freebsd (following commit abd1532 from yesterday).
>
>
> E.g. for the current mob ( 8deb05c ) the reproducible build signature is:
>  9fcbdd83e8a2a2c67ab6e1fb529b8f33
>
> Find the recent version attached (to test: place it at the win32 dir and
run).
>
> Any objections that I push it to mob?
>
> - avih
>
>
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel



_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]