openhacker / xar

Automatically exported from code.google.com/p/xar
0 stars 0 forks source link

xar is linking to libxar.so.1 in the current directory (Cygwin/Windows 7) #88

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was building xar 1.5.2 on Cygwin/Windows 7, but when I run it I normally get 
this output:

> Sophie@Sophie-Laptop:~/xar/xar-1.5.2$ xar
> /usr/local/bin/xar.exe: error while loading shared libraries: libxar.so.1: 
cannot open shared object file: No such file or directory

It seems that it's looking for the file in the current directory, because if I 
cd to the lib/ folder (or /usr/local/lib), it works fine:

> Sophie@Sophie-Laptop:~/xar/xar-1.5.2/lib$ xar
> Usage: xar -[ctx][v] -f <archive> ...
[snipped large argument list]

Using ldd on the compiled executable when in lib/ shows that this is the case:

Sophie@Sophie-Laptop:~/xar/xar-1.5.2/lib$ ldd /usr/local/bin/xar
>         ntdll.dll => /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x774e0000)
>         snxhk.dll => /cygdrive/c/Program Files/AVAST Software/Avast/snxhk.dll 
(0x72310000)
>         KERNEL32.dll => /cygdrive/c/Windows/syswow64/KERNEL32.dll (0x750a0000)
>         KERNELBASE.dll => /cygdrive/c/Windows/syswow64/KERNELBASE.dll 
(0x75420000)
>         cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000)
>         libxar.so.1 => /home/Sophie/xar/xar-1.5.2/lib/libxar.so.1 (0x702c0000)
>         cygbz2-1.dll => /usr/bin/cygbz2-1.dll (0x6a2e0000)
>         cyggcc_s-1.dll => /usr/bin/cyggcc_s-1.dll (0x6c140000)
>         cygcrypto-1.0.0.dll => /usr/bin/cygcrypto-1.0.0.dll (0x69c40000)
>         cygz.dll => /usr/bin/cygz.dll (0x694c0000)
>         cygxml2-2.dll => /usr/bin/cygxml2-2.dll (0x63420000)
>         cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x66fd0000)

The program itself seems to work fine if used within lib/ or in another 
directory where libxar.so.1 is available:

> Sophie@Sophie-Laptop:~/xar/xar-1.5.2/lib$ xar -c -f xarlib.xar *
> Sophie@Sophie-Laptop:~/xar/xar-1.5.2/lib$ ls -l xarlib.xar
> -rw-r--r-- 1 Sophie None 600335 Dec  6 16:37 xarlib.xar
> Sophie@Sophie-Laptop:~/xar/xar-1.5.2/lib$ xar -t -f xarlib.xar
> appledouble.h
> archive.c
> archive.d
> archive.h
> archive.o
[snipped rest of output]

I have confirmed that it correctly extracts existing .xar files, too.

It seems that the only issue is that it incorrectly links to libxar.so.1 in the 
current directory rather than the one it installed in /usr/local/lib/ . Since I 
don't see any other issues about this problem, I assume it's a Cygwin-specific 
issue, though I haven't had the problem with any other compiled programs. If 
there's anything I can do to help debug, let me know!

Original issue reported on code.google.com by sophie-g...@theblob.org on 6 Dec 2014 at 4:47