While building statically linked binaries on macOS is possible, Apple doesn’t 
officially support it.

https://developer.apple.com/library/content/qa/qa1118/_index.html 
<https://developer.apple.com/library/content/qa/qa1118/_index.html>

In order to do it, you have to build crt0.o yourself. Here are some brief 
instructions (warning, I’ve only tested this on macOS 10.12/x86_64)

1. Download the “c startup” source for Darwin from:

https://opensource.apple.com/source/Csu/Csu-85/ 
<https://opensource.apple.com/source/Csu/Csu-85/>

and unpack it somewhere.

2. Build with something like

SDKROOT=macosx RC_ARCHS=x86_64 make

3. Either, “make install” and the various crt*.o files will be installed in 
/usr/lib by default. This makes me nervous, so instead, I modified Fossil’s 
makefile to add a library path to where the locally built crt*.o files reside.

This fixes the error “ld: library not found for -lcrt0.o”, but then I’m 
confronted with errors because I don’t have a static libraries for libz, 
libcrypto, etc. This is where I stopped.

The next question that I don’t know the answer to is how dependent is crt0.o on 
the version of macOS and the underlying architecture? How many separate Fossil 
builds would need to be made?

I hope you find this useful.

—
Ryan

> On Apr 13, 2017, at 5:21 AM, Richard Hipp <d...@sqlite.org> wrote:
> 
> On 4/13/17, Jan Danielsson <jan.m.daniels...@gmail.com> wrote:
>> I think it's better to go back to the original idea of using
>> statically-linked libraries for the pre-built binaries.
> 
> That would be good.  But when I build on Mac using the --static option
> on ./configure I get an error:
> 
>   ld: library not found for -lcrt0.o
> 
> Are there any mac developers who can trouble-shoot this for me?
> -- 
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to