caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Compiling shared library with ocamlopt
@ 2011-12-02 18:43 nicholas.r.lucaroni
  2011-12-08 12:06 ` Stéphane Glondu
  0 siblings, 1 reply; 5+ messages in thread
From: nicholas.r.lucaroni @ 2011-12-02 18:43 UTC (permalink / raw)
  To: caml-list

I'm having an issue compiling a shared library for as a plugin w/ ocamlbuild.
Turning the verbose options on I see that ocamlopt generates the following
during the final linking, 

/opt/ocaml-3.12.1/bin/ocamlopt.opt -shared -verbose -cc gcc plugins/example.cmx
-o plugins/example.cmxs -ccopt -v
+ as -o 'plugins/example.cmxs.startup.o' '/tmp/camlstartupe6993f.s'
+ gcc -o 'plugins/example.cmxs'   '-L/opt/ocaml-3.12.1/lib/ocaml' -v
'plugins/example.cmxs.startup.o' 'plugins/example.o'

When I remove the -cc option from ocamlopt.opt, the shared flag is successfully
passed,

/opt/ocaml-3.12.1/bin/ocamlopt.opt -shared -verbose plugins/example.cmx -o
plugins/example.cmxs -ccopt -v
+ as -o 'plugins/example.cmxs.startup.o' '/tmp/camlstartup2c31a2.s'
+ gcc -shared -o 'plugins/example.cmxs'   '-L/opt/ocaml-3.12.1/lib/ocaml' -v
'plugins/example.cmxs.startup.o' 'plugins/example.o'

Seems like a bug in ocamlopt; has anyone experienced similar situations? Am I
missing anything or any options in compilation? 

Thanks.

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

* Re: [Caml-list] Compiling shared library with ocamlopt
  2011-12-02 18:43 [Caml-list] Compiling shared library with ocamlopt nicholas.r.lucaroni
@ 2011-12-08 12:06 ` Stéphane Glondu
  2011-12-08 13:11   ` Nicholas Lucaroni
  0 siblings, 1 reply; 5+ messages in thread
From: Stéphane Glondu @ 2011-12-08 12:06 UTC (permalink / raw)
  To: nicholas.r.lucaroni; +Cc: caml-list

On 12/02/2011 07:43 PM, nicholas.r.lucaroni@gmail.com wrote:
> I'm having an issue compiling a shared library for as a plugin w/ ocamlbuild.
> Turning the verbose options on I see that ocamlopt generates the following
> during the final linking, 
> 
> /opt/ocaml-3.12.1/bin/ocamlopt.opt -shared -verbose -cc gcc plugins/example.cmx
> -o plugins/example.cmxs -ccopt -v
> + as -o 'plugins/example.cmxs.startup.o' '/tmp/camlstartupe6993f.s'
> + gcc -o 'plugins/example.cmxs'   '-L/opt/ocaml-3.12.1/lib/ocaml' -v
> 'plugins/example.cmxs.startup.o' 'plugins/example.o'
> 
> When I remove the -cc option from ocamlopt.opt, the shared flag is successfully
> passed,

Where does the -cc flag come from?

-- 
Stéphane

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

* Re: [Caml-list] Compiling shared library with ocamlopt
  2011-12-08 12:06 ` Stéphane Glondu
@ 2011-12-08 13:11   ` Nicholas Lucaroni
  2011-12-08 13:35     ` Stéphane Glondu
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Lucaroni @ 2011-12-08 13:11 UTC (permalink / raw)
  To: Stéphane Glondu; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

From ocamlbuild, possibly from my plugin for it, but I should be able to
set cc and shared? They don't seem like mutually exclusive options.

On Thursday, December 8, 2011, Stéphane Glondu <steph@glondu.net> wrote:
> On 12/02/2011 07:43 PM, nicholas.r.lucaroni@gmail.com wrote:
>> I'm having an issue compiling a shared library for as a plugin w/
ocamlbuild.
>> Turning the verbose options on I see that ocamlopt generates the
following
>> during the final linking,
>>
>> /opt/ocaml-3.12.1/bin/ocamlopt.opt -shared -verbose -cc gcc
plugins/example.cmx
>> -o plugins/example.cmxs -ccopt -v
>> + as -o 'plugins/example.cmxs.startup.o' '/tmp/camlstartupe6993f.s'
>> + gcc -o 'plugins/example.cmxs'   '-L/opt/ocaml-3.12.1/lib/ocaml' -v
>> 'plugins/example.cmxs.startup.o' 'plugins/example.o'
>>
>> When I remove the -cc option from ocamlopt.opt, the shared flag is
successfully
>> passed,
>
> Where does the -cc flag come from?
>
> --
> Stéphane
>

[-- Attachment #2: Type: text/html, Size: 1260 bytes --]

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

* Re: [Caml-list] Compiling shared library with ocamlopt
  2011-12-08 13:11   ` Nicholas Lucaroni
@ 2011-12-08 13:35     ` Stéphane Glondu
  2011-12-08 20:26       ` Nick Lucaroni
  0 siblings, 1 reply; 5+ messages in thread
From: Stéphane Glondu @ 2011-12-08 13:35 UTC (permalink / raw)
  To: Nicholas Lucaroni; +Cc: caml-list

On 12/08/2011 02:11 PM, Nicholas Lucaroni wrote:
> From ocamlbuild, possibly from my plugin for it, but I should be able to
> set cc and shared? They don't seem like mutually exclusive options.

It works if you add -cc "gcc -shared", or -ccopt -shared. Looking at
call_linker in utils/ccomp.ml, it seems to be by design: the command to
link executables and the command to link plugins are two different
variables, that are both overridden by the -cc option.

I suggest you to add -ccopt -shared when linking a plugin in your
myocamlbuild.ml (or not using -cc at all).


Cheers,

-- 
Stéphane

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

* Re: [Caml-list] Compiling shared library with ocamlopt
  2011-12-08 13:35     ` Stéphane Glondu
@ 2011-12-08 20:26       ` Nick Lucaroni
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Lucaroni @ 2011-12-08 20:26 UTC (permalink / raw)
  To: Stéphane Glondu; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]

Yeah, that's what someone had mentioned on another forum. I had also
mentioned there that passing the -ccopt -shared works, and it's my current
plan of attack. I wish I could get ride of -cc, but it's necessary for
x-compiling and (semi-necessary) for mpi.

Thanks for your help though.


On Thu, Dec 8, 2011 at 8:35 AM, Stéphane Glondu <steph@glondu.net> wrote:

> On 12/08/2011 02:11 PM, Nicholas Lucaroni wrote:
> > From ocamlbuild, possibly from my plugin for it, but I should be able to
> > set cc and shared? They don't seem like mutually exclusive options.
>
> It works if you add -cc "gcc -shared", or -ccopt -shared. Looking at
> call_linker in utils/ccomp.ml, it seems to be by design: the command to
> link executables and the command to link plugins are two different
> variables, that are both overridden by the -cc option.
>
> I suggest you to add -ccopt -shared when linking a plugin in your
> myocamlbuild.ml (or not using -cc at all).
>
>
> Cheers,
>
> --
> Stéphane
>

[-- Attachment #2: Type: text/html, Size: 1514 bytes --]

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

end of thread, other threads:[~2011-12-08 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-02 18:43 [Caml-list] Compiling shared library with ocamlopt nicholas.r.lucaroni
2011-12-08 12:06 ` Stéphane Glondu
2011-12-08 13:11   ` Nicholas Lucaroni
2011-12-08 13:35     ` Stéphane Glondu
2011-12-08 20:26       ` Nick Lucaroni

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).