[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [covid-19] Help for ocaml package needed



Hello Ralf et al.,

Apologies for the consecutive email. Kindly CC'ing to the mailing lists
just in case someone has an idea as there are no sensitive info within
the emails.

I was just experimenting with this tutorial[1] on pplacer[2] and I've
still hit no luck. The errors remain persistent as denoted below.

I am sure the mcl library is compiled properly.

$ocamlobjinfo /usr/lib/ocaml/mcl.cma
File /usr/lib/ocaml/mcl.cma
Force custom: no
Extra C object files: -lmcl_stubs
Extra C options:
Extra dynamically-loaded libraries: -lmcl_stubs
Unit name: Mcl
Interfaces imported:
        ad45f251bbf98d3a0bf3b883546ecfc8        Stdlib
        7fab99051af85dcaec18ca28f9f431c7        Mcl
        a2b1a9d869fd05813beb35645bd9cd94        CamlinternalFormatBasics
Required globals:
Uses unsafe features: YES
Primitives declared in this module:
        caml_mcl
Force link: no


If anyone has got an idea with a possible solution, feel free to contribute.

Kind regards,
Shayan Doust

[1]:
https://www.mancoosi.org/~abate/ocamlbuild-stubs-and-dynamic-libraries.html
[2]: https://salsa.debian.org/med-team/pplacer

On 13/06/2020 20:54, Shayan Doust wrote:
> Hello Ralf,
> 
> Thanks for the patch, I've merged it.
> 
> Running make after the usual build package procedures, we now see actual
> ld errors (undefined reference) with regards to the mcl stubs:
> 
> ```
> ...
> /usr/bin/ld: /usr/lib/ocaml/libunix.a(getproto.o): in function
> `unix_getprotobynumber':
> (.text+0xe8): warning: Using 'getprotobynumber' in statically linked
> applications requires at runtime the shared libraries from the glibc
> version used for linking
> /usr/bin/ld: /usr/lib/ocaml/libunix.a(getproto.o): in function
> `unix_getprotobyname':
> (.text+0xc1): warning: Using 'getprotobyname' in statically linked
> applications requires at runtime the shared libraries from the glibc
> version used for linking
> /usr/bin/ld: /usr/lib/ocaml/libunix.a(getserv.o): in function
> `unix_getservbyname':
> (.text+0x109): warning: Using 'getservbyname' in statically linked
> applications requires at runtime the shared libraries from the glibc
> version used for linking
> /usr/bin/ld: /usr/lib/ocaml/libunix.a(getserv.o): in function
> `unix_getservbyport':
> (.text+0x159): warning: Using 'getservbyport' in statically linked
> applications requires at runtime the shared libraries from the glibc
> version used for linking
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(matrix.o): in function
> `mclxMapTest':
> (.text+0x71c): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(matrix.o): in function
> `mclxScrub':
> (.text+0x43d6): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(matrix.o): in function
> `mclxFold':
> (.text+0x5209): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(shadow.o): in function
> `mcl_density_adjust':
> (.text+0xce4): undefined reference to `mclgEdgeIterInit'
> /usr/bin/ld: (.text+0xeca): undefined reference to `mclgEdgeInc'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(transform.o): in function
> `mclgTFgraph':
> (.text+0x13c6): undefined reference to `mclgKNNdispatch'
> /usr/bin/ld: (.text+0x143f): undefined reference to `mclgKNNdispatch'
> /usr/bin/ld: (.text+0x14b8): undefined reference to `mclgKNNdispatch'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(cat.o): in function
> `clm_split_overlap':
> (.text+0x233d): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(cat.o): in function
> `clmEnstrict':
> (.text+0x2669): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(clm.o): in function
> `clmUGraphComponents':
> (.text+0x1ecd): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(tab.o): in function `mclTabMap':
> (.text+0x123d): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(interpret.o): in function
> `calc_depth':
> (.text+0x2b9): undefined reference to `mclgUnionv'
> /usr/bin/ld: /usr/lib/ocaml/libmcl_stubs.a(interpret.o):(.text+0x4e1):
> more undefined references to `mclgUnionv' follow
> collect2: error: ld returned 1 exit status
> File "caml_startup", line 1:
> Error: Error during linking
> Command exited with code 2.
> Compilation unsuccessful after building 489 targets (273 cached) in
> 00:00:22.
> make[1]: *** [Makefile:21: guppy.native] Error 10
> make[1]: Leaving directory '/pplacer'
> make: *** [Makefile:16: guppy] Error 2
> 
> ```
> 
> I did more investigation and it seems like -ccopt -static flags are
> actually executed. The following is executed before the linking warnings
> and errors occur (I've truncated it as it is long):
> 
> ocamlfind ocamlopt -ccopt -static -linkpkg -package batteries -package
> csv -package xmlm -package gsl -package sqlite3 -package zip -package
> mcl -thread -cclib -lpthread -cclib -lpplacercside -cclib -Lpplacer_src
> -cclib -lcdd -cclib -Lcdd_src -cclib -lpplacer_pam -cclib -Lpam_src
> -cclib -lgsl -I cdd_src -I common_src -I json_src -I pplacer_src -I
> pam_src cdd_src/cdd.cmx common_src/ppr.cmx common_src/mapsSets.cmx ...
> 
> It doesn't seem like we have the -lmcl flag (which could explain the
> undefined reference issues at linking) but with my complete lack of
> OCaml knowledge, I am not sure how -lmcl can be injected into this
> command (although I am not sure if this is needed at all or not because
> I would have thought ocamlfind would handle all of this seeing how we do
> not have -lbatteries and -lsqlite3 and whatnot).
> 
> Kind regards,
> Shayan Doust
> 
> On 13/06/2020 20:31, Ralf Treinen wrote:
>> I updated my patch (pushed to the branch "ralf") so that compilation
>> continues when typing "make" as you describe it, until it hits the
>> next linking error.
>>
>> About the linking error, I guess one should try to engineer the
>> "-ccopt -static" option into myocamlbuild.ml as described on the web
>> page you found, but I didn't find yet how to do that.
>>
>> -Ralf.
>>
>> On Sat, Jun 13, 2020 at 07:10:03PM +0100, Shayan Doust wrote:
>>> Hello Ralf,
>>>
>>> I merged the your branch into master and I can confirm I get these
>>> warnings too. The odd thing is that these warnings shouldn't be
>>> problematic (they're not errors) and I assume suppression is done using
>>> musl as opposed to glib.
>>>
>>> Having looked online it seems like the ld complaints are related to
>>> this: https://github.com/mmottl/sqlite3-ocaml/issues/31
>>>
>>> Other than that, I'm quite stuck myself as to how to solve this. What's
>>> very strange is that (using pbuilder login to be more experimentative
>>> and more hands on) dpkg-buildpackage generates these warnings and then
>>> terminates as you've said, however running "make" afterwards does not
>>> display these warnings, and instead now hits another error message:
>>>
>>> ```
>>> ...
>>> cp `readlink pplacer.native` bin/pplacer
>>> rm pplacer.native
>>> if [ ! -e bin ]; then mkdir bin; fi
>>> make guppy.native
>>> make[1]: Entering directory '/pplacer'
>>> ocamlbuild guppy.native
>>> Finished, 0 targets (0 cached) in 00:00:00.
>>> File "_tags", line 4, characters 44-53:
>>> Warning: the tag "pkg_oUnit" is not used in any flag or dependency
>>> declaration, so it will have no effect; it may be a typo. Otherwise you
>>> can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
>>> File "_tags", line 5, characters 22-31:
>>> Warning: the tag "pkg_oUnit" is not used in any flag or dependency
>>> declaration, so it will have no effect; it may be a typo. Otherwise you
>>> can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
>>> File "_tags", line 8, characters 154-161:
>>> Warning: the tag "pkg_str" is not used in any flag or dependency
>>> declaration, so it will have no effect; it may be a typo. Otherwise you
>>> can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
>>> File "_tags", line 8, characters 112-124:
>>> Warning: the tag "pkg_bigarray" is not used in any flag or dependency
>>> declaration, so it will have no effect; it may be a typo. Otherwise you
>>> can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
>>> File "_tags", line 8, characters 102-110:
>>> Warning: the tag "pkg_unix" is not used in any flag or dependency
>>> declaration, so it will have no effect; it may be a typo. Otherwise you
>>> can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
>>> + ocamlfind ocamlc -c -annot -w Z -package batteries -package csv
>>> -package xmlm -package gsl -package sqlite3 -package zip -package mcl
>>> -thread -I pplacer_src -I json_src -I pdprune_src -I pam_src -I
>>> common_src -I tests -I cdd_src -I tests/pplacer -I tests/json -I
>>> tests/rppr -I tests/guppy -o pplacer_src/guppy_squash.cmo
>>> pplacer_src/guppy_squash.ml
>>> File "pplacer_src/guppy_squash.ml", line 177, characters 51-77:
>>> 177 |       let prefix_of_int i = Filename.concat outdir (zero_pad_int
>>> pad_width i) in
>>>
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Error: This expression has type Ppatteries.Bytes.t = bytes
>>>        but an expression was expected of type string
>>> Command exited with code 2.
>>> Compilation unsuccessful after building 320 targets (319 cached) in
>>> 00:00:00.
>>> make[1]: *** [Makefile:21: guppy.native] Error 10
>>> make[1]: Leaving directory '/pplacer'
>>> make: *** [Makefile:16: guppy] Error 2
>>>

Attachment: 0x6D7D441919D02395.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: