Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocamlmklib's -L option does not work as expected with Microsoft Visual C compiler #5659

vicuna opened this issue Jun 21, 2012 · 2 comments


Copy link

@vicuna vicuna commented Jun 21, 2012

Original bug ID: 5659
Reporter: @db4
Status: closed (set by @damiendoligez on 2012-07-17T18:33:08Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.1
Target version: 4.00.0+dev
Fixed in version: 4.00.0+dev
Category: platform support (windows, cross-compilation, etc)

Bug description

Consider the following scenario (all files are attached below):


C:\Work\Ocaml\Bug\ocamlmklib>ocamlc -c foo_stubs.c

C:\Work\Ocaml\Bug\ocamlmklib>ocamlmklib -verbose -Lc:/Ocaml/lib foo_stubs
.obj -o foo

  • flexlink -merge-manifest -o .\dllfoo.dll foo_stubs.obj -Lc:/Ocaml/lib

  • link /lib /nologo /out:.\libfoo.lib foo_stubs.obj

  • ocamlc -a -o foo.cma -dllib -lfoo -cclib -lfoo -ccopt -Lc:/Ocaml/lib

  • ocamlopt -a -o foo.cmxa -cclib -lfoo -ccopt -Lc:/Ocaml/lib

C:\Work\Ocaml\Bug\ocamlmklib>ocamlc -verbose foo.cma -output-obj -o bar.obj

  • cl /nologo -D_CRT_SECURE_NO_DEPRECATE /Ox /MD -c -Lc:/Ocaml/lib -I"C:\Ocaml\lib" "bar.c"
    cl : Command line warning D9002 : ignoring unknown option '-Lc:/Ocaml/lib' bar.c

Note strange "-ccopt -Lc:/Ocaml/lib" that ocamlmklib generates and that is not recognized later by Microsoft C compiler. Why -L path is put into -ccopt?

File attachments

Copy link

@vicuna vicuna commented Jul 12, 2012

Comment author: @damiendoligez

For reference, I have attached the patch proposed by Fabrice.

Copy link

@vicuna vicuna commented Jul 17, 2012

Comment author: @damiendoligez

Tested and applied Fabrice's patch in 4.00 (commit 12723) and trunk (commit 12724).

@vicuna vicuna closed this Jul 17, 2012
@vicuna vicuna added this to the 4.00.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant