pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Cannot run Pharo 9 on archlinux

Open badetitou opened this issue 2 years ago • 28 comments

Bug description when I tried to run image based on Pharo 9, I got error: PrimitiveFailed: primitive #primLoadSymbol:module: in TFFIBackend failed.

To Reproduce Steps to reproduce the behavior:

  1. Install Pharo Launcher
  2. Download an Image P9
  3. Start it

Expected behavior Should work without any error

Screenshots Screenshot_20210803_191858

Idea Why the libgit version could not be linked to "generic" lib as explained in: https://github.com/micropython/micropython-lib/issues/25

Version information:

  • OS: Archlinux
  • Pharo Version 9

Additional context More information in the Pharo Launcher aur repo of archlinux: https://aur.archlinux.org/packages/pharo-launcher/#news

badetitou avatar Aug 03 '21 17:08 badetitou

About your idea: we need to have different versions with linked to local libC or not and probably several different install processes that also check what is present but this is a lot of work. But the move to OBS and Cmake was a step in that direction.

Ducasse avatar Aug 04 '21 05:08 Ducasse

Hi @badetitou it is a problem of dependencies, you can try installing pharo using the libraries in the system though the packaging system of your distribution, as explained in https://pharo.org/download.html

This will not work directly with the launcher, but in the launcher you can define an external VM.

tesonep avatar Aug 05 '21 09:08 tesonep

My problem is not to install Pharo It is to use the Pharo Launcher to install Pharo.

Do you know if it is possible to configure the Pharo Launcher to change the location in which it downloads an image?

badetitou avatar Aug 05 '21 09:08 badetitou

@badetitou Yes - there is a setting

image

astares avatar Aug 05 '21 09:08 astares

Sorry, I wrote incorrectly, I mean. Is it possible to configure the Pharo Launcher to change the location from which it downloads an image?

I would like to modify the PL in a way that, when I want to download a VM for P9, it downloads the VM coming with all dependencies (given by @tesonep ) (https://software.opensuse.org/download.html?project=devel:languages:pharo:latest&package=pharo9-ui)

badetitou avatar Aug 05 '21 09:08 badetitou

How do you please make the Arch package to install? 2021-08-09_13-08-1628508422

roper79 avatar Aug 09 '21 11:08 roper79

Thanks for the report. We will check and reply to you.

Ducasse avatar Aug 09 '21 12:08 Ducasse

How do you please make the Arch package to install?

I confirm the issue with my new installation of Arch linux in Virtualbox

JanBliznicenko avatar Aug 09 '21 21:08 JanBliznicenko

We are puzzled :) because this is the distribution esteban is daily using.

Ducasse avatar Aug 10 '21 15:08 Ducasse

I was able to install it using pacman -S pharo9-ui --overwrite '*'

But there seems to be another issues. There is now a pharo99.0 folder, is this expected?. Extracting the zst files gives:

[kotshie@razer-stealth Downloads]$ tar -I zstd -xvf pharo9-9.0.0-0-x86_64.pkg.tar.zst
.BUILDINFO
.MTREE
.PKGINFO
usr/
usr/bin/
usr/bin/pharo
usr/lib64/
usr/lib64/pharo99.0/
usr/lib64/pharo99.0/bin/
usr/lib64/pharo99.0/bin/pharo
usr/lib64/pharo99.0/lib/
usr/lib64/pharo99.0/lib/libB2DPlugin.so
usr/lib64/pharo99.0/lib/libBitBltPlugin.so
usr/lib64/pharo99.0/lib/libDSAPrims.so
usr/lib64/pharo99.0/lib/libFileAttributesPlugin.so
usr/lib64/pharo99.0/lib/libFilePlugin.so
usr/lib64/pharo99.0/lib/libJPEGReadWriter2Plugin.so
usr/lib64/pharo99.0/lib/libJPEGReaderPlugin.so
usr/lib64/pharo99.0/lib/libLargeIntegers.so
usr/lib64/pharo99.0/lib/libLocalePlugin.so
usr/lib64/pharo99.0/lib/libMiscPrimitivePlugin.so
usr/lib64/pharo99.0/lib/libPharoVMCore.so
usr/lib64/pharo99.0/lib/libSocketPlugin.so
usr/lib64/pharo99.0/lib/libSqueakSSL.so
usr/lib64/pharo99.0/lib/libSurfacePlugin.so
usr/lib64/pharo99.0/lib/libTestLibrary.so
usr/lib64/pharo99.0/lib/libUUIDPlugin.so
usr/lib64/pharo99.0/lib/libUnixOSProcessPlugin.so
usr/lib64/pharo99.0/lib/pharo
usr/lib64/pharo99.0/pharo

