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:[email protected]] On 
Behalf Of Christian Jullien
Sent: Wednesday, June 24, 2020 16:37
To: [email protected]; [email protected]
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: [email protected] [mailto:[email protected]] 

Sent: Wednesday, June 24, 2020 16:29

To: [email protected]; [email protected]

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

tcc .o are not compatible

 

"Christian Jullien" <[email protected]> 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

[email protected]

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

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to