Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opam binary wont execute on my debian machine #2503

Closed
hgouraud opened this issue Apr 5, 2016 · 28 comments
Closed

opam binary wont execute on my debian machine #2503

hgouraud opened this issue Apr 5, 2016 · 28 comments

Comments

@hgouraud
Copy link

hgouraud commented Apr 5, 2016

No such file or directory when trying to execute the opam binary!
I have added a few echo lines to opam_installer.sh to show explicitly what and where !!!

Thanks for any help

Henri

(uiserver):u72332:~/packages > sh ./opam_installer.sh ~/bin 4.02.3
Downloading OPAM...
From https://github.com/ocaml/opam/releases/download/1.2.2 opam-1.2.2-x86_64-Linux
Initializing with compiler 4.02.3
with binary /kunden/homepages/30/d456759/htdocs/bin/opam
-rwxr-xr-x 1 u72332 ftpusers 6265225 Apr  5 11:06 /kunden/homepages/30/d456759/htdocs/bin/opam

./opam_installer.sh: line 100: /kunden/homepages/30/d456759/htdocs/bin/opam: No such file or directory

(uiserver):u72332:~/packages > ls -al /kunden/homepages/30/d456759/htdocs/bin/opam
-rwxr-xr-x 1 u72332 ftpusers 6265225 Apr  5 11:06 /kunden/homepages/30/d456759/htdocs/bin/opam
(uiserver):u72332:~/packages > stat /kunden/homepages/30/d456759/htdocs/bin/opam
  File: `/kunden/homepages/30/d456759/htdocs/bin/opam'
  Size: 6265225     Blocks: 12240      IO Block: 4096   regular file
Device: 830h/2096d  Inode: 1744842375  Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (7541637/u72332)   Gid: (  600/ftpusers)
Access: 2016-04-05 11:06:53.390717717 +0200
Modify: 2016-04-05 11:06:53.398717953 +0200
Change: 2016-04-05 11:06:53.398717953 +0200
(uiserver):u72332:~/packages > 
@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

uname -a
Linux icpu3029 3.2.72-grsec-infong-15294 #1 SMP Wed Oct 21 14:57:23 CEST 2015 x86_64 GNU/Linux

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

Just guessing try something like:

PATH=$PATH:/kunden/homepages/30/d456759/htdocs/bin sh ./opam_installer.sh ~/bin 4.02.3

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

I suspect a binary compatibility issue :

(uiserver):u72332:~/bin > cd
(uiserver):u72332:~ > cd bin
(uiserver):u72332:~/bin > ls -al
total 6124
drwx---r-x  2 u72332 ftpusers      17 Apr  5 11:06 .
drwx---r-t 27 u72332 ftpusers    4096 Apr  5 11:20 ..
-rwxr-xr-x  1 u72332 ftpusers 6265225 Apr  5 11:06 opam
(uiserver):u72332:~/bin > 
(uiserver):u72332:~/bin > ./opam -help
-bash: ./opam: No such file or directory
(uiserver):u72332:~/bin > 

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

Did you try to less, file or ldd the binary ? Can you try to make a short hello-world script or program and actually excute it from that directory ?

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

-rwxr-xr-x  1 u72332903 ftpusers 6265225 Apr  5 11:06 opam
(uiserver):u72332903:~/bin > ldd opam
    not a dynamic executable
(uiserver):u72332:~/bin > less opam
"opam" may be a binary file.  See it anyway? 
(uiserver):u72332:~/bin > 
(uiserver):u72332:~/bin > 
(uiserver):u72332:~/bin > file opam
opam: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, not stripped
(uiserver):u72332:~/bin > 

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

No idea. What about my last suggestion ? Are you sure the system allows you to execute binaries at that place ?

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

(uiserver):u72332:~/bin > 
(uiserver):u72332:~/bin > chmod +x hello
(uiserver):u72332:~/bin > ./hello 
hello world
(uiserver):u72332:~/bin > cat ./hello 
#!/bin/sh
echo "hello world"
(uiserver):u72332:~/bin > 

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

The interwebs says maybe inspect the output of readelf -d opam. See http://superuser.com/a/466837

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

file opam
opam: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, not stripped

Je soupconne l'aspect "shared library" d'être la cause du problème!
Quelqu'un peut il confirmer?
Où trouver une version de opam qui n'ait pas cette caractéristique?

Merci
Henri

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

Well there's nothing to confirm here, on most linux libc will be dynamically linked anways. You should try to figure out the problems by following the steps in the link I gave you above.

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

readelf indicated that 3 libraries are NEEDED! (Shared library: [libm.so.6], [libdl.so.2] and [libc.so.6])
how and where do I verify that they are available and compatible.

Thanks

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

First you should follow steps 2-3 of the link I mentionned since it precisely describes your problem. Once you have figured that out I would suggest you get in touch with the support of your provider to resolve any missing installation bit.

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

Ok,
so /lib64/ld-linux-x86-64.so.2 is not available on my machine (/lib64 does not exist)
Does that mean that I must find a binary compatible with my machine, or that I must have /lib64 installed on it?

uname -a
Linux icpu3029 3.2.72-grsec-infong-15294 #1 SMP Wed Oct 21 14:57:23 CEST 2015 x86_64 GNU/Linux
file opam
opam: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, not stripped

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

Btw, I have contacted support. Waiting for their answer.

Thanks

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

Well it seems that they allow you to compile binaries but they don't provide support to run them. So I'd rather say that it's an install problem with our provider. You could maybe try reproduce and show them on a minimal C hello world example that links against libc.

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

Is /lib64/ld-linux-x86-64.so.2 really expected to be present on Linux x86_64 machines (as reported by uname -s -m?
I need agruments to address to my hosting service, but this being a shared server, I fear I am not in a strong position!!
Thanks

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

Here's what I have one of my shared hosting service:

> uname -a
Linux XXXXXX 2.6.32-531.17.1.lve1.2.60.el6.x86_64 #1 SMP Tue Jul 8 11:25:32 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
> ldd ./opam
    linux-vdso.so.1 =>  (0x00007fffff9fe000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fd0e70d5000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fd0e6ed0000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fd0e6b3c000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fd0e736b000)

and all files are present at the reported location.

To get out of the opam/ocaml whatever argument you should show them that you are not able to compile a simple C program. I suspect this should also fail on your side (try it):

> cat hello.c 
#include <stdio.h>

int main (int argc, char *argv[])
{
  puts ("Hello, world!");
  return 0;
}
> gcc hello.c
> ./a.out

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

Huuummm!!!
It compiles and executes correctly!!

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

So what does ldd a.out give you ?

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

ldd a.out
linux-gate.so.1 => (0x55572000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0x5557d000)
/lib/ld-linux.so.2 (0x55555000)

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

I guess I need to get an opam version compatible with this environment, but this worries me for compatibility with other tools such as ocaml (which is my goal) which micght also fail at this uname -s -m test!!

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

So apparently it gets compiled in 32-bit mode. I don't remember exactly how these things work but
maybe if you try to compile it in 64-bit mode it will fail, try something like:

gcc -m64 -o a.out hello.c

OCaml's configure is certainly detecting that you are on a 64-bit platform so it's trying to compile in 64-bit but apparently the support libraries are not installed on your host.

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

Yes, it fails :

gcc -m64 -o a.out hello.c
In file included from /usr/include/features.h:378,
from /usr/include/stdio.h:28,
from hello.c:1:
/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: No such file or directory

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

Ah but in fact opam_installer downloads binaries, I didn't get that (I thought it bootstrapped an opam by compiling ocaml and then compiling opam). You could then simply try to install manually as opam the binary from https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-i686-Linux

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

(Note however that you may often get into trouble with configure bits, since apparently your host pretends to be a 64-bit machine while it doesn't seem to be).

@hgouraud
Copy link
Author

hgouraud commented Apr 5, 2016

Just did that, and it cracked the lid open!! opam is running and trying to compile ocaml-4.02.3
But this fails (in the same way a direct make with ocaml had in previous tests!!).
I guess I lost this battle!! (unless the hosting service gives in)

Thanks for your help

Henri

=-=- Installing compiler 4.02.3 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[compiler.get] http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02.3.tar.gz downloaded
Now compiling OCaml. This may take a while, please bear with us...
[ERROR] Compiler build failed at "make world.opt":
        # opam-version 1.2.2
        # os           linux
        # command      make world.opt
        # path         /kunden/homepages/30/d456759237/htdocs/.opam/4.02.3/build/ocaml
        # exit-code    2
        # env-file     /kunden/homepages/30/d456759237/htdocs/.opam/log/log-12029-12ca7e.env
        # stdout-file  /kunden/homepages/30/d456759237/htdocs/.opam/log/log-12029-12ca7e.out
        # stderr-file  /kunden/homepages/30/d456759237/htdocs/.opam/log/log-12029-12ca7e.err
        ### stdout ###
        # [...]
        # gcc -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_amd64 -DSYS_linux  -O -Wall
        -D_FILE_OFFSET_BITS=64 -D_REENTRANT   -c -o roots.o roots.c
        # ln -s ../byterun/globroots.c globroots.c
        # gcc -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_amd64 -DSYS_linux  -O -Wall
        -D_FILE_OFFSET_BITS=64 -D_REENTRANT   -c -o globroots.o globroots.c
        # ln -s ../byterun/signals.c signals.c
        # gcc -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_amd64 -DSYS_linux  -O -Wall
        -D_FILE_OFFSET_BITS=64 -D_REENTRANT   -c -o signals.o signals.c
        # gcc -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_amd64 -DSYS_linux  -O -Wall
        -D_FILE_OFFSET_BITS=64 -D_REENTRANT   -c -o signals_asm.o signals_asm.c
        # make[4]: Leaving directory `/homepages/30/d456759237/htdocs/.opam/4.02.3/build/ocaml/asmrun'
        # make[3]: Leaving directory `/homepages/30/d456759237/htdocs/.opam/4.02.3/build/ocaml'
        # make[2]: Leaving directory `/homepages/30/d456759237/htdocs/.opam/4.02.3/build/ocaml'
        # make[1]: Leaving directory `/homepages/30/d456759237/htdocs/.opam/4.02.3/build/ocaml'
        ### stderr ###
        # [...]
        # signals_asm.c:207: error: (Each undeclared identifier is reported only once
        # signals_asm.c:207: error: for each function it appears in.)
        # signals_asm.c:213: error: 'REG_RIP' undeclared (first use in this function)
        # signals_asm.c:228: error: 'REG_R14' undeclared (first use in this function)
        # signals_asm.c:229: error: 'REG_R15' undeclared (first use in this function)
        # make[4]: *** [signals_asm.o] Error 1
        # make[3]: *** [makeruntimeopt] Error 2
        # make[2]: *** [opt-core] Error 2
        # make[1]: *** [opt.opt] Error 2
        # make: *** [world.opt] Error 2
[ERROR] Initialisation failed

@dbuenzli
Copy link
Contributor

dbuenzli commented Apr 5, 2016

Clearly there's a problem with your host machine. Here OCaml tries to compile in 64 bit mode since that's what it detects but fails to compile since the support libraries for 64-bit are absent, exactly like the simple C program above does. You can try to opam init with the switch 4.02.3+32bit, it may work but then you will still constantly run in problems with packages getting misconfigured because your machine lies.

@hgouraud
Copy link
Author

hgouraud commented Apr 6, 2016

The machine is indeed 64 bits, as reported by uname, but the user environment is 32 bits (as reported by the hosting service!!). I will switch hosting service!
I guess this is the end.

Thanks for the help
Henri

@hgouraud hgouraud closed this as completed Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants