Hi, The simple answer, with MSYS2, to build tcc win64: - Start MSYS2 shortcut "mingw64", ensure you have mingw gcc x86-64 installed. - Clone tinycc and cd to the root source dir. - Run `mkdir build64 && cd build64 && ../configure --cpu=x86-64 --prefix=$(pwd)/dist && make && make install` - Now the `./dist/` dir will have a working portable tcc win64 package/files.
To build tcc win32, use the same steps but instead start the "mingw32" MSYS2 shortcut, ensure you have mingw gcc i686 installed, and use --cpu=i386 (and optionally different build/install dirs). The resulting tcc will use relative lib/include files. However, like Christian, I also use a reproducible build script which I wrote. It can use any compiler (gcc/clang/tcc/etc) on most systems (cygwin, linux, macOS, freeBSD, etc) to create a reproducible windows tcc compilers with identical binaries regardless of the system on which it was created. Like Christian's script, it first builds (possibly) cross compilers tcc for windows (which target win32 and win64), then uses them to build 32 and 64 tcc as well as 2 cross compilers (win64 tcc which targets win32, and win32 tcc which targets win64). Overall 4 distributions. The dirs I put at the 7z file are the plain 32/64 builds of tcc (not cross). To use it: - Get this file: https://github.com/avih/tinycc/blob/mob-win32-repro/win32/build-tcc-reproducible.sh - Place it at the <tcc-source>/win32/ dir and cd into that dir. - Run `rm -rf ./reprobuild; ./build-tcc-reproducible.sh` - Too see more options, run it with `-h` Cheers, Avi On Sunday, August 4, 2019, 2:08:17 PM GMT+3, Klaus Ebbe Grue <g...@di.ku.dk> wrote: #yiv3347465128 P {MARGIN-BOTTOM:0px;MARGIN-TOP:0px;}#yiv3347465128 P {MARGIN-BOTTOM:0px;MARGIN-TOP:0px;} Hi again Avi, Can I persuade you to tell how you built https://0x0.st/zOsg.7z ? In particular, how you made the lib and includes relative to the location of 'tcc.exe' for tcc32 and tcc64. Googling around seems to suggest that one should use the right host (MinGW? Cygwin?) and use the right ./configure options. Cheers, Klaus Fra: Tinycc-devel [tinycc-devel-bounces+grue=di.ku...@nongnu.org] på vegne af Klaus Ebbe Grue [g...@di.ku.dk] Sendt: 3. august 2019 16:14 Til: tinycc-devel@nongnu.org Emne: Re: [Tinycc-devel] Duplicate double Hi Avi, Great! Thanks! https://0x0.st/zOsg.7z worked. Just to test, I made a fresh msys2 install, cloned git://repo.or.cz/tinycc.git and compiled. That also works. For completeness, I have included the steps. The only surprise was that when using .configure --prefix=/usr I had to add --bindir=/usr/bin since otherwise tcc ends up in /usr/tcc.exe Cheers, Klaus --- Remove C:\msys64 if present Go to https://www.msys2.org/ Click msys2-x86_64-20190524.exe Install msys2 using defaults In MSYS2 shell: > pacman -Syu As instructed, kill and restart MSYS2 shell > pacman -Syu > pacman -S gcc git make texinfo > git clone git://repo.or.cz/tinycc.git > cd tinycc > ./configure --prefix=/usr --bindir=/usr/bin > make > make install > cd > tcc -v tcc version 0.9.27 (x86_64 Windows) > mkdir experiment > cd experiment > cat>test.c #include <stdio.h> void f(double x,double y,double z){printf("f(%4.1f,%4.1f,%4.1f)\n",x,y,z);} int main(int argc,char **argv){double u=0.0;f(u*1.0,7.0,8.0);return 0;} > tcc -o test test.c > ./test f( 0.0, 7.0, 8.0) Fra: Tinycc-devel [tinycc-devel-bounces+grue=di.ku...@nongnu.org] på vegne af avih via Tinycc-devel [tinycc-devel@nongnu.org] Sendt: 3. august 2019 10:31 Til: tinycc-devel@nongnu.org Cc: avih Emne: Re: [Tinycc-devel] Duplicate double You're right, and I can confirm that the win64 version downloaded the same as you exhibits the same issue, and the issue also exists if I build 0.27 for win64 myself (git d348a9a). However, it was apparently fixed shortly after tcc 0.27 was released, at the following commit: commit 8f6fcb709ae7b2379866c292ce478ab95dc75b48 Author: grischka <grischka> Date: Thu May 31 23:51:51 2018 +0200 misc fixes misc fixes including: - tcc.c: fix "tcc -vv" for libtcc1.a on win32/PE - tccelf.c: fix a crash when GOT has no relocs (witn -nostdlib) - tccelf.c: fix stab linkage for zero n_strx - tccgen.c: fix stdcall decoration for array parameters int __stdcall func(char buf[10]) is _func@4 (was _func@12) - tccgen.c: fix static variables with nocode/nodata_wanted see tests2/96_nodata_wanted.c - tccrun.c: align sections using sh_addralign (for reliable function_alignment) - tests2/Makefile sort 100 after 99 - win32/include/sys/stat.h fix _stat and _wstat - x86_64-gen.c: win64/gfunc_call: fix a bug with xmmN register args previously overwrote valid other xmmN registers eventually Not sure which of the fixes did it, but I'd guess it's at x86_64-gen.c . If you want, I've built tcc for win32 and win64 from the latest git version (mob, 9e429db), and uploaded it here: https://0x0.st/zOsg.7z Cheers, Avi On Friday, August 2, 2019, 9:51:22 PM GMT+3, Klaus Ebbe Grue <g...@di.ku.dk> wrote: Hi tinycc-devel, Under MSYS2/MinGW I have a problem with tcc. I define this functions: void f(double x,double y,double z){printf("f(%4.1f,%4.1f,%4.1f)\n",x,y,z);} As an example, f(1,2,3) prints f( 1.0, 2.0, 3.0). Then I call f from main in a slightly confusing way: int main(int argc,char **argv){double u=0.0;f(u*1.0,7.0,8.0);return 0;} I would expect to get f( 0.0, 7.0, 8.0) but I do get f( 7.0, 7.0, 8.0). The first argument of f becomes a duplicate of the second argument of f. If I remove "*1.0" then everything works as expected. Is this a known bug? By the way, if I make the same program using integers, then there is no problem. I have included a reproduction scenario below. Cheers, Klaus --- Install MSYS2/MinGW Start MSYS2 shell > mkdir experiment > cd experiment > wget http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win64-bin.zip > pacman -S unzip > unzip tcc-0.9.27-win64-bin.zip > tcc/tcc -v tcc version 0.9.27 (x86_64 Windows) > cat>test.c #include <stdio.h> void f(double x,double y,double z){printf("f(%4.1f,%4.1f,%4.1f)\n",x,y,z);} int main(int argc,char **argv){double u=0.0;f(u*1.0,7.0,8.0);return 0;} > tcc/tcc -o test test.c > ./test f( 7.0, 7.0, 8.0) _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel