How to compile packages for TOS5 to avoid DLL hell?

I am running on TOS 5 HBT for second week and I assembled SDK and toolchain directly from openwrt setting target for powerpc_8540. I am able to compile packages but when trying to install on TOS5 HBT i have to use opkg --nodeps to install it which have very unwanted side consequence that next time pkgupdate will fail reporting that library that is already in my system present is not present.

----OSCAM

turris /data/packages # opkg install ./oscam_1.20-11572-1_powerpc_8540.ipk
Installing oscam (1.20-11572-1) to root…
Collected errors:
satisfy_dependencies_for: Cannot satisfy the following dependencies for oscam:
libopenssl1.1
opkg_install_cmd: Cannot install package oscam.
turris /data/packages # opkg list-installed | grep libopenssl
libopenssl - 1.1.1g-1.0
libopenssl-conf - 1.1.1g-1.0
turris /data/packages # opkg install ./libopenssl1.1_1.1.1d-2_powerpc_8540.ipk
Installing libopenssl1.1 (1.1.1d-2) to root…
Collected errors:
check_data_file_clashes: Package libopenssl1.1 wants to install file /usr/lib/libcrypto.so.1.1
But that file is already provided by package * libopenssl
check_data_file_clashes: Package libopenssl1.1 wants to install file /usr/lib/libssl.so.1.1
But that file is already provided by package * libopenssl
opkg_install_cmd: Cannot install package libopenssl1.1.
turris /data/packages # opkg --nodeps install ./oscam_1.20-11572-1_powerpc_8540.ipk
Installing oscam (1.20-11572-1) to root…
Configuring oscam.
turris /data/packages # /etc/init.d/oscam enable
turris /data/packages # /etc/init.d/oscam start
WARNING: Web interface UTF-8 mode enabled. Carefully read documentation as bugs may arise.

----pcsensor

turris /data/packages # opkg install ./pcsensor_1.2.0-1_powerpc_8540.ipk
Installing pcsensor (1.2.0-1) to root…
Installing libusb-1.0-0 (1.0.22-2) to root…
Collected errors:
opkg_download_pkg: Package libusb-1.0-0 is not available from any configured src.
opkg_install_pkg: Failed to download libusb-1.0-0. Perhaps you need to run ‘opkg update’?
opkg_install_cmd: Cannot install package pcsensor.
turris /data/packages # opkg list-installed | grep libusb
libusb-1.0 - 1.0.22-2.0
libusb-compat - 0.1.5-2.0
turris /data/packages # opkg install ./libusb-1.0-0_1.0.22-2_powerpc_8540.ipk
Installing libusb-1.0-0 (1.0.22-2) to root…
Collected errors:
check_data_file_clashes: Package libusb-1.0-0 wants to install file /usr/lib/libusb-1.0.so.0
But that file is already provided by package * libusb-1.0
check_data_file_clashes: Package libusb-1.0-0 wants to install file /usr/lib/libusb-1.0.so.0.1.0
But that file is already provided by package * libusb-1.0
opkg_install_cmd: Cannot install package libusb-1.0-0.

----CUPS

turris /data/packages # opkg install ./cups_2.1.4-5_powerpc_8540.ipk
Installing cups (2.1.4-5) to root…
Collected errors:
satisfy_dependencies_for: Cannot satisfy the following dependencies for cups:
libcupsppdc
opkg_install_cmd: Cannot install package cups.
turris /data/packages # opkg install ./libcupsppdc_2.1.4-5_powerpc_8540.ipk
Installing libcupsppdc (2.1.4-5) to root…
Installing libstdcpp6 (8.3.0-2) to root…
Collected errors:
opkg_download_pkg: Package libstdcpp6 is not available from any configured src.
opkg_install_pkg: Failed to download libstdcpp6. Perhaps you need to run ‘opkg update’?
opkg_install_cmd: Cannot install package libcupsppdc.

turris /data/packages # opkg list-installed | grep libstdcpp
libstdcpp - 7.5.0-2.15

turris /data/packages # opkg install ./libstdcpp6_8.3.0-2_powerpc_8540.ipk
Installing libstdcpp6 (8.3.0-2) to root…
Collected errors:
check_data_file_clashes: Package libstdcpp6 wants to install file /usr/lib/libstdc++.so.6
But that file is already provided by package * libstdcpp
opkg_install_cmd: Cannot install package libstdcpp6.

turris /data/packages # opkg --nodeps install ./libcupsppdc_2.1.4-5_powerpc_8540.ipk
Installing libcupsppdc (2.1.4-5) to root…
Configuring libcupsppdc.

turris /data/packages # opkg --nodeps install ./cups_2.1.4-5_powerpc_8540.ipk
Installing cups (2.1.4-5) to root…
Configuring cups.
turris /data/packages #

----REDSOCKS2

turris /data/packages # opkg install redsocks2_0.60-2_powerpc_8540.ipk
Installing redsocks2 (0.60-2) to root…
Installing libevent2-7 (2.1.11-2) to root…
Collected errors:
opkg_download_pkg: Package libevent2-7 is not available from any configured src.
opkg_install_pkg: Failed to download libevent2-7. Perhaps you need to run ‘opkg update’?
opkg_install_cmd: Cannot install package redsocks2.
turris /data/packages # opkg list-installed | grep libevent
libevent2 - 2.1.11-1.0
libevent2-core - 2.1.11-1.0
turris /data/packages # opkg install ./libevent2-7_2.1.11-2_powerpc_8540.ipk
Installing libevent2-7 (2.1.11-2) to root…
Collected errors:
check_data_file_clashes: Package libevent2-7 wants to install file /usr/lib/libevent-2.1.so.7
But that file is already provided by package * libevent2
check_data_file_clashes: Package libevent2-7 wants to install file /usr/lib/libevent-2.1.so.7.0.0
But that file is already provided by package * libevent2
opkg_install_cmd: Cannot install package libevent2-7.

