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

linking problems with implicit C-options #2681

Closed
vicuna opened this issue Feb 9, 2001 · 2 comments
Closed

linking problems with implicit C-options #2681

vicuna opened this issue Feb 9, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 9, 2001

Original bug ID: 282
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hello,

there seems to be a problem with the order in which C-flags are passed
when linking against libraries that store them implicitly. E.g.:

ocamlc -verbose
-I ../../lib
-ccopt -L../../lib
bigarray.cma lacaml.cma
-I /raid/user/markus/local/lib/ocaml/contrib pcre.cma
-o lin_reg
lin_reg.cmo

This indicates that "../../lib" should be used as library-path before
any other paths. However, "pcre.cma" contains implicit C-options that
add "/raid/user/markus/local/lib/ocaml/contrib" to the library-path.
Unfortunately, "ocamlc" passes these implicit arguments to gcc before
the paths specified on the command line (verbose output):

gcc -o lin_reg
-I/raid/user/markus/local/lib/ocaml
-L/raid/user/markus/local/lib/ocaml/contrib
-L../../lib
/tmp/camlprim0.c
-L../../lib
-L/raid/user/markus/local/lib/ocaml/contrib
-L/raid/user/markus/local/lib/ocaml
-lpcre -llacaml -llapack_myXerbla
-lblas_myXerbla -lf2c_noMain -lbigarray -lcamlrun -lm -lcurses

As you see, "-L../../lib" comes after "-L*/contrib", which shouldn't
happen. The problem here is that the "contrib"-directory also contains
a (different) implementation of "lacaml" against "gcc" will mistakenly
link now, possibly causing a link error or (even worse) creating a binary
that can behave in unpredictable ways.

Maybe I don't really understand the way in which things work, but I think
that "ocamlc" should pass C-options implicitly stored in libraries in a
different order (respecting the order of command line flags) to prevent
the problem above.

Best regards,
Markus Mottl

--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl

@vicuna
Copy link
Author

vicuna commented Feb 20, 2001

Comment author: administrator

there seems to be a problem with the order in which C-flags are passed
when linking against libraries that store them implicitly. E.g.:

Maybe I don't really understand the way in which things work, but I think
that "ocamlc" should pass C-options implicitly stored in libraries in a
different order (respecting the order of command line flags) to prevent
the problem above.

I agree with that. This is fixed in the working sources. Thanks for
the bug report.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Feb 20, 2001

Comment author: administrator

Fixed 2001-02-20 by XL.

@vicuna vicuna closed this as completed Feb 20, 2001
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant