How to properly package newer library than available in repositories of the building OS

Hello,
I want to manually package newer SDL version with my AppImage, than the one available in Ubuntu 18.04 repositories (2.0.12 vs 2.0.8) Embed selected version of SDL2 library into AppImage package · Issue #476 · AntiMicroX/antimicrox · GitHub

So I added uninstalling old sdl and building newer one to my Github action

            - name: Install Dependencies
              run: |
                  sudo apt-get update
                  sudo apt-get install extra-cmake-modules qttools5-dev qttools5-dev-tools libsdl2-dev libxi-dev libxtst-dev libx11-dev itstool gettext qt5-default zsync
                  sudo apt-get remove libsdl2-dev

            - name: Install sdl2
              run: |
                git clone https://github.com/libsdl-org/SDL.git -b release-2.0.12
                cd SDL
                ./configure
                make
                sudo make install

#Buildinf my app...

#And later added also flag --library=/usr/local/lib/libSDL2.so
           - name: Create AppImage file
              run: |
                  cd build
                  export UPDATE_INFORMATION="zsync|https://github.com/$GITHUB_REPOSITORY/releases/latest/download/antimicrox-x86_64.AppImage.zsync"
                  ./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --library=/usr/local/lib/libSDL2.so
                  ./appimagetool-x86_64.AppImage AppDir/ -u "$UPDATE_INFORMATION"

After these changes everything seems to be fine. (You can see building logs here Downgrade · pktiuk/antimicrox@cebb471 · GitHub)
App is built againt 2.0.12, but it is packed with outdated 2.0.8

What is wrong?

I figured it out.

flag LD_DEBUG appeared to be very useful

LD_DEBUG=libs ./AntiMicroX-x86_64_8.AppImage

According to logs:

     43623:	find library=libSDL2-2.0.so.0 [0]; searching
     43623:	 search path=/opt/ros/noetic/lib:/opt/ros/noetic/lib/x86_64-linux-gnu		(LD_LIBRARY_PATH)
     43623:	  trying file=/opt/ros/noetic/lib/libSDL2-2.0.so.0
     43623:	  trying file=/opt/ros/noetic/lib/x86_64-linux-gnu/libSDL2-2.0.so.0
     43623:	 search path=/tmp/.mount_AntiMiUylmvM/usr/bin/../lib		(RUNPATH from file /tmp/.mount_AntiMiUylmvM/AppRun.wrapped)
     43623:	  trying file=/tmp/.mount_AntiMiUylmvM/usr/bin/../lib/libSDL2-2.0.so.0

It appeared that I marked wrong library, but even packing it with
--library=/usr/local/lib/libSDL2-2.0.so.0 did not help, because AppImage creator also packaged old library from /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 and used it.

I had to just manually replace old lib in system
sudo cp /usr/local/lib/libSDL2-2.0.so.0 /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0
Now everything is packed properly, but I don’t like this solution.

I think --library should somehow manage this.

1 Like