tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Is static linking functional?


From: Roy Tam
Subject: Re: [Tinycc-devel] Is static linking functional?
Date: Wed, 18 Jun 2014 08:54:49 +0800

Hello,

2014-06-18 7:56 GMT+08:00 Wendell P <address@hidden>:
> On Mon, Jun 16, 2014, at 09:52 PM, address@hidden wrote:
>> > I have been using TCC 0.9.26 32-bit on Windows to compile with dynamic
>> > linking. No problems. I can't figure out static linking, though.
>>
>> For static linking, TCC needs *.a library or *.c files directly.
>> *.a files should be made by tiny_libmaker.
>
> What kind of file does tiny_libmaker operate on and what is the syntax?
> The docs don't say.

It is the same as GNU binutils ar(1) utility.

>
> I found the libraries I want as static lib.a compiled with MinGW. When I
> try to build with something like
>
> tcc -static app.c lib.a
>
> TCC complains that it can't find lib MSVCRT. For one thing, I've looked
> and I can't find a source for a msvcrt.a. For another thing, I made a
> dummy msvcrt.a to see what would happen, but TCC doesn't find it no
> matter where I put it. I have noticed that after I build something with
> dynamic linking, if I add the "-static" option, the error I get is that
> TCC can't find the libs.

First of all, tcc supports ELF-style object files and COFF resource files.
And MinGW gcc produces COFF object files, which tcc doesn't understand.
So you have to recompile the library with tcc or create def file with
DLL compiled with gcc.

Second, tcc reads msvcrt.def for exports and -static option will clear
all default library path, so don't do that unless you know what
library that is mandatory when linking.

>
> It shouldn't be asking for a MSVCRT lib anyway. What is it doing?
>

In tcc-win32, linking to msvcrt is mandatory unless you rewrite
lib/crt1.c *NOT* to use CRT functions and write+compile a static CRT
for tcc.


HTH,
Roy



reply via email to

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