Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000282OCamlOCaml generalpublic2001-02-09 14:282001-02-20 10:42
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000282: linking problems with implicit C-options
DescriptionHello,

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 [^]

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000495)
administrator (administrator)
2001-02-20 10:42

> 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

(0000496)
administrator (administrator)
2001-02-20 10:42

Fixed 2001-02-20 by XL.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker