Southclaws / sampctl

The Swiss Army Knife of SA:MP - vital tools for any server owner or library maintainer.
GNU General Public License v3.0
242 stars 33 forks source link

Package build error: if you're on a 64 bit system, you may need to enable 32 bit binaries #359

Closed pmesq closed 4 years ago

pmesq commented 4 years ago

Hi!

I'm trying to build my package for the first time and I'm getting some errors:

$ sampctl package build
ERROR: if you're on a 64 bit system, you may need to enable 32 bit binaries
ERROR: you can do this by allowing i386 packages and installing g++-multilib
failed to compile package entry: failed to execute compiler: fork/exec /home/myuser/.samp/pawn/3.10.9/pawncc: no such file or directory

I tried to allow i386 packages and install g++-multilib with the following commands:

sudo dpkg --add-architecture i386
sudo apt-get install g++-multilib

But I got the same errors.

I also tried the solution of issue #274, but got the same errors too.

Ubuntu 18.04.4 LTS sampctl version 1.8.39

ADRFranklin commented 4 years ago

Try installing 32bit versions of these apt install libc6:i386 libstdc++6:i386. these should be enough to run the pawn compiler.

pmesq commented 4 years ago

Thanks for answering. They are already installed, got the same error.

libc6:i386 is already the newest version (2.27-3ubuntu1).
libstdc++6:i386 is already the newest version (8.4.0-1ubuntu1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
ADRFranklin commented 4 years ago

Can you check the .samp path to make sure the compiler for version 3.10.9 has actually been downloaded successfully and extracted to the correct path?

pmesq commented 4 years ago

Of course. The pawncc file is right there, but when I try to run it, it says it does not exist. Am I doing it right?

$ cd /home/myuser/.samp/pawn/3.10.9/
$ ls
libpawnc.so  pawncc
$ ./pawncc
bash: ./pawncc: no such file or directory
ADRFranklin commented 4 years ago

The reason it won't run it, is because it doesn't know how, due to missing 32 bit libraries. You seem to still be missing some crucial ones.

Try googling how to install 32 bit on ubuntu. There must be some simple instruction, you overlooked.

pmesq commented 4 years ago

I ran the following commands:

$ sudo su
# apt update
# apt install qemu-user-static
# update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'
# service binfmt-support start
# dpkg --add-architecture i386
# apt update
# apt install cpp-7:i386
# apt install cpp:i386
# apt install g++-multilib:i386

Then, I was able to run the pawncc file as root, but not as normal user. So, I tried to run sampctl package build as root, but got the same errors.

I also tried to change the pawncc permissions and run as normal user, but got this:

$ chmod 777 pawncc
$ ./pawncc
./pawncc: error while loading shared libraries: libpawnc.so: cannot open shared object file: No such file or directory

I'm not an experienced linux user, so I think the problem may be in my dependencies or something like that. I will try to reinstall sampctl, but I don't think that's the problem.

Thank's for helping!

ADRFranklin commented 4 years ago

@pcesarmf The commands you ran above, where specific to WSL, so they shouldn't be necessary for a proper install of Ubuntu (You didn't mention you used WSL, so I assumed it was a fresh Ubuntu install).

What I think has happened, is that you have added the 32 bit flag to Ubuntu after you have already installed core dependencies, and because of this a lot of the libraries/dependencies for the OS have been installed with just the 64 bit version.

So you have 2 choices at this point. Choice one, is to uninstall all the packages you previously installed and then re-install them now with the 32 bit flag enabled, it will install the correct libraries for both versions. Choice two, is to manually figure out which libraries where installed and then manually install the 32 bit version of it.

pmesq commented 4 years ago

Right, I'm using a fresh Ubuntu install.

About the first choice, do you mean all the packages I've ever installed?

About the second one, do you know how could I figure out which libraries should I install the 32 bit version of it?

I tried to install the 32 bit version of some libraries, like cpp-7. But, when I installed cpp-7:i386, the amd64 version of cpp-7 and many other cpp libraries were uninstalled. So, I had to install them again, uninstalling the cpp-7:i386 one.

ADRFranklin commented 4 years ago

If you have just installed Ubuntu fresh without installing any core libraries as of now, then you are safe to run the commands you did at the beginning (without the WSL specific ones).

sudo dpkg --add-architecture i386
sudo apt update
sudo apt-get install g++-multilib

that should be all you need to do as of now.

pmesq commented 4 years ago

Sorry, by fresh, you mean new, right?

It's not fresh, I installed it 1 or 2 years ago, I think. Maybe I installed some core libraries before, but I don't remember.

Those commands didn't work, but the errors are a bit different now:

$ sampctl package build
ERROR: if you're on a 64 bit system, you may need to enable 32 bit binaries
ERROR: you can do this by allowing i386 packages and installing g++-multilib
failed to compile package entry: failed to execute compiler: signal: segmentation fault (core dumped)

$ cd ~/.samp/pawn/3.10.9/
$ file pawncc
pawncc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=13532abc0c56d6b184c02601f3ad15bdfed0fd2a, with debug_info, not stripped
$ file libpawnc.so
libpawnc.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=5a7ff77cc849fa41f2da33f7afd81fe84bfee520, with debug_info, not stripped
$ ./pawncc
./pawncc: error while loading shared libraries: libpawnc.so: cannot open shared object file: No such file or directory
ADRFranklin commented 4 years ago

@pcesarmf don't use version 3.10.9 of the compiler, as it is known to have a few issues. Version 3.10.10 was built correctly and should work for you.

The problem is that version 3.10.9 was built with some weird behaviour especially when it comes to finding the shared library libpawnc.so which is in the same folder as the pawncc itself. You can specify the version under the build config inside pawn.json or pawn.yaml.

If what I said about does not help you and you still have the same problem, then I recommend installing https://packages.ubuntu.com/bionic/g++-multilib all the sub libs of this library with :i386 appended to the end of it for the 32 bit version.

Hope this helps.

pmesq commented 4 years ago

Same errors with 3.10.10 version.

Tried to install all of those packages with:

sudo apt install cpp:i386 g++:i386 g++-7-multilib:i386 gcc-multilib:i386 g++-multilib:i386

But it was said that all of the following packages would be removed:

binutils cpp cpp-7 g++ g++-7 g++-7-multilib g++-multilib gcc gcc-7
gcc-7-multilib gcc-multilib gdm3 lib32asan4 lib32atomic1 lib32cilkrts5
lib32gcc-7-dev lib32gcc1 lib32gomp1 lib32itm1 lib32mpx2 lib32quadmath0
lib32stdc++-7-dev lib32stdc++6 lib32ubsan0 lib32z1 libc6-dev-i386
libc6-dev-x32 libc6-i386 libc6-x32 libx32asan4 libx32atomic1 libx32cilkrts5
libx32gcc-7-dev libx32gcc1 libx32gomp1 libx32itm1 libx32quadmath0
libx32stdc++-7-dev libx32stdc++6 libx32ubsan0 ubuntu-desktop
x11-session-utils x11-xserver-utils xorg
ADRFranklin commented 4 years ago

@pcesarmf Add me on discord and we can talk about possible solutions. It's hard to know what you have already done at this point.

Discord ID: JustMichael#7884

pmesq commented 4 years ago

Ok!

pmesq commented 4 years ago

Fixed it via help through discord with @ADRFranklin . Thanks!

Allislove commented 1 year ago

Next commands work's for me-

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 libncurses6:i386 libstdc++6:i386