Solved Installing linux app - library issues (MySQL-Workbench as example)

Hello :)
20200502 - Working with FreeBSD 12.1 amd64

EDIT 20200506: Solved with solution described in this first post, short how-to on third post.

I'm trying to install MySQL-Workbench Linux application (Red Hat 7 app version).
In the past this app was in the FreeBSD ports tree. Maybe I should try to build this app directly from the sources (still available on Oracle's website).

But let say this thread is more generalistic; Speaking about installation of Linux apps and issues.

Setup
First step: the FreeBSD Hanbook related chapter, and do checks
  • Kernel:
    Code:
    # kldstat | grep linux
    linux_common.ko
    linux.ko
        linux64.ko
  • Linux pkg:
    Code:
    # pkg info | grep linux
        linux_base-c7-7.7.1908_1
  • rpm installation pkg:
    Code:
    # pkg info | grep rpm
        rpm4-4.15.1_1
Second step: Install a rpm (also described in the Handbook) - Here with MySQL Workbench RPM app
  • Install:
    Code:
    # cd /compat/linux
    # rpm2cpio /path/mysql-workbench-community-8.0.19-1.el8.x86_64.rpm | cpio -id
    397624 blocks

Running app Issue: Command not found
  • as standard user
    Code:
    # /compat/linux/bin/mysql-workbench
    ./mysql-workbench: Command not found.
    # ls -l /compat/linux/bin/mysql-workbench
    -rwxr-xr-x /compat/linux/bin/mysql-workbench
  • as root
    Code:
    # ldd /usr/compat/bin/mysql-workbench
        ldd: mysql-workbench-bin: No such file or directory
  • probably because it is a Shell script (thanks to vermaden with this thread Fix Broken Dependency on FreeBSD)
  • So as vermaden explains check the script and get the real app binary file. (extract)
    Code:
    # cat /compat/linux/bin/mysql-workbench
    #!/bin/bash
    [...]
    
    export [...]
    export MWB_BINARIES_DIR="$destdir/usr/libexec/mysql-workbench"
    
    [...]
    $MWB_BINARIES_DIR/mysql-workbench-bin "$@"
  • We can understand that the binary is: /compat/linux/usr/libexec/mysql-workbench/mysql-workbench-bin
  • let's do a ldd now (extract)
    Code:
    # ldd /compat/linux/usr/libexec/mysql-workbench/mysql-workbench-bin
    linux_vdso.so.1 => (0x00007ffffffff000)
    libsqlide.so.8.0.19 => not found
    libwbprivate.so.8.0.19 => not found
    libxml2.so.2 => not found
    [...]
    libmount.so.1 => /lib64/libmount.so.1 (0x0000000805200000)
        libblkid.so.1 => /lib64/libblkid.so.1 (0x0000000805600000)
  • a lot of libraries not found



Running app Issue: ldd reports library not found
Don't forget to be up-to-date with the pkg update

Solution 1 - Linux library provided by FreeBSD:
  • example with "libgtk-3.so.0 => not found"
  • check if there is a pkg that provides the Linux library
  • Code:
    # pkg search linux | grep gtk
        linux-c7-gtk3-3.22.30          GTK+ library, version 3.X (Linux CentOS 7.7.1908)
  • if yes, then install it pkg install linux-c7-gtk3 and don't forget to check messages after installation
  • Code:
    # pkg install linux-c7-gtk3
    [...]
    [36/36] Installing linux-c7-gtk3-3.22.30...
    [36/36] Extracting linux-c7-gtk3-3.22.30: 100%
    =====
    Message from linux-c7-dri-18.3.4_1:
    
    This package needs linsysfs mounted on /compat/linux/sys. Add the
    following line to /etc/fstab:
    linsysfs /compat/linux/sys linsysfs rw 0 0
  • During the pkg installation process you see that the x11-toolkits/linux-c7-gtk3 pkg will install a lot of others Linux librairies, so after installation redo a ldd to see the updated output
  • More generally if your Linux app is "complex modern" app you will probably add the emulators/linux-c7 pkg

Solution 2 - Linux library provided by the app itself:
  • For some libraries it is possible that FreeBSD may not provide them. In my example MySQL-Workbench app have his associated librairies folder
  • extract
    Code:
    # ls -l /compat/linux/lib64/mysql-workbench/lib*
    lrwxrwxrwx /compat/linux/lib64/mysql-workbench/libantlr4-runtime.so -> libantlr4-runtime.so.4.7.1
    -rw-r--r-- /compat/linux/lib64/mysql-workbench/libantlr4-runtime.so.4.7.1
    [...]
    lrwxrwxrwx /compat/linux/lib64/mysql-workbench/libwbssh.so -> libwbssh.so.8.0.19
    -rw-r--r-- /compat/linux/lib64/mysql-workbench/libwbssh.so.8.0.19
  • So I decide to link those libraries, sample here:
  • Code:
    # cd /compat/linux/usr/lib64
    # ln -s mysql-workbench/libwbprivate.so.8.0.19 .

Solution 3 - Linux Labrary as an RPM:
  • For some libraries it will be necessary to install them with the CentOS rpm package
  • Get the rpm from CentOS 7 packages, you can also have a look in the CentOS 7 update packages.
  • Then install (in my case I did that for libgtkmm, libatkmm, libgdkmm, ...)


Solution 4 - FreeBSD Library: (not sure this works)
EDIT 20200506 : See post 3, after a 'reset' I was able to get all need libraries with solution 1/2/3 - all together - solution 4 not necessary
  • example with "libsecret-1.so.0 => not found"
  • let see if the library is there somewhere
    Code:
    # ls -l /compat/linux/lib/libsecret-1.so.0*
        ls: not found
  • Code:
    # ls -l /compat/linux/lib64/libsecret-1.so.0*
        ls: not found
  • Code:
    # ls -l /usr/local/lib/libsecret-1.so.0*
    lrwxr-xr-x /usr/local/lib/libsecret-1.so.0 -> libsecret-1.so.0.0.0
        -rwxr-xr-x /usr/local/lib/libsecret-1.so.0.0.0
  • If you don't find the library you probably need to install it (see also notes below). In my example "libzip" was not install, so I did a pkg install libzip
  • Then, again the Handbook: "copy all the files in the last column of the output from the Linux® system into /compat/linux".
  • let's do for libsecret-1.so.0 and check with ldd again as a complete example
  • before
    Code:
    # # ldd /compat/linux/usr/libexec/mysql-workbench/mysql-workbench-bin | grep secret
        libsecret-1.so.0 => not found
  • update
    Code:
    # cd /compat/linux/lib64
    # cp /usr/local/lib/libsecret-1.so.0 .
  • after
    Code:
    # ldd /compat/linux/usr/libexec/mysql-workbench/mysql-workbench-bin | grep secret
        (no result here - means now library found)
  • linking done


Running app Issue: ELF file OS ABI invalid with FreeBSD library
  • after linking all the missing libraries, you get a new issue
  • Code:
    # ldd /compat/linux/usr/libexec/mysql-workbench/mysql-workbench-bin
        /compat/linux/usr/libexec/mysql-workbench/mysql-workbench-bin: error while loading shared libraries: /lib64/libsecret-1.so.0: ELF file OS ABI invalid
  • Again the Handbook, "help the FreeBSD kernel distinguish between a FreeBSD ELF binary and a Linux® binary"
  • Code:
    # brandelf -t linux /compat/linux/lib64/libsecret-1.so.0


Running app Issue: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found
  • Run
  • Code:
    # ./mysql-workbench-bin
    ./mysql-workbench-bin: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./mysql-workbench-bin)
    ./mysql-workbench-bin: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./mysql-workbench-bin)
    ./mysql-workbench-bin: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./mysql-workbench-bin)
    [...]
    ./mysql-workbench-bin: /lib64/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /lib64/libmysqlclient.so.21)
    ./mysql-workbench-bin: /lib64/libssl.so.1.1: version `OPENSSL_1_1_0' not found (required by /lib64/libmysqlclient.so.21)
    ./mysql-workbench-bin: /lib64/libcrypto.so.1.1: version `OPENSSL_1_1_1' not found (required by /lib64/libmysqlclient.so.21)
    ./mysql-workbench-bin: /lib64/libcrypto.so.1.1: version `OPENSSL_1_1_0' not found (required by /lib64/libmysqlclient.so.21)
    ./mysql-workbench-bin: /lib64/libpng15.so.15: version `PNG16_0' not found (required by /lib64/libgdal.so.1)
        ./mysql-workbench-bin: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /lib64/libsqlite3.so)
  • We can check that for listed libraries if they contain the required version
  • check (example)
    Code:
    # strings libstdc++.so.6 | grep GLIBCXX
    GLIBCXX_3.4
    GLIBCXX_3.4.1
    GLIBCXX_3.4.2
    [...]
    GLIBCXX_3.4.14
    GLIBCXX_3.4.15
    GLIBCXX_3.4.16
    GLIBCXX_3.4.17
    GLIBCXX_3.4.18
    GLIBCXX_3.4.19
  • So we can see the wanted version is not present. Then I try to update the library version to the last provided on CentOS 7 archived rpm but the same.
  • My only solution here is to go with an older version of the Linux app.


