Loading ...
Sorry, an error occurred while loading the content.

specifying library locations

Expand Messages
  • Ashish Agarwal
    To compile ocaml-sqlite3 via godi successfully, I had to first set these environment variables: export C_INCLUDE_PATH=/share/apps/sqlite/3.7.7/intel/include
    Message 1 of 2 , Jul 5 8:48 AM
    • 0 Attachment
      To compile ocaml-sqlite3 via godi successfully, I had to first set these
      environment variables:

      export C_INCLUDE_PATH=/share/apps/sqlite/3.7.7/intel/include
      export LIBRARY_PATH=/share/apps/sqlite/3.7.7/intel/lib

      Now when I write other code that needs to link with sqlite, I get the error:

      /usr/bin/ld: cannot find -lsqlite3

      I can manually set LIBRARY_PATH again as above to get the linker to work,
      but I'm wondering what is the best way to specify this within the ocaml
      build system. I'm not sure what my options are, but if it matters, I use
      godi and oasis.

      Thanks for any help.


      [Non-text portions of this message have been removed]
    • Gerd Stolpmann
      ... Basically, you need to pass down -Wl,-R$LIBRARY_PATH down to the linker when creating the cma or cmxa. Seems like the sqlite package doesn t do this (for
      Message 2 of 2 , Jul 16 1:33 PM
      • 0 Attachment
        Am 05.07.2012 17:48:38 schrieb(en) Ashish Agarwal:
        > To compile ocaml-sqlite3 via godi successfully, I had to first set
        > these
        > environment variables:
        >
        > export C_INCLUDE_PATH=/share/apps/sqlite/3.7.7/intel/include
        > export LIBRARY_PATH=/share/apps/sqlite/3.7.7/intel/lib
        >
        > Now when I write other code that needs to link with sqlite, I get the
        > error:
        >
        > /usr/bin/ld: cannot find -lsqlite3
        >
        > I can manually set LIBRARY_PATH again as above to get the linker to
        > work,
        > but I'm wondering what is the best way to specify this within the
        > ocaml
        > build system. I'm not sure what my options are, but if it matters, I
        > use
        > godi and oasis.

        Basically, you need to pass down -Wl,-R$LIBRARY_PATH down to the linker
        when creating the cma or cmxa. Seems like the sqlite package doesn't do
        this (for most GODI packages this is detected automatically, at least
        if there is a conf-* package, or the right settings come from
        pkg-config). You should contact the author or maintainer.

        Depending on the OS this might also work when linking the executable.
        So try

        ocamlc/opt -ccopt -Wl,-R/share/apps/sqlite/3.7.7/intel/lib ...

        Gerd

        >
        > Thanks for any help.
        >
        >
        > [Non-text portions of this message have been removed]
        >
        >



        --
        ------------------------------------------------------------
        Gerd Stolpmann, Darmstadt, Germany gerd@...
        Creator of GODI and camlcity.org.
        Contact details: http://www.camlcity.org/contact.html
        Company homepage: http://www.gerd-stolpmann.de
        ------------------------------------------------------------
      Your message has been successfully submitted and would be delivered to recipients shortly.