tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] tcc build on OSX


From: David Mertens
Subject: Re: [Tinycc-devel] tcc build on OSX
Date: Sun, 1 May 2016 19:50:30 -0400

Hello Assaf,

On Sun, May 1, 2016 at 6:03 PM, Assaf Gordon <address@hidden> wrote:
Hello,

I can try to test some things on Mac OS X (10.10.4 with clang-602.0.53). please let me know if there are specific tests to do.

That would be great!
 
from a cursory look, perhaps it is possible that 'tcc' still compiles linux/ELF format despite being on Mac?

That is correct. It does produce proper machine code, however. This means that tcc can be used when invoked with the -run command-line option, and it can be used a jit compiler. So, I think the output that you give below makes sense.

David
 
regards,
 - gordon


===
$ uname
Darwin x 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64 i386 MacBookAir6,1 Darwin

$ git id
release_0_9_26-676-g6afe668

$ make distclean
$ ./configure
./configure
Binary  directory   /usr/local/bin
TinyCC directory    /usr/local/lib/tcc
Library directory   /usr/local/lib64
Include directory   /usr/local/include
Manual directory    /usr/local/share/man
Info directory      /usr/local/share/info
Doc directory       /usr/local/share/doc//usr/local/lib/tcc
Target root prefix
Source path      /Users/gordon/sources/tinycc
C compiler       gcc
cross compilers  no
Target CPU       x86-64
Host OS          Darwin
Target OS        Darwin
Big Endian       no
gprof enabled    no
use libgcc       no
Creating config.mak and config.h

$ make

$ ./tcc -v
tcc version 0.9.26 (x86-64 Linux)

$ cat 1.c
#include <stdio.h>

int main()
{
  printf("hello TCC world\n");
  return 0;
}

$ ./tcc -c -o 1.o 1.c
In file included from 1.c:1:
In file included from /usr/include/stdio.h:64:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"

$ file 1.o
1.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

$ ./tcc -o 1 1.c
tcc: error: file 'crt1.o' not found
tcc: error: file 'crti.o' not found
In file included from 1.c:1:
In file included from /usr/include/stdio.h:64:
/usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected"
tcc: error: file 'crtn.o' not found
tcc: error: undefined symbol 'printf'
===




For reference, here's the compilation and linking with apple's LLVM:
===
$ cc -v -c -o 1.o 1.c
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name 1.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 242.2 -v -dwarf-column-info -coverage-file /Users/gordon/sources/tinycc/1.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0 -fdebug-compilation-dir /Users/gordon/sources/tinycc -ferror-limit 19 -fmessage-length 150 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o 1.o -x c 1.c
clang -cc1 version 6.1.0 based upon LLVM 3.6.0svn default target x86_64-apple-darwin14.4.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

$ file 1.o
1.o: Mach-O 64-bit object x86_64

$ cc -v -o 1 1.o
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -o 1 1.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.osx.a

$ file 1
1: Mach-O 64-bit executable x86_64
===



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



--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

reply via email to

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