turris /data/packages # opkg --nodeps install ./redsocks2_0.60-2_powerpc_8540.ipk
Installing redsocks2 (0.60-2) to root…
Configuring redsocks2.
turris /data/packages #

**Even I made sure to be on 19.07.2 branch of openwrt using

git fetch --tags
git checkout v19.07.2

So I am on the same or more less same version of libraries, the opkg keep complaining that there are no required dependency libraries in the system even they are or slightly differen version so big problem is then when new build of HBT arrive and updater fail - pkgupdate fail like this:**

turris /data/packages # pkgupdate

INFO:Target Turris OS: 5.0.0

line not found
line not found
line not found
line not found
line not found
line not found

ERROR:
inconsistent: Package oscam requires package libusb-1.0-0 that is not available.

turris /data/packages # opkg list-installed | grep libusb
libusb-1.0 - 1.0.22-2.0
libusb-compat - 0.1.5-2.0

So which toolchain (imagebuilder/SDK) should I use for TOS 5 and where is it available as I could not find it for testing branches at https://repo.turris.cz as there are only imagebuilder/SDK for previous version of TOS 3. Or should I cherry pick the exact Makefile version of libraries ?

have you tried to run “opkg update && opkg upgrade” first?
I think this should not happen unless you have mixed software from different repositories…

Thank you, but I seek more sophisticated advice. Of course I did both those commands. If it is not clear from my post, I assembled openwrt toolchain and compiled all those packages myself. What I look now is something how to assemble toolchain same way the turris developers do. For TOS 3 it was described here https://doc.turris.cz/doc/cs/howto/turris_os_build, but for TOS 5 we need different toolchain or at least different libraries version and probably some more spice as well even I get as close I could get.

That’s kind of what happened. But, let me get to that first.

You are wondering how you can build a toolchain to build packages for Turris OS (or if you prefer OpenWrt). This is included in our repository of turris-build. In the past, I had workshop together with @ja-pa to let know users of OpenWrt routers how they can build packages for it.

You didn’t mention where did you get oscam and other packages, which you are trying to build. From this output:

turris /data/packages # opkg list-installed | grep libopenssl libopenssl - 1.1.1g-1.0 libopenssl-conf - 1.1.1g-1.0 turris /data/packages # opkg install ./libopenssl1.1_1.1.1d-2_powerpc_8540.ipk

It’s clear to me what’s happening. You downloaded SDK for OpenWrt 19.07.2 version and in branches HBT-HBK-HBL, there is already OpenWrt 19.07.03. If you download SDK for OpenWrt 19.07.02, you need to be careful. If you take a look at feeds.conf from that SDK, there is:

src-git base https://git.openwrt.org/openwrt/openwrt.git;v19.07.2

It means that it downloads the latest commit from this tag. However, there is a version of OpenSSL 1.1.1d. You can see it here:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/libs/openssl/Makefile;h=eb267f31f07afbb27204febb687c4668cc889a52;hb=33732f4a9c17921b782167a0dcaba9703d4e6753#l12

It means that it is vulnerable for CVEs: CVE-2019-1551, CVE-2020-1967, … which was fixed in upcoming versions of OpenSSL e.g. OpenSSL 1.1.1e,f,g. The current latest version is OpenSSL 1.1.1g, which you have on your router installed.

And there is nothing wrong that Updater shows you incompatibilities as you are messing up with libraries and this is not a good at all! And if you are using any --force parameter you can not expect anything else. Still better than a broken system, right?

So what’s now? You can see that we are using latest changes from related branches in each releases and that SDK might and will change if something changes in upstream and incompability might happen once again until a new SDK is released or you can proceed with turris-build repository and compile it yourself as it is not hard. It is something about 3 commands and it takes a few tens of minutes depending on your computer.

About libusb, versioning matters as well. It will be good to see the sourcecode.

1 Like

Thanks a lot @Pepe, thats what I exactly needed to know.

  1. turris-build was something I was not aware of so yes ! I will try it.
  2. You are based already at OpenWrt 19.07.3. I took 19.07.2 as thought 19.07.3 will be too fresh so I could will update toolchain to 19.07.3 it is great to hear that.

@Pepe when i try git tag at nic repository I get list of only TOS version 4 and I could not get hbt branch as it is not listed. How to get on hbt branch then ?

root@i5debian:/VERBATIM/turris-build# git tag v4.0-alpha1 v4.0-alpha2 v4.0-alpha3 v4.0-alpha4 v4.0-alpha5 v4.0-beta1 v4.0-beta10 v4.0-beta2 v4.0-beta3 v4.0-beta4 v4.0-beta5 v4.0-beta6 v4.0-beta7 v4.0-beta8 v4.0-beta9 v4.0.0 v4.0.1 v4.0.2 v4.0.3 v4.0.5

root@i5debian:/VERBATIM/turris-build# git checkout hbt
error: pathspec ‘hbt’ did not match any file(s) known to git

Also found out that -t board parameter has to be turris1x not turris

Because HBT is not a final release and we are not tagging RC releases. The version will be tagged once it reaches HBS branch. You can compile HBS (by tags) and then there are HBK/HBL/HBD.

Thank you @Pepe with your help I was able to build TOS 5 toolchain then compile & install my packages without errors

git clone https://gitlab.labs.nic.cz/turris/turris-build.git

compile_pkgs prepare_tools -t turris1x
make defconfig
make menuconfig
make
make package/mypackage/compile

1 Like