tcc does not compile when tcc is used instead of default C compiler After compiling tcc with gcc (clang), I execute "make install", then I try to recompile tcc with tcc. It gives:
jullien@byas tinycc % ./configure --cc=tcc configure: error: 'tcc' failed to compile conftest.c. ./configure: line 326: ./conftest: No such file or directory ./configure: line 330: ./conftest: No such file or directory Binary directory /usr/local/bin TinyCC directory /usr/local/lib/tcc Library directory /usr/local/lib Include directory /usr/local/include Manual directory /usr/local/share/man Info directory /usr/local/share/info Doc directory /usr/local/share/doc /usr/include dir /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include Source path /Users/jullien/tinycc C compiler tcc (0.0) Target OS Darwin CPU x86_64 Config OSX Creating config.mak and config.h Indeed: jullien@byas tinycc % tcc -o ./conftest /Users/jullien/tinycc/conftest.c /Users/jullien/tinycc/conftest.c:70: error: '__GNUC_MINOR__' undeclared -----Original Message----- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Christian Jullien Sent: Sunday, June 21, 2020 06:56 To: tinycc-devel@nongnu.org; jull...@eligis.com Cc: 'Karl Yerkes' Subject: Re: [Tinycc-devel] Mach-O (i.e. MacOS) support Hello Matz, Amazing!! I'm glad to be the first to tell you it works ROOTB including all tests. (I'll do more tests with OpenLisp but I'm confident) I think you can drop 32bit support as Apple no longer supports 32bit binaries on latest OS version. I tested this port on - MacBook Air 2011 running High-Sierra jullien@jacquet:~/tinycc $ uname -a Darwin jacquet.local 17.7.0 Darwin Kernel Version 17.7.0: Wed May 27 17:00:02 PDT 2020; root:xnu-4570.71.80.1~1/RELEASE_X86_64 x86_64 jullien@jacquet:~/tinycc $ clang -v Apple LLVM version 10.0.0 (clang-1000.10.44.4) Target: x86_64-apple-darwin17.7.0 jullien@jacquet:~/tinycc $ file tcc tcc: Mach-O 64-bit executable x86_64 - MacBook Pro 2012 running Catalina (fully up to date) jullien@byas tinycc % uname -a Darwin byas.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64 jullien@byas tinycc % clang -v Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin19.5.0 jullien@byas tinycc % file tcc tcc: Mach-O 64-bit executable x86_64 I only get the following warning when running the tests suite: ------------ memtest ------------ In file included from ../tcc.c:23: In file included from ../libtcc.c:22: ../tccpp.c:1439:33: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] fprintf(s->ppfp, "\n[%s]\n" + !(s->dflag & 32), p), fflush(s->ppfp); ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ../tccpp.c:1439:33: note: use array indexing to silence this warning fprintf(s->ppfp, "\n[%s]\n" + !(s->dflag & 32), p), fflush(s->ppfp); ^ & [ ] ../tccpp.c:3823:20: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] fprintf(fp, " %s" + s, get_tok_str(t, &cval)), s = 1; ~~~~~~^~~ ../tccpp.c:3823:20: note: use array indexing to silence this warning fprintf(fp, " %s" + s, get_tok_str(t, &cval)), s = 1; ^ & [ ] In file included from ../tcc.c:23: In file included from ../libtcc.c:24: ../tccelf.c:1421:36: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] set_local_sym(s1, "___rt_info" + !s1->leading_underscore, s, o); ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ ../tccelf.c:1421:36: note: use array indexing to silence this warning set_local_sym(s1, "___rt_info" + !s1->leading_underscore, s, o); ^ & [ ] In file included from ../tcc.c:23: In file included from ../libtcc.c:25: ../tccrun.c:148:36: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] tcc_add_symbol(s1, "_exit" + !s1->leading_underscore, rt_exit); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ ../tccrun.c:148:36: note: use array indexing to silence this warning tcc_add_symbol(s1, "_exit" + !s1->leading_underscore, rt_exit); ^ & [ ] 4 warnings generated. OK -----Original Message----- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Michael Matz Sent: Saturday, June 20, 2020 23:47 To: jull...@eligis.com; tinycc-devel@nongnu.org Cc: Karl Yerkes Subject: [Tinycc-devel] Mach-O (i.e. MacOS) support Hello, On Tue, 16 Jun 2020, Christian Jullien wrote: > Hi, it looks new and I?ve not tested this solution but it may help to > finally get a native tcc port on macOS. Image is around 200Gb I've just pushed my macos port to mob. It's lightly tested but seems to work reasonably well, the testsuite is clean. I.e. you can now create proper Mach-O executable files, link against system .dylibs and such. I didn't bother implementing a Mach-O object file reader, so the support is similar to Windows: you need to use TCC to compile C files into .o files (which are ELF files), and then TCC to link those, which generates Mach-O executables. Generating shared libraries isn't implemented, neither are 32bit objects. The generated executables should be runnable with relatively old MacOS versions (dyld needs to support LC_MAIN, so 10.8 should be enough) but I've developed and checked this only on 10.14 (Mojave). You need at least the command line tools installed for system headers, but you don't need to unpack them into /usr/include (modern MacOS deprecated that one), the configure step tries to figure out the correct SDK directory by using xcrun (which is then hardcoded into TCC as search path for now). For emulation I started with https://github.com/foxlet/macOS-Simple-KVM.git (I didn't want to start with docker and prefer plain qemu) and used the image fetcher from https://github.com/kholia/OSX-KVM.git . So, people with a real Mac: try it and give feedback ;-) Ciao, Michael. _______________________________________________ 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