Solved for MySQL-Workbench last version - See post 3.
 
Last edited:
I finally get last version of MySQL-Workbench 8.0.20 working.
I did a complete cleaning of Linux installation and restart the procedure as I decribed in first post (see below for quick how-to).

Please (launch as standard user):
mysqlw01.png


mysqlw02.png



Clean Linux:
Code:
# cd /compat

# umount tmpfs
# umount linsysfs
# umount linprocfs

# pkg delete linux-c7-7.7.1908 linux_base-c7-7.7.1908_1
# pkg info | grep linux (to check if there is still a linux pkg, if yes delete)

# rm -rf linux (/!\ take care you don't have personnal data in it before)

Re-install: As decribed in the FreeBSD Hanbook.
In my case I have also added (because I know my app needs them):
Code:
# pkg install linux-c7
# pkg install linux-c7-gtk3

Re-mount Linux stuff:
Code:
# mount tmpfs
# mount linsysfs
# mount linprocfs

Reinstall MySQL-Workbench; As described in first post:
  • install with the RPM
  • follow "solution 1/2/3" in this order for missing libraries (solution 4 was finally not necessary)
Edit the MySQL-Workbench start-up script;
  • first save it
    Code:
    # cp /compat/linux/usr/bin/mysql-workbench /compat/linux/usr/bin/mysql-workbench.sav
  • edit with your favorite editor:.
    • remove the first line (#!/bin/bash) if you don't have bash installed
    • search this line and remplace it
    • Code:
      #destdir="$WB_DEST_DIR"
      destdir="/compat/linux"

Then start with you standard user and enjoy; /compat/linux/usr/bin/mysql-workbench

Note: I haven't tested all features (db connection) but design DB and save design is ok.
When running I see the ouput:
Code:
ld-elf.so.1: Shared object "libpthread.so.0" not found, required by "libsqlite3.so"
So it means that for some functionalities there is a missing library.

[TODO: investigate and report here]
Save your like/love/life and don't forget to smile to people :)
 
Back
Top