caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Forcing gcc/ocamlopt to link against specific versions of libc.so and libm.so
@ 2011-01-24 15:00 David Allsopp
  2011-01-24 16:48 ` Микола Стрєбков
  0 siblings, 1 reply; 3+ messages in thread
From: David Allsopp @ 2011-01-24 15:00 UTC (permalink / raw)
  To: 'OCaml List (caml-list@inria.fr)'

[I think this question is more about gcc options than anything else so please don't be put off by the fact it's about FreeBSD!] 

I'm working with OCaml 3.12.0 on FreeBSD 8.1 and need to produce native binaries which are compatible with FreeBSD 6.4. I have therefore installed the compat6x package. FreeBSD 8.1 has /lib/libm.so.5 and /lib/libc.so.7 and the compat6x package gives me /usr/local/lib/compat/libm.so.4 and /usr/local/lib/compat/libc.so.6 as they're what shipped in FreeBSD 6.x

My question therefore is twofold:

1. What do I have to pass to gcc to tell it to use the older libm.so.4 and libc.so.6?
2. What's the best way to pass those instructions to OCaml's configure script?

At the moment, after running configure I've simply edited config/Makefile and put -static before -lm in NATIVECCLIBS but that's obviously producing executables which are a bit larger than I'd like (and I expect that kills native dynlink as well?)

Any help much appreciated!


David


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Forcing gcc/ocamlopt to link against specific versions of libc.so and libm.so
  2011-01-24 15:00 [Caml-list] Forcing gcc/ocamlopt to link against specific versions of libc.so and libm.so David Allsopp
@ 2011-01-24 16:48 ` Микола Стрєбков
  2011-01-24 21:48   ` David Allsopp
  0 siblings, 1 reply; 3+ messages in thread
From: Микола Стрєбков @ 2011-01-24 16:48 UTC (permalink / raw)
  To: David Allsopp; +Cc: 'OCaml List (caml-list@inria.fr)'

Hi, David

On 24 січ. 2011, at 17:00, David Allsopp wrote:

> I'm working with OCaml 3.12.0 on FreeBSD 8.1 and need to produce native binaries which are compatible with FreeBSD 6.4. I have therefore installed the compat6x package. FreeBSD 8.1 has /lib/libm.so.5 and /lib/libc.so.7 and the compat6x package gives me /usr/local/lib/compat/libm.so.4 and /usr/local/lib/compat/libc.so.6 as they're what shipped in FreeBSD 6.x
> 
> My question therefore is twofold:
> 
> 1. What do I have to pass to gcc to tell it to use the older libm.so.4 and libc.so.6?

Look at the -nostartfiles, -nodefaultlibs and -nostdlib. Those options should allow you to pass exact libraries to linker.

-- 
Mykola Stryebkov
Public key: http://mykola.org/pubkey.txt
fpr: 0226 54EE C1FF 8636 36EF  2AC9 BCE9 CFC7 9CF4 6747



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Caml-list] Forcing gcc/ocamlopt to link against specific versions of libc.so and libm.so
  2011-01-24 16:48 ` Микола Стрєбков
@ 2011-01-24 21:48   ` David Allsopp
  0 siblings, 0 replies; 3+ messages in thread
From: David Allsopp @ 2011-01-24 21:48 UTC (permalink / raw)
  To: 'Микола
	Стрєбков'
  Cc: 'OCaml List'

Микола Стрєбков wrote:
> Hi, David
> 
> On 24 січ. 2011, at 17:00, David Allsopp wrote:
> 
> > I'm working with OCaml 3.12.0 on FreeBSD 8.1 and need to produce native
> binaries which are compatible with FreeBSD 6.4. I have therefore installed
> the compat6x package. FreeBSD 8.1 has /lib/libm.so.5 and /lib/libc.so.7
> and the compat6x package gives me /usr/local/lib/compat/libm.so.4 and
> /usr/local/lib/compat/libc.so.6 as they're what shipped in FreeBSD 6.x
> >
> > My question therefore is twofold:
> >
> > 1. What do I have to pass to gcc to tell it to use the older libm.so.4
> and libc.so.6?
> 
> Look at the -nostartfiles, -nodefaultlibs and -nostdlib. Those options
> should allow you to pass exact libraries to linker.

Thanks for the confidence boost - I had looked at these switches but was
guessing/hoping that there was some other way of specifying versions of .so
files. I hacked OCaml's configure script to redefine
mathlib='/usr/local/lib/compat/libm.so.4' (there doesn't seem to be a way to
replace the default -lm via the command line to configure - but as it's an
easy patch, perhaps I'll open a feature request with the patch) and
configured OCaml with

	./configure -lib '-nodefaultlibs /usr/local/lib/compat/libc.so.6'

and OCaml seems to be working correctly (and ldd shows the resulting
executables are linked against the older versions).


David



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-24 21:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24 15:00 [Caml-list] Forcing gcc/ocamlopt to link against specific versions of libc.so and libm.so David Allsopp
2011-01-24 16:48 ` Микола Стрєбков
2011-01-24 21:48   ` David Allsopp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).