And when installing it /usr/bin/pharo-ui symlink is broken. It points to /pharo9.0/pharo-ui ? lrwxrwxrwx 1 root root 18 Aug 6 09:56 /usr/bin/pharo-ui -> /pharo9.0/pharo-ui

kotshie avatar Aug 13 '21 18:08 kotshie

Following the advice of @tesonep, I achieve to package a VM that works in ArchLinux 90-x64-Arch.zip

You only have to unzip it. Then, you can use ./pharo for the version with UI And ./pharo-headless for the version without UI

No need to unzip at a special location

badetitou avatar Aug 19 '21 16:08 badetitou

Until a better solution, I hotfix the launcher to use this VM for people using the aur pharo launcher repository

So, It is now possible to use P9 in archlinux using the aur repo

badetitou avatar Aug 19 '21 16:08 badetitou

Thanks benoit

Ducasse avatar Aug 22 '21 09:08 Ducasse

I had to install libgit2 separately (although git is installed), but after that it works well. Thank you all

JanBliznicenko avatar Aug 22 '21 12:08 JanBliznicenko

Pablo told me that he updated the dependencies so we will see.

Ducasse avatar Aug 22 '21 16:08 Ducasse

I have the same problem on arch. I installed libgit2 from the official repository, but it didn't help. After launching pharo 9/10 from the launcher installed via AUR, I get the same error. This did not allow me to install Seaside to try to write a REST service.
image
So I think its pretty critical problem. Do I need to do something specifically in the launcher itself?
UPD: I'm not sure what exactly made everything work, I deleted Pharo and all the files associated with it, installed it again and now everything works.

gavr123456789 avatar Feb 11 '22 23:02 gavr123456789

I took the Pharo Launcher and used the linuxdeploy tool to bundle and patch all dependencies starting from an openSUSE 15.2. Despite using the bundled libgit2 that seems to have all deps fulfilled, I am getting the following stacktrace:

