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

SMLNJ crashes #228

Closed
xuanruiqi opened this issue Apr 19, 2016 · 7 comments
Closed

SMLNJ crashes #228

xuanruiqi opened this issue Apr 19, 2016 · 7 comments

Comments

@xuanruiqi
Copy link

xuanruiqi commented Apr 19, 2016

I installed smlnj with apt-get and the executable sml is crashing:
# sml
/usr/lib/smlnj/bin/.run/run.x86-linux: 1: /usr/lib/smlnj/bin/.run/run.x86-linux: Syntax error: word unexpected (expecting ")")
I collected a strace:
# strace sml strace: Test for PTRACE_O_TRACESYSGOOD failed, giving up using this feature. execve("/usr/bin/sml", ["sml"], [/* 12 vars */]) = 0 brk(0) = 0x8220000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffee0000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=37590, ...}) = 0 mmap(NULL, 37590, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff5ffff5000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0 mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff5ff830000 mprotect(0x7ff5ff9eb000, 2093056, PROT_NONE) = 0 mmap(0x7ff5ffbea000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7ff5ffbea000 mmap(0x7ff5ffbf0000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffbf0000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffed0000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffec0000 arch_prctl(ARCH_SET_FS, 0x7ff5ffec0740) = 0 mprotect(0x7ff5ffbea000, 16384, PROT_READ) = 0 mprotect(0x821b000, 8192, PROT_READ) = 0 mprotect(0x7ff5ffe22000, 4096, PROT_READ) = 0 munmap(0x7ff5ffff5000, 37590) = 0 getpid() = 6697 rt_sigaction(SIGCHLD, {0x8012460, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 geteuid() = 0 brk(0) = 0x8220000 brk(0x8241000) = 0x8241000 getppid() = 6694 stat("/mnt/c/Users/Ray", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0 stat(".", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0 open("/usr/bin/sml", O_RDONLY) = 3 fcntl(3, F_DUPFD, 10) = 10 close(3) = 0 fcntl(10, F_SETFD, FD_CLOEXEC) = 0 rt_sigaction(SIGINT, NULL, {SIG_DFL, [], SA_RESTORER, 0x7ff5ff426d40}, 8) = 0 rt_sigaction(SIGINT, {0x8012460, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], SA_RESTORER, 0x7ff5ff426d40}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], SA_RESTORER, 0x7ff5ff426d40}, 8) = 0 rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 read(10, "#!/bin/sh\n\nexport SMLNJ_HOME=${S"..., 8192) = 88 execve("/usr/lib/smlnj/bin/sml", ["/usr/lib/smlnj/bin/sml"], [/* 13 vars */]) = 0 brk(0) = 0x8220000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffee0000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=37590, ...}) = 0 mmap(NULL, 37590, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff5ffff5000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0 mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff5ff830000 mprotect(0x7ff5ff9eb000, 2093056, PROT_NONE) = 0 mmap(0x7ff5ffbea000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7ff5ffbea000 mmap(0x7ff5ffbf0000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffbf0000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffed0000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff5ffec0000 arch_prctl(ARCH_SET_FS, 0x7ff5ffec0740) = 0 mprotect(0x7ff5ffbea000, 16384, PROT_READ) = 0 mprotect(0x821b000, 8192, PROT_READ) = 0 mprotect(0x7ff5ffe22000, 4096, PROT_READ) = 0 munmap(0x7ff5ffff5000, 37590) = 0 getpid() = 6697 rt_sigaction(SIGCHLD, {0x8012460, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 geteuid() = 0 brk(0) = 0x8220000 brk(0x8241000) = 0x8241000 getppid() = 6694 stat("/mnt/c/Users/Ray", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0 stat(".", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0 open("/usr/lib/smlnj/bin/sml", O_RDONLY) = 3 fcntl(3, F_DUPFD, 10) = 10 close(3) = 0 fcntl(10, F_SETFD, FD_CLOEXEC) = 0 rt_sigaction(SIGINT, NULL, {SIG_DFL, ~[RTMIN], SA_RESTORER, 0x7ff5ff866d40}, 8) = 0 rt_sigaction(SIGINT, {0x8012460, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 rt_sigaction(SIGQUIT, NULL, {SIG_DFL, ~[RTMIN], SA_RESTORER, 0x7ff5ff866d40}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {SIG_DFL, ~[RTMIN], SA_RESTORER, 0x7ff5ff866d40}, 8) = 0 rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7ff5ff866d40}, NULL, 8) = 0 read(10, "#!/bin/sh\n#\n# The standard drive"..., 8192) = 5369 pipe([3, 4]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff5ffec0a10) = 6698 close(4) = 0 read(3, "sml\n", 128) = 4 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=6698, si_status=0, si_utime=0, si_stime=0} --- strace: ptrace(PTRACE_SYSCALL,pid:6697,sig:17): Invalid argument Process 6697 detached

