compiling static
Jim Pazarena
fquest at paz.bz
Fri May 1 22:00:25 UTC 2015
It was as simple as placing -static on the gcc command line
On 2015-05-01 2:22 PM, Alex Merritt wrote:
> On Fri, May 1, 2015 at 5:02 PM, Jim Pazarena <fquest at paz.bz> wrote:
>
>> is there a way to tell cc (clang) to compile with static libraries?
>
>
> If you want to _compile_ code to a static library, you generate the object
> files and then use "ar" to assemble them together into an archive file (.a).
>
> cc -c file0.c file1.c ...
> ar rcus lib.a file0.o file1.o ...
>
> If you want to _link to_ (if that's what you mean by "compile with") static
> libraries, you may specify the archive path to the linker instead of using
> the dynamic linker flag (-l).
>
> cc prog.c /path/to/lib.a -o prog
>
> There may be other ways I am unfamiliar with. Is this not how gcc does it
> also?
>
> -Alex
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
More information about the freebsd-questions
mailing list