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

Closed
vicuna opened this issue Jun 21, 2012 · 2 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link

commented Jun 21, 2012

Original bug ID: 5659
Reporter: db
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>make.bat

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

C:\Work\Ocaml\Bug\ocamlmklib>ocamlmklib -verbose -Lc:/Ocaml/lib foo.ml 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 foo.ml -dllib -lfoo -cclib -lfoo -ccopt -Lc:/Ocaml/lib

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

C:\Work\Ocaml\Bug\ocamlmklib>ocamlc -verbose foo.cma bar.ml -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
    C:\Work\Ocaml\Bug\ocamlmklib>

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

@vicuna

This comment has been minimized.

Copy link
Author

commented Jul 12, 2012

Comment author: @damiendoligez

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

@vicuna

This comment has been minimized.

Copy link
Author

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
You can’t perform that action at this time.