@stehufntdev
Copy link
Collaborator

Thanks for reporting the issue. Looks like the application is trying to load a i386 binary (32bit):

root@TEST-6:/mnt/c/Users/test/AppData/Local/lxss# readelf -h /usr/lib/smlnj/bin/.run/run.x86-linux
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0x804aa76
Start of program headers: 52 (bytes into file)
Start of section headers: 126360 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 27
Section header string table index: 26

Currently WSL only supports amd64 (native 64bit).

To get this on our priority list can you add it to our [UserVoice](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/category/161892-bash page)? Thanks again for trying out WSL!

@RobRoseKnows
Copy link

Sorry for the necro and I don't want to be a bother, but is there currently a timeline as to when WSL might support 32-bit i386 binaries?

@stehufntdev
Copy link
Collaborator

No bother at all :). Right now we don't have a timeline for the change, but are tracking the work. So far we've been prioritizing work based on scenarios and user voice, so please upvote the entry for 32bit support - https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/

@therealkenc
Copy link
Collaborator

therealkenc commented Mar 24, 2018

Landing zone for i386 binaries in WSL ended up #2468 via osmosis. #2468 should have been duped down the other direction from the start but it didn't work out that way.

@twome
Copy link

twome commented Jan 26, 2021

I'm getting the error

/usr/lib/smlnj/bin/sml: 238: exec: /usr/lib/smlnj/bin/.run/run.x86-linux: Exec format error

when I try to run sml after installing with sudo apt install smlnj. Unfortunately this seems to be related to WSL: none of the particular problems I've run into are showing up in the SML/NJ installation instructions, and no solutions are showing up in web searches that include "WSL".

  • I tried to compile SML/NJ from source. I get the error config/install.sh: !!! SML/NJ requires support for 32-bit executables. On Debian Linux, you may need to apt-get install gcc-multilib g++-multilib ia32-libs. On RH Fedora, try: yum install glibc-devel.i686 libgcc.i686 - even when I'm trying to compile the 64-bit version with config/install.sh -default 64. I'd already run sudo dpkg --add-architecture i386, updated apt, and installed the packages gcc-multilib, g++-multilib, and libc6:i386 (ia32-libs as recommended by SML/NJ's install.sh isn't available on apt, apparently).
  • I tried installing smlnj through Linuxbrew (no formulae or cask found, though the macOS Homebrew has the cask and works fine),
  • and now I tried installing through apt

@JackyMYL
Copy link

JackyMYL commented Apr 6, 2021

/usr/lib/smlnj/bin/sml: 238: exec: /usr/lib/smlnj/bin/.run/run.x86-linux: Exec format error

For the above error 238, it is a problem with WSL1. The problem is that the installer is trying to run a 32-bit application, but WSL1 only supports 64-bit applications. To resolve this, you will need to install WSL2 - follow the instructions at here, it should work!

Also that SML/NJ 110.99 supports 64 bits, but the version on ubuntu using sudo apt install smlnj is still at 110.76, so I think another solution to this is goto here and download version 110.99 and then compile.

@Archenoth
Copy link

Out of curiosity, what would it take to get 32 bit binaries to play nicely with WSL1?

WSL2 isn't able to bind to host ports, so it's unfortunately kind of bad for a lot of what I do--but it'd also be neat to run 32 bit binaries without having both WSL versions running at once..!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants