You are not logged in.

#1 2014-11-20 21:59:35

ifelseforeach
Member
Registered: 2014-03-12
Posts: 22

AUR package - linker error - zarith

Hi, I want to install the package frama-c from AUR.
One of the dependencies is the package zarith.
zarith is properly installed on my system:

pacman -Ql zarith
zarith /usr/
zarith /usr/lib/
zarith /usr/lib/ocaml/
zarith /usr/lib/ocaml/zarith/
zarith /usr/lib/ocaml/zarith/META
zarith /usr/lib/ocaml/zarith/big_int_Z.cmi
zarith /usr/lib/ocaml/zarith/big_int_Z.mli
zarith /usr/lib/ocaml/zarith/dllzarith.so
zarith /usr/lib/ocaml/zarith/q.cmi
zarith /usr/lib/ocaml/zarith/q.mli
zarith /usr/lib/ocaml/zarith/z.cmi
zarith /usr/lib/ocaml/zarith/z.mli
zarith /usr/lib/ocaml/zarith/zarith.cma
zarith /usr/lib/ocaml/zarith/zarith.cmxa
zarith /usr/lib/ocaml/zarith/zarith.cmxs
zarith /usr/lib/ocaml/zarith/zarith.h

...should there maybe also be a .pc file in the above list?
...is the problem maybe that the .so file is not called 'zarith.so'?

But when installing frama-c, i m getting this linker error:

/usr/bin/ld: cannot find -lzarith

I hope someone can give me a little hint.

regards

Offline

#2 2014-11-21 13:33:14

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: AUR package - linker error - zarith

What does ''readelf- d /usr/lib/ocaml/zarith/dllzarith.so'' show?

pkg-config is irrelevant to your problem.

Offline

#3 2014-11-21 13:40:10

ifelseforeach
Member
Registered: 2014-03-12
Posts: 22

Re: AUR package - linker error - zarith

falconindy wrote:

What does ''readelf- d /usr/lib/ocaml/zarith/dllzarith.so'' show?

pkg-config is irrelevant to your problem.


the output of readelf is:

$ readelf -d /usr/lib/ocaml/zarith/dllzarith.so 

Dynamic section at offset 0xc2e0 contains 25 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libgmp.so.10]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x2778
 0x000000000000000d (FINI)               0xab2c
 0x0000000000000019 (INIT_ARRAY)         0x20c2c8
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x20c2d0
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x1b8
 0x0000000000000005 (STRTAB)             0x13a0
 0x0000000000000006 (SYMTAB)             0x488
 0x000000000000000a (STRSZ)              2325 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x20c4f0
 0x0000000000000002 (PLTRELSZ)           1944 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x1fe0
 0x0000000000000007 (RELA)               0x1e48
 0x0000000000000008 (RELASZ)             408 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x1df8
 0x000000006fffffff (VERNEEDNUM)         1
 0x000000006ffffff0 (VERSYM)             0x1cb6
 0x000000006ffffff9 (RELACOUNT)          7
 0x0000000000000000 (NULL)               0x0

Offline

#4 2014-11-23 17:43:44

TE
Member
Registered: 2014-06-21
Posts: 85

Re: AUR package - linker error - zarith

The "-l" flag to ld will - by default - look for libzarith.so; from the man page:

-l namespec
       --library=namespec
           Add the archive or object file specified by namespec to the list of
           files to link.  This option may be used any number of times.  If
           namespec is of the form :filename, ld will search the library path
           for a file called filename, otherwise it will search the library
           path for a file called libnamespec.a.

So you can either fix the zarith install (I'd try a symlink "libzarith.so -> dllzarith.so") or change the -l flag to use -l:dllzarith.so, etc. You may also need to mess with -L /usr/lib/ocaml/zarith/ to include that dir, depending on your ld.so.conf setup. YMMV.

Offline

#5 2014-11-23 20:03:56

ifelseforeach
Member
Registered: 2014-03-12
Posts: 22

Re: AUR package - linker error - zarith

TE wrote:

The "-l" flag to ld will - by default - look for libzarith.so; from the man page:

-l namespec
       --library=namespec
           Add the archive or object file specified by namespec to the list of
           files to link.  This option may be used any number of times.  If
           namespec is of the form :filename, ld will search the library path
           for a file called filename, otherwise it will search the library
           path for a file called libnamespec.a.

So you can either fix the zarith install (I'd try a symlink "libzarith.so -> dllzarith.so") or change the -l flag to use -l:dllzarith.so, etc. You may also need to mess with -L /usr/lib/ocaml/zarith/ to include that dir, depending on your ld.so.conf setup. YMMV.

Thank you, that makes sense.
I ve created a softlink called 'libzarith.so' but now the compiler returns the following:

gcc: Error: /usr/lib/ocaml/zarith/zarith.a: File or Directory not found

Do you know, why gcc now tries to search for a static lib instead of the .so?

Last edited by ifelseforeach (2014-11-23 20:12:59)

Offline

#6 2014-11-23 20:40:57

TE
Member
Registered: 2014-06-21
Posts: 85

Re: AUR package - linker error - zarith

I downloaded the packages and looked -- these are some strange pieces of software, I guess it's an ocaml thing (which I know little about). You need to rebuild your zarith package and add to the zarith PKGBUILD:

options=('staticlibs')

That will leave libzarith.a to get packaged, so that the frama-c will compile. (well, it should) -- the frama-c ./configure has this in it:

if test "$OCAMLBEST" = "opt"; then
   LIB_SUFFIX=cmxa
   OBJ_SUFFIX=cmx;
else
   LIB_SUFFIX=cma
   OBJ_SUFFIX=cmo;
fi

...so it's actually looking for those files, and doing it using the "--enable-zarith=<foo>"; you might try adding to the frama-c PKGBUILD a "--enable-zarith=/usr/lib/ocaml/zarith", as it's looking for these *.cm?? files in ./configure (there's even a comment about it zarith being possible to install different ways). "messy" is the word I'll use here...

Offline

#7 2014-11-23 20:42:06

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: AUR package - linker error - zarith

TE wrote:

The "-l" flag to ld will - by default - look for libzarith.so; from the man page:

-l namespec
       --library=namespec
           Add the archive or object file specified by namespec to the list of
           files to link.  This option may be used any number of times.  If
           namespec is of the form :filename, ld will search the library path
           for a file called filename, otherwise it will search the library
           path for a file called libnamespec.a.

So you can either fix the zarith install (I'd try a symlink "libzarith.so -> dllzarith.so") or change the -l flag to use -l:dllzarith.so, etc. You may also need to mess with -L /usr/lib/ocaml/zarith/ to include that dir, depending on your ld.so.conf setup. YMMV.

Strange advice. It's going way outside the bounds of what it normally takes to link to a library. Sure enough, if you look at the readelf output that I asked for, you'll see that the .so was compiled without any soname. This makes it impossible to dynamically link against. So, it seems to me that zarith's build system is wrong, or you aren't meant to link to zarith like this. Not being familiar with ocaml libraries, I've no idea which case it is.

Offline

#8 2014-11-23 20:44:39

TE
Member
Registered: 2014-06-21
Posts: 85

Re: AUR package - linker error - zarith

falconindy wrote:

Strange advice. It's going way outside the bounds of what it normally takes to link to a library. Sure enough, if you look at the readelf output that I asked for, you'll see that the .so was compiled without any soname. This makes it impossible to dynamically link against. So, it seems to me that zarith's build system is wrong, or you aren't meant to link to zarith like this. Not being familiar with ocaml libraries, I've no idea which case it is.

Agreed - after looking at the ./configure for those packages they're... strange to me, a divergence from typical software. I'll chalk it up to me not knowing much at all about ocaml based things.

Offline

Board footer

Powered by FluxBB