Patching away the use of static libraries

Malte Tancred <[email protected]> Tue, 23 Jul 2002 20:17:41 +0200
Newsgroups gmane.org.djb.miscellaneous
Message-ID <[email protected]>
Hi!

I've asked a few questions on Apple's unix porting
mailing list and found out that static linking
"isn't supported" on Mac OS X.

What this means in reality is that some of djb's
packages builds on Mac OS X while others don't. It
feels like the order in which symbols are referenced
in the link stage has something to do with it, but
I'm no expert in the area.

One package that doesn't build is mess822. I patched
the makefile so that no libraries were generated, eg:

 From the original makefile:
822date: \
load 822date.o libtai.a mess822.a getln.a strerr.a substdio.a \
stralloc.a alloc.a error.a str.a case.a fs.a
         ./load 822date libtai.a mess822.a getln.a strerr.a \
         substdio.a stralloc.a alloc.a error.a str.a case.a fs.a

Changed to:
822date: \
load 822date.o tai_now.o tai_pack.o tai_unpack.o caldate_fmjd.o \
caldate_mjd.o caldate_fmt.o caldate_scan.o leapsecs_read.o 
leapsecs_init.o \
leapsecs_add.o leapsecs_sub.o caltime_tai.o caltime_utc.o caltime_fmt.o \
caltime_scan.o mess822_date.o mess822_quote.o mess822_fold.o \
mess822_token.o mess822_addr.o mess822_when.o mess822_line.o 
mess822_ok.o \
getln.o getln2.o strerr_sys.o strerr_die.o substdio.o substdi.o 
substdo.o \
subfderr.o subfdout.o subfdouts.o subfdin.o subfdins.o substdio_copy.o \
stralloc_num.o stralloc_eady.o stralloc_pend.o stralloc_copy.o \
stralloc_opys.o stralloc_opyb.o stralloc_cat.o stralloc_cats.o \
stralloc_catb.o alloc.o alloc_re.o error.o error_str.o str_len.o \
str_diff.o str_diffn.o str_chr.o str_rchr.o str_start.o byte_chr.o \
byte_rchr.o byte_copy.o byte_cr.o case_diffb.o case_diffs.o 
scan_ulong.o \
scan_long.o scan_sign.o
         ./load 822date tai_now.o tai_pack.o tai_unpack.o caldate_fmjd.o \
caldate_mjd.o caldate_fmt.o caldate_scan.o leapsecs_read.o 
leapsecs_init.o \
leapsecs_add.o leapsecs_sub.o caltime_tai.o caltime_utc.o caltime_fmt.o \
caltime_scan.o mess822_date.o mess822_quote.o mess822_fold.o \
mess822_token.o mess822_addr.o mess822_when.o mess822_line.o 
mess822_ok.o \
getln.o getln2.o strerr_sys.o strerr_die.o substdio.o substdi.o 
substdo.o \
subfderr.o subfdout.o subfdouts.o subfdin.o subfdins.o substdio_copy.o \
stralloc_num.o stralloc_eady.o stralloc_pend.o stralloc_copy.o \
stralloc_opys.o stralloc_opyb.o stralloc_cat.o stralloc_cats.o \
stralloc_catb.o alloc.o alloc_re.o error.o error_str.o str_len.o \
str_diff.o str_diffn.o str_chr.o str_rchr.o str_start.o byte_chr.o \
byte_rchr.o byte_copy.o byte_cr.o case_diffb.o case_diffs.o 
scan_ulong.o \
scan_long.o scan_sign.o


It's ugly but it compiles without warnings and the programs
seem to work as expected.

   What I am wondering if is this kind of patching is "ok"?

   Do you know of a better way to solve the problem, besides
   convincing Apple to make static linking work?

Cheerio,
Malte