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

Linking a library

Expand Messages
  • gilles_dubochet
    Hello everyone: I have a (beginner, I suppose) problem with using the postgresql-ocaml-1.4.1 library. I compiled and installed it (as well as PostgreSQL
    Message 1 of 2 , Nov 9, 2004
    • 0 Attachment
      Hello everyone:

      I have a (beginner, I suppose) problem with using the postgresql-ocaml-1.4.1 library. I
      compiled and installed it (as well as PostgreSQL obviously), and it didn't report any error.
      However, now, when I try to compile the examples provided with the library, it fails: Here
      is what happens for the 'prompt' example:

      $ ocamlc -c -thread -I ../../lib prompt.ml
      $ ocamlc unix.cma threads.cma -thread -custom -I ../../lib -ccopt -L../../lib
      postgresql.cma -o prompt prompt.cmo
      ld: Undefined symbols:
      _SSL_pending
      [...]
      _X509_get_subject_name
      Error while building custom runtime system

      I suspect it might be a problem with linking the C part of the library, but I have no idea
      what is exactly going on. As far as I can tell, all files of the postgresql-ocaml library are
      defined in '../../lib'. If I replace this by the install path of the library '/usr/local/lib/ocaml/
      site-lib/postgresql', exactly the same happens.

      If anyone has an idea about where to look.

      And by the way, a second question: Can I use this kind of libraries (with C linking) in the
      O'Caml interpreter. I tried 'ocaml -I $PATH_TO_POSTGRES_OCAML_LIB' but without
      success?

      Sincerely,
      Gilles Dubochet.
    • Richard Jones
      ... There certainly seems to have been a problem when building the postgresql.cma file. It doesn t define all the C libraries that it actually needs. The
      Message 2 of 2 , Nov 9, 2004
      • 0 Attachment
        On Tue, Nov 09, 2004 at 12:42:49PM -0000, gilles_dubochet wrote:
        > Hello everyone:
        >
        > I have a (beginner, I suppose) problem with using the postgresql-ocaml-1.4.1 library. I
        > compiled and installed it (as well as PostgreSQL obviously), and it didn't report any error.
        > However, now, when I try to compile the examples provided with the library, it fails: Here
        > is what happens for the 'prompt' example:
        >
        > $ ocamlc -c -thread -I ../../lib prompt.ml
        > $ ocamlc unix.cma threads.cma -thread -custom -I ../../lib -ccopt -L../../lib
        > postgresql.cma -o prompt prompt.cmo
        > ld: Undefined symbols:
        > _SSL_pending
        > [...]
        > _X509_get_subject_name
        > Error while building custom runtime system

        There certainly seems to have been a problem when building the
        postgresql.cma file. It doesn't define all the C libraries that it
        actually needs. The missing symbols are defined in /usr/lib/libssl.so
        and /usr/lib/libcrypto.so respectively, so it ought to be possible to
        get around this by linking to those libraries explicitly. Something
        like:

        ocamlc [...] -o prompt -cclib -lssl -cclib -lcrypto

        should do the trick.

        Rich.

        --
        Richard Jones. http://www.annexia.org/ http://www.j-london.com/
        >>> http://www.team-notepad.com/ - collaboration tools for teams <<<
        Merjis Ltd. http://www.merjis.com/ - improving website return on investment
        Use Perl libs in OCaml - http://www.merjis.com/developers/perl4caml


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.