primitive #primLoadSymbol:module: in TFFIBackend failed
TFFIBackend(ProtoObject)>>primitiveFailed:
TFFIBackend(ProtoObject)>>primitiveFailed
TFFIBackend>>primLoadSymbol:module:
TFFIBackend>>loadSymbol:module:
ExternalAddress class>>loadSymbol:module:
TFExternalFunction>>validate
TFSameThreadCall>>executeOn:withArguments:
TFSameThreadRunner>>invokeFunction:withArguments:
LGitLibrary>>libgit2_init
TFCalloutAPI(FFICalloutAPI)>>function:library:
TFCalloutAPI(FFICalloutAPI)>>function:module:
LGitLibrary(FFILibrary)>>ffiCall:
LGitLibrary>>libgit2_init
[ self libgit2_init.
        self recordInitializationSuccess ] in LGitLibrary>>initializeLibGit2 in Block: [ self libgit2_init....
FullBlockClosure(BlockClosure)>>on:do:
LGitLibrary>>initializeLibGit2
LGitLibrary class>>startUp:
ClassSessionHandler>>startup:
[ :each | each startup: isImageStarting ] in WorkingSession>>runStartup: in Block: [ :each | each startup: isImageStarting ]
[aBlock value: each] in [ :each | 
                [aBlock value: each] 
                        on: Exception
                        do: [ :error | self errorHandler handleError: error] ] in WorkingSession>>runList:do: in Block: [aBlock value: each]
FullBlockClosure(BlockClosure)>>on:do:
[ :each | 
                [aBlock value: each] 
                        on: Exception
                        do: [ :error | self errorHandler handleError: error] ] in WorkingSession>>runList:do: in Block: [ :each | ...
Array(SequenceableCollection)>>do:
WorkingSession>>runList:do:
WorkingSession>>runStartup:
WorkingSession>>start:
SessionManager>>launchSnapshot:andQuit:
[ isImageStarting := self launchSnapshot: save andQuit: quit.
          wait signal. ] in SessionManager>>snapshot:andQuit: in Block: [ isImageStarting := self launchSnapshot: save and...etc...
[self value.
                        "IMPORTANT: Do not step over next line of code. See method comments for details"
                        Processor terminateRealActive] in FullBlockClosure(BlockClosure)>>newProcess in Block: [self value....
PrimitiveFailed: primitive #primLoadSymbol:module: in TFFIBackend failed
TFFIBackend(ProtoObject)>>primitiveFailed:
TFFIBackend(ProtoObject)>>primitiveFailed
TFFIBackend>>primLoadSymbol:module:
TFFIBackend>>loadSymbol:module:
ExternalAddress class>>loadSymbol:module:
TFExternalFunction>>validate
TFSameThreadCall>>executeOn:withArguments:
TFSameThreadRunner>>invokeFunction:withArguments:
LGitLibrary>>libgit2_init
TFCalloutAPI(FFICalloutAPI)>>function:library:
TFCalloutAPI(FFICalloutAPI)>>function:module:
LGitLibrary(FFILibrary)>>ffiCall:
LGitLibrary>>libgit2_init
[ self libgit2_init.
        self recordInitializationSuccess ] in LGitLibrary>>initializeLibGit2 in Block: [ self libgit2_init....
FullBlockClosure(BlockClosure)>>on:do:
LGitLibrary>>initializeLibGit2
LGitLibrary class>>startUp:
ClassSessionHandler>>startup:
[ :each | each startup: isImageStarting ] in WorkingSession>>runStartup: in Block: [ :each | each startup: isImageStarting ]
[aBlock value: each] in [ :each | 
                [aBlock value: each] 
                        on: Exception
                        do: [ :error | self errorHandler handleError: error] ] in WorkingSession>>runList:do: in Block: [aBlock value: each]
FullBlockClosure(BlockClosure)>>on:do:
[ :each | 
                [aBlock value: each] 
                        on: Exception
                        do: [ :error | self errorHandler handleError: error] ] in WorkingSession>>runList:do: in Block: [ :each | ...
Array(SequenceableCollection)>>do:
WorkingSession>>runList:do:
WorkingSession>>runStartup:
WorkingSession>>start:
SessionManager>>launchSnapshot:andQuit:
[ isImageStarting := self launchSnapshot: save andQuit: quit.
          wait signal. ] in SessionManager>>snapshot:andQuit: in Block: [ isImageStarting := self launchSnapshot: save and...etc...
[self value.
                        "IMPORTANT: Do not step over next line of code. See method comments for details"
                        Processor terminateRealActive] in FullBlockClosure(BlockClosure)>>newProcess in Block: [self value....

Maybe this helps the devs?

zilti avatar Feb 25 '22 22:02 zilti

I think I have solved this problem In the class LGitLibrary (package LibGit-Core), I have modified the method unix64LibraryName adding the following code at the beginning of the method

^ FFIUnix64LibraryFinder findAnyLibrary: #(
		"This name is wrong, but some versions of the VM has this library shipped with the bad name"
		'libgit2.so.1.4'
		'libgit2.so.1.4.0'
		'libgit2.so'
...

after I have installed the package libgit2 from pacman.

Toni-zgz avatar Mar 06 '22 18:03 Toni-zgz

Now, when I try to clone a project, pharo crashes and the file "crash.dmp" is the following crash.txt

Toni-zgz avatar Mar 10 '22 21:03 Toni-zgz

i see the same issues with pharo 9 & 10 on aws-linux.

will-forster avatar Apr 13 '22 15:04 will-forster

Until a better solution, I hotfix the launcher to use this VM for people using the aur pharo launcher repository

So, It is now possible to use P9 in archlinux using the aur repo

I tried this solution for the same issue I was getting with Pharo 10, but the fix did apply to Pharo 9. I am thrown the exact same error.

EDIT: adding crash and debug logs (now on Pharo 10 since last edit) PharoDebug.txt crash.txt

thall-gnu avatar Apr 13 '22 20:04 thall-gnu

Actually I have the same problem for what i understand in Archlinux (Pharo 9 to 11). But i manage to fix it : First from the Pharo execption stack i find there was a problem with provided libgit2.1.0.0.so in ~/Pharo/vms/110-x64/lib By checking with ldd i get this result:

linux-vdso.so.1 (0x00007ffcf9bda000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007f1756fb1000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f1756f90000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f1756f22000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f1756cb0000)
libpcre.so.3 => not found
libpcreposix.so.3 => not found
libz.so.1 => /usr/lib/libz.so.1 (0x00007f1756c94000)
libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007f1756c53000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f1756a87000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007f175739c000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f1756a80000)
libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007f17569ee000)
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007f175670d000)

NOTE: libpcre.so.3 and libpcreposix.so.3 not found. After searching on internet i find a forum post explaining that there a wierd name change in Debian of the filname of pcre library: https://www.gamingonlinux.com/articles/tibia-is-a-free-to-play-mmo-that-has-supported-linux-for-a-long-time-fix-included-for-ubuntu.10810/comment_id=108806

So i do a piggy solution: sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3 and sudo ln -s /usr/lib/libpcreposix.so /usr/lib/libpcreposix.so.3 I know it's dirty but it fixed my problem no more problem with (Pharo 11 10 and 9)

Hoping it can help others Regards.

SmallCoder37 avatar Apr 22 '22 15:04 SmallCoder37

So i do a piggy solution: sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3 and sudo ln -s /usr/lib/libpcreposix.so /usr/lib/libpcreposix.so.3 I know it's dirty but it fixed my problem no more problem with (Pharo 11 10 and 9)

It works! @SmallCoder37 . Thanks.

thall-gnu avatar May 09 '22 20:05 thall-gnu

Thanks for your find @SmallCoder37.

I'm experiencing a similar issue on Gentoo thanks to the names of the libraries. To avoid changing stuff in system directories, I would recommend linking from your system libraries to pharo-vm/lib. I did it like so, and bringing in those two libraries seemed to be enough.

ln -s /lib64/libpcre.so.1 libpcre.so.3
ln -s /lib64/libpcre2-posix.so.3 libpcreposix.so.3

jaccarmac avatar Jun 02 '22 22:06 jaccarmac

I am on Manjaro Linux (arch-based) but it may applies to other linux.

Bug Explanation

Launching a fresh Pharo image 9, 10, 11 raise an exception at startup. symbol git_libgit2_init not found in 'libgit2.so.1.0.0'

The case of libgit2.1.0.0.so

ldd libgit2.1.0.0.so
linux-vdso.so.1 (0x00007fff7e1ad000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007efeafe2c000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007efeafe27000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007efeafdb9000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007efeaf78e000)
libpcre.so.3 => not found
libpcreposix.so.3 => not found
libz.so.1 => /usr/lib/libz.so.1 (0x00007efeafd9d000)
libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007efeaf74d000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007efeaf541000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007efeafd98000)
libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007efeaf4ac000)
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007efeaf1cc000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007efeafe5e000)

We cannot install them:

$ pacman -F libpcreposix.so.3
<nothing> => there is no Arch package that provides it

Solution 1

Looking for another version of libprce:

$ pacman -F libpcre.so
core/pcre 8.45-1 [installed]
    usr/lib/libpcre.so
multilib/lib32-pcre 8.45-1
    usr/lib32/libpcre.so

Install it:

$ sudo pacman -S libpcre.so
$ pacman -Fl pcre | egrep 'so$'                                                            ✔
pcre usr/lib/libpcre.so
pcre usr/lib/libpcre16.so
pcre usr/lib/libpcre32.so
pcre usr/lib/libpcrecpp.so
pcre usr/lib/libpcreposix.so

Add local (not system-wide, just in case) links to make the pharo vm happy:

$ cd <vm_dir>/lib
$ ln -s /usr/lib/libpcre.so libpcre.so.3
$ ln -s /usr/lib/libpcreposix.so libpcreposix.so.3

Solution 2

The Pharo VM 10 is shipped with multiple versions of libgit:

$ ls libgit*
libgit2.1.0.0.so  libgit2.so  libgit2.so.0.25.1  libgit2.so.25

I had to install some system packages to resolve libgit2.so dependencies on my system:

sudo pacman -S libcurl3-gnutls

And then, I modified the libgit library name used by Pharo:

LGitLibrary>>unix64LibraryName
	^ FFIUnix64LibraryFinder findAnyLibrary: #(
		'libgit2.so'
		'libgit2.1.0.0.so'

        "kept for compatibility"
		'libgit2.so.1.0.0'
		'libgit2.so.1.0'
		'libgit2.so.1.1'
		'libgit2.so.1.2'
		'libgit2.so.1.3'
		'libgit2.so.1.4'
		'libgit2.so.0.25.1')

Integration

Pull request here: https://github.com/pharo-vcs/libgit2-pharo-bindings/pull/64

I do not know how to propagate it in Pharo9 10 11

LucFabresse avatar Jul 22 '22 16:07 LucFabresse

Thank you LucFabresse for your patch, it works for me (Arch 64bit with Pharo 11).

Another approach for the solution 2 is to preload libgit2 like:

LD_PRELOAD=Pharo/vms/110-x64/lib/libssl.so.1.0.0:Pharo/vms/110-x64/lib/libcrypto.so.1.0.0:Pharo/vms/110-x64/lib/libgit2.so ./vms/110-x64/bin/pharo ./images/<path to pharo image>

lugu avatar Jul 30 '22 16:07 lugu

Since Pharo is shipped with several versions of libgit2, it could try to load each library file found until one succeed.

Another approach would be to let pharo-installer select the right library, either when downloading the image or using a post install script.

lugu avatar Aug 09 '22 20:08 lugu

One more solution: simply to rename the file libgit2.so into libgit2.1.0.0.so in the vms/XXX/lib directory.

lugu avatar Aug 10 '22 20:08 lugu

Le mar. 9 août 2022, 22:50, Ludovic Guegan @.***> a écrit :

Since Pharo is shipped with several versions of libgit2, it could try to load each library file found until one succeed.

This is what it does IIRC.

Another approach would be to let pharo-installer select the right library,

either when downloading the image or using a post script install.

— Reply to this email directly, view it on GitHub https://github.com/pharo-project/pharo/issues/9729#issuecomment-1209880605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADJO4A7N5DRMBT5EMTULO3VYLAAFANCNFSM5BPIPMUA . You are receiving this because you commented.Message ID: @.***>

LucFabresse avatar Oct 11 '22 09:10 LucFabresse

Hi Luc, when I looked at it, it seems the behavior is to search for a list of libraries. If a file is found, the search stops and it tries to load it. If it fails to load it, it doesn't retry with other librairies. That's my understanding.

lugu avatar Oct 13 '22 08:10 lugu