tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Major issue with current macos port. clang and tcc .o


From: Christian Jullien
Subject: Re: [Tinycc-devel] Major issue with current macos port. clang and tcc .o are not compatible
Date: Wed, 24 Jun 2020 17:02:04 +0200

Arnold, here is non-working example on macos (Catalina) with mob:

--- foo.c

int foo = 1;

 

--- main.c

#include <stdio.h>

extern int foo;

int

main() {

        printf("foo: %d\n", foo);

}

 

jullien@byas /tmp % tcc -o foo.o -c foo.c

jullien@byas /tmp % ar cru libfoo.a foo.o

jullien@byas /tmp % tcc -o foo main.c -L. -lfoo

tcc: error: undefined symbol '_foo'

jullien@byas /tmp % nm libfoo.a

 

foo.o:

0000000000000000 D _foo

 

 

But:

jullien@byas /tmp % rm libfoo.a

jullien@byas /tmp % tcc -ar cru libfoo.a foo.o

jullien@byas /tmp % tcc -o foo main.c -L. -lfoo

jullien@byas /tmp % ./foo

foo: 1

jullien@byas /tmp %

 

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Christian Jullien
Sent: Wednesday, June 24, 2020 16:37
To: arnold@skeeve.com; tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Major issue with current macos port. clang and tcc .o are not compatible

 

Sure that's also what I do on the different Linux that support tcc (x86,

x86_64, arm, aarch64, riscv).

On macos it does not work because it fails when trying to "ar *.o" as .o are

not MACH-O but ELF. macOS version of ar silently drop them.

To work, you have to adapt configure.ac to use "tcc -ar" instead of ar *AND*

no longer call ranlib.

 

C.

 

-----Original Message-----

From: arnold@skeeve.com [mailto:arnold@skeeve.com]

Sent: Wednesday, June 24, 2020 16:29

To: tinycc-devel@nongnu.org; jullien@eligis.com

Subject: Re: [Tinycc-devel] Major issue with current macos port. clang and

tcc .o are not compatible

 

"Christian Jullien" <eligis@orange.fr> wrote:

 

> I think that what annoys me the most is that standard ar and ranlib

commands do not work with tcc generated .o files.

> For sure, I can drop ranlib calls and replace ar by "tcc -ar rcs" but this

must be done in every configure.ac and standard .m4 you have or use.

> It means that you probably won't be able to use any open source package

with "CC=tcc ./configure".

 

I build gawk that way on Linux all the time, for years. Including the

static libray of support routines. So, are you sure?

 

Arnold

 

 

_______________________________________________

Tinycc-devel mailing list

Tinycc-devel@nongnu.org

https://lists.nongnu.org/mailman/listinfo/tinycc-devel


reply via email to

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