From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 78F46BC9F for ; Thu, 11 Aug 2005 22:17:29 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7BKHRR7030711 for ; Thu, 11 Aug 2005 22:17:28 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA05393 for ; Thu, 11 Aug 2005 22:17:27 +0200 (MET DST) Received: from smtp2.mathworks.com (smtp2.mathworks.com [144.212.95.218]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7BKHPSE030702 for ; Thu, 11 Aug 2005 22:17:25 +0200 Received: from mail-vif.mathworks.com (fred-ce0.mathworks.com [144.212.95.18]) by smtp2.mathworks.com (8.12.11/8.12.11) with ESMTP id j7BKHOl9008381 for ; Thu, 11 Aug 2005 16:17:24 -0400 (EDT) Received: from MESSAGE-AH.ad.mathworks.com (ex-01-ah.mathworks.com [144.212.95.156]) by mail-vif.mathworks.com (8.11.7/8.11.7) with ESMTP id j7BKHOt07137 for ; Thu, 11 Aug 2005 16:17:24 -0400 (EDT) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C59EB1.AF989A5D" Subject: OCAML and Dynamic Libraries Date: Thu, 11 Aug 2005 16:17:23 -0400 Message-ID: Thread-Topic: OCAML and Dynamic Libraries thread-index: AcWesa9Ak6ptlU8mTS6GWoVZgljSCg== From: "Alexander Bottema" To: X-Miltered: at concorde with ID 42FBB257.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42FBB255.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 ocamlopt:01 heap:01 ocamlopt:01 -output-obj:01 ocamlmklib:01 usr:01 recompile:01 -fpic:01 globals:01 compiler:01 heap:01 ocamlmklib:01 usr:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=HTML_MESSAGE autolearn=disabled version=3.0.3 This is a multi-part message in MIME format. ------_=_NextPart_001_01C59EB1.AF989A5D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all OCAML users, =20 Our group is considering using OCAML 3.08.3 (i.e. the currently latest version) for a project on the MathWorks, but we have run into some problems. Currently, the platforms that we need to support are: Linux (I386), Linux (AMD64), Windows 2000 (and XP), Solaris 2 and Mac OS X. I've been able to successfully build and run OCAML on all platforms and there are no problems in creating standalone executables (via ocamlopt) on all mentioned platforms. =20 We need to create a dynamic link library (containing OCAML code) because the execution context needs to share data on the same heap as the main process (MATLAB in our case). I've been able to successfully do this for Windows and Linux I386. I think that Solaris 2 should work as well, although this is currently under investigation. =20 However, on the Linux AMD64 and Mac OS X platforms I consistently get the following errors: (Although this is not the actual steps for us, it produces the same error): =20 Linux AMD64: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 ocamlopt -output-obj -o test_obj.o test.ml ocamlmklib -o test test_obj.o =20 /usr/bin/ld: test_obj.o: relocation R_X86_64_32S against `caml_curry2_1' can not be used when making a shared object; recompile with -fPIC test_obj.o: could not read symbols: Bad value collect2: ld returned 1 exit status =20 Mac OS X: =3D=3D=3D=3D=3D=3D=3D=3D =20 ld: test_obj.o has external relocation entries in non-writable section (__TEXT,__text) for symbols: _caml_call_gc _caml_globals_inited _caml_c_call ld: test_obj.o has local relocation entries in non-writable section (__TEXT,__text) =20 ----- =20 The test.ml just contains: print_string "Hello World\n";; =20 Although this is a meaningless DLL it shouldn't fail to build (and it successfully builds on Linux I386 and Windows). I've been able to write a program that calls ocaml_startup and get the right answer by calling a registered ocaml function in such a DLL (successfully proven for Solaris 2, Linux I386, and Win32). =20 The questions are: =20 What's going on? Is the OCAML compiler emitting some kind of object code that is not recognized by the linkers on these two platforms?=20 Can I easily fix this? Have others have had the same experience? If it is currently unsupported, will/when it be supported? =20 Thanks, =20 Alexander Bottema Senior Software Developer Embedded MATLAB, The MathWorks =20 ------_=_NextPart_001_01C59EB1.AF989A5D Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi all OCAML users,

 

Our group is considering using OCAML 3.08.3 (i.e. the = currently latest version) for a project on the MathWorks, but we have run into = some problems.

Currently, the platforms that we need to support are: = Linux (I386), Linux (AMD64), Windows 2000 (and XP), Solaris 2 and Mac OS = X.

I’ve been able to successfully build and run = OCAML on all platforms and there are no problems in creating standalone = executables (via ocamlopt) on all mentioned platforms.

 

We need to create a dynamic link library (containing = OCAML code) because the execution context needs to share data on the same heap = as the main process (MATLAB in our case). I’ve been able to successfully = do this for Windows and Linux I386. I think that Solaris 2 should work as well, although this is currently under = investigation.

 

However, on the Linux AMD64 and Mac OS X platforms I = consistently get the following errors:

(Although this is not the actual steps for us, it = produces the same error):

 

Linux AMD64:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

 

ocamlopt –output-obj –o test_obj.o = test.ml

ocamlmklib –o test = test_obj.o

 

/usr/bin/ld: test_obj.o: relocation R_X86_64_32S = against `caml_curry2_1' can not be used when making a shared object; recompile = with -fPIC

test_obj.o: could not read symbols: Bad = value

collect2: ld returned 1 exit = status

 

Mac OS X:

=3D=3D=3D=3D=3D=3D=3D=3D

 

ld: test_obj.o has external relocation entries in non-writable section (__TEXT,__text) for = symbols:

_caml_call_gc

_caml_globals_inited

_caml_c_call

ld: test_obj.o has local relocation entries in = non-writable section (__TEXT,__text)

 

-----

 

The test.ml just = contains:

print_string “Hello = World\n”;;

 

Although this is a meaningless DLL it shouldn’t = fail to build (and it successfully builds on Linux I386 and Windows). = I’ve been able to write a program that calls ocaml_startup and get the right = answer by calling a registered ocaml function in such a DLL (successfully = proven for Solaris 2, Linux I386, and Win32).

 

The questions are:

 

What’s going on?

Is the OCAML compiler emitting some kind of object = code that is not recognized by the linkers on these two platforms? =

Can I easily fix this?

Have others have had the same = experience?

If it is currently unsupported, will/when it be = supported?

 

Thanks,

 

Alexander = Bottema

Senior Software = Developer

Embedded MATLAB, The = MathWorks

 

------_=_NextPart_001_01C59EB1.AF989A5D--