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
ocamlc -c and ocamlopt -c differ for C files #7678
Comments
Comment author: @dbuenzli Forgot to add the failing
|
Comment author: @dbuenzli Also AFAIK macOS is no affected by this. |
Comment author: @xavierleroy That's not intended and something we need to fix. What happens currently (I guess) is that ocamlopt uses the C compiler and flags used to compile asmrun/ and ocamlc uses the C compiler and flags used to compile byterun/. One has -fPIC and not the other, but it should not show up this way. We should also all agree that ocamlc -c and ocamlopt -c should both produce PIC code by default. For me that's clearly a "yes" because they are commonly used to compile Caml-C stub code that ends up in DLLs. |
I was hoping maybe the switch to Is there anything I can do so that we resolve this discrepancy for the next release (4.09) ? I'm not sure exactly which bit should be poked but So is it a matter of simply adding |
In general, the autoconf work aimed to produce identical output files to the build system, so it's worth pinging issues as a reminder - in some ways, fixing this would have been regarded as a regression! |
Use same cflags and cppflags for ocamlc -c and ocamlopt -c (#7678)
Original bug ID: 7678
Reporter: @dbuenzli
Status: acknowledged (set by @xavierleroy on 2017-11-26T16:21:45Z)
Resolution: open
Priority: normal
Severity: minor
OS: Linux
Version: 4.06.0
Target version: 4.07.0+dev/beta2/rc1/rc2
Category: compiler driver
Monitored by: @gasche @yallop @dra27 @dbuenzli
Bug description
I don't know if that is intended but it seems that
-fPIC
is not passed in the second case.This makes
ocamlmklib
to fail to produce libraries for C object files generated with ocamlopt -c.Steps to reproduce
Our C file
Here all is well
Here we fail note the missing
-fPIC
w.r.t above invocationAdditional information
The text was updated successfully, but these errors were encountered: