tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Unable to find include directories by tcc on Catalina


From: Peng Yu
Subject: Re: [Tinycc-devel] Unable to find include directories by tcc on Catalina
Date: Sun, 28 Mar 2021 10:55:22 -0500

I reinstalled CommandLineTools by the following command. clang and gcc
became these. But clang still does not work. Is there a way to let tcc
install use gcc instead of clang?

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ gcc --version
Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ which gcc
/Library/Developer/CommandLineTools/usr/bin/gcc
$ which clang
/Library/Developer/CommandLineTools/usr/bin/clang
$ gcc -E - <<< '#include <stdlib.h>' > /dev/null || echo "$?"
$ clang -E - <<< '#include <stdlib.h>' > /dev/null || echo "$?"
<stdin>:1:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
         ^~~~~~~~~~
1 error generated.
1

On Sun, Mar 28, 2021 at 10:34 AM Christian Jullien <eligis@orange.fr> wrote:
>
> Sorry, no ideas why clang does not work on your machine.
> Try to uninstall clang and previous tcc installed by brew.
> Reinstall clang and verify that a simple "Hello World" works when compiled by 
> clang.
> When it does, compile tcc as I said.
>
> C.
>
> -----Original Message-----
> From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] 
> On Behalf Of Peng Yu
> Sent: Sunday, March 28, 2021 17:18
> To: jullien@eligis.com; tinycc-devel@nongnu.org
> Subject: Re: [Tinycc-devel] Unable to find include directories by tcc on 
> Catalina
>
> On 3/28/21, Christian Jullien <eligis@orange.fr> wrote:
> > There is no specific instruction for macOS, here is what I use:
> >
> > git clone -b mob https://repo.or.cz/r/tinycc.git
> > # Ensure configure is an executable
> > chmod 755 tinycc/configure
> > cd tinycc
> > ./configure
> > make
>
> Somehow, clang does not work on my machine. Do you know how to fix the 
> problem?
>
> $ make
> clang -o tcc.o -c tcc.c
> -DCONFIG_USR_INCLUDE="\"/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include\""
> -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO        -DONE_SOURCE=0 -Wall -O2
> -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign
> -Wno-sign-compare -Wno-unused-result -I.
> In file included from tcc.c:21:
> ./tcc.h:29:10: fatal error: 'stdlib.h' file not found
> #include <stdlib.h>
>          ^~~~~~~~~~
> 1 error generated.
> make: *** [Makefile:238: tcc.o] Error 1
> $ gcc -E - <<< '#include <stdlib.h>' > /dev/null || echo "$?"
> $ clang -E - <<< '#include <stdlib.h>' > /dev/null || echo "$?"
> <stdin>:1:10: fatal error: 'stdlib.h' file not found
> #include <stdlib.h>
>          ^~~~~~~~~~
> 1 error generated.
> 1
> $ clang --version
> Apple clang version 12.0.0 (clang-1200.0.32.29)
> Target: x86_64-apple-darwin19.6.0
> Thread model: posix
> InstalledDir: /Library/Developer/CommandLineTools/usr/bin
> $ gcc --version
> Configured with:
> --prefix=/Applications/Xcode.app/Contents/Developer/usr
> --with-gxx-include-dir=/usr/include/c++/4.2.1
> Apple clang version 12.0.0 (clang-1200.0.32.28)
> Target: x86_64-apple-darwin19.6.0
> Thread model: posix
> InstalledDir: 
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>
> > make install-strip
> >
> > But mob is currently broken for -b option (bound checking)
> >
> > Use
> > https://repo.or.cz/tinycc.git/snapshot/e4f151c4cda30fd4c06655d87c3df02b6513fb54.tar.gz
> > instead which fully works.
> >
> > See: https://repo.or.cz/w/tinycc.git
> >
> >
> > C.
> >
> > -----Original Message-----
> > From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org]
> > On Behalf Of Peng Yu
> > Sent: Sunday, March 28, 2021 16:41
> > To: jullien@eligis.com
> > Cc: tinycc-devel
> > Subject: Re: [Tinycc-devel] Unable to find include directories by tcc on
> > Catalina
> >
> > Thanks. Where is the up-to-date installation instruction on macOS?
> >
> > On Sun, Mar 28, 2021 at 12:57 AM Christian Jullien <eligis@orange.fr> wrote:
> >>
> >> Hi,
> >> I don't know who maintains tcc for homebrew. You'd better ask him/her.
> >> Please note that tcc is de facto a source code mob package and it is
> >> generally advised to compile tcc form last mod.
> >> It appears that brew uses official 0.9.27 which is more than 3 years old.
> >> A lot of work has been made on mob, especially on macOS which, among
> >> others, now generates macho executables.
> >>
> >> For info, tcc compiled from mob gives:
> >> jullien@byas:~ $ tcc -vv
> >> tcc version 0.9.27 (x86_64 Darwin)
> >> install: /usr/local/lib/tcc
> >> include:
> >>   /usr/local/lib/tcc/include
> >>   /usr/local/include
> >>   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
> >> libraries:
> >>   /usr/lib
> >>   /lib
> >>   /usr/local/lib
> >> libtcc1:
> >>   /usr/local/lib/tcc/libtcc1.a
> >> crt:
> >>   /usr/lib
> >> elfinterp:
> >>   /lib64/ld-linux-x86-64.so.2
> >>
> >> However, I reported yesterday a regression bug on mod with macOS. The last
> >> macOS fully working version is
> >>
> >> https://repo.or.cz/tinycc.git/snapshot/e4f151c4cda30fd4c06655d87c3df02b6513fb54.tar.gz
> >> "
> >> 2021-02-18 grischka tccgen: fix "Allow declared arrays to be
> >> initialized..."
> >>
> >> Christian
> >>
> >> -----Original Message-----
> >> From: Peng Yu [mailto:pengyu.ut@gmail.com]
> >> Sent: Saturday, March 27, 2021 22:16
> >> To: jullien@eligis.com; tinycc-devel@nongnu.org
> >> Subject: Re: [Tinycc-devel] Unable to find include directories by tcc on
> >> Catalina
> >>
> >> I prefer to use homebrew as it is a systematic way to handle packages
> >> on macOS. Are you able to help to fix the bug in the homebrew tcc
> >> formula?
> >>
> >> On 3/27/21, Christian Jullien <eligis@orange.fr> wrote:
> >> > Hi can you please compile tcc using the latest source code from mod and
> >> > try
> >> > again?
> >> >
> >> > I use it daily this way.
> >> >
> >> > C.
> >> >
> >> > -----Original Message-----
> >> > From: Tinycc-devel
> >> > [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org]
> >> > On Behalf Of Peng Yu
> >> > Sent: Friday, March 26, 2021 23:39
> >> > To: tinycc-devel
> >> > Subject: [Tinycc-devel] Unable to find include directories by tcc on
> >> > Catalina
> >> >
> >> > Hi,
> >> >
> >> > tcc can not find the include directory correctly. It seems that the
> >> > include directories are hardcoded in the tcc binary. Should they be
> >> > put in a configuration file?
> >> >
> >> > How to fix this problem? Thanks.
> >> >
> >> > $ cat main.c
> >> > #include <stdio.h>
> >> >
> >> > int main() {
> >> >       puts("Hello World!");
> >> >       return 0;
> >> > }
> >> > $ tcc -run main.c
> >> > main.c:2: error: include file 'stdio.h' not found
> >> > $ brew info tcc
> >> > tcc: stable 0.9.27 (bottled)
> >> > Tiny C compiler
> >> > https://bellard.org/tcc/
> >> > /usr/local/Cellar/tcc/0.9.27_1 (19 files, 721KB) *
> >> >   Poured from bottle on 2021-03-26 at 17:21:54
> >> > From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/tcc.rb
> >> > License: LGPL-2.0-or-later
> >> > ==> Analytics
> >> > install: 49 (30 days), 138 (90 days), 544 (365 days)
> >> > install-on-request: 49 (30 days), 138 (90 days), 539 (365 days)
> >> > build-error: 0 (30 days)
> >> > $ tcc -vv
> >> > tcc version 0.9.27 (x86_64 Darwin)
> >> > install: /usr/local/Cellar/tcc/0.9.27_1/lib/tcc
> >> > include:
> >> >   /usr/local/include
> >> >
> >> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include
> >> >   /usr/local/Cellar/tcc/0.9.27_1/lib/tcc/include
> >> > libraries:
> >> >   /usr/lib
> >> >   /lib
> >> >   /usr/local/lib
> >> > libtcc1:
> >> >   /usr/local/Cellar/tcc/0.9.27_1/lib/tcc/libtcc1.a
> >> > crt:
> >> >   /usr/lib
> >> > elfinterp:
> >> >   /lib64/ld-linux-x86-64.so.2
> >> > $ strings $(which tcc) | grep /include
> >> > /usr/local/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include:{B}/include
> >> > $ ls -l
> >> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include
> >> > ls: cannot access
> >> > '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include':
> >> > No such file or directory
> >> >
> >> > --
> >> > Regards,
> >> > Peng
> >> >
> >> > _______________________________________________
> >> > 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
> >> >
> >>
> >>
> >> --
> >> Regards,
> >> Peng
> >>
> >
> >
> > --
> > Regards,
> > Peng
> >
> > _______________________________________________
> > 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
> >
>
>
> --
> Regards,
> Peng
>
> _______________________________________________
> 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



-- 
Regards,
Peng



reply via email to

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