Skip to content

onigumura: fix library installation#29397

Merged
cotequeiroz merged 1 commit into
openwrt:masterfrom
cotequeiroz:onig_so_fix
May 11, 2026
Merged

onigumura: fix library installation#29397
cotequeiroz merged 1 commit into
openwrt:masterfrom
cotequeiroz:onig_so_fix

Conversation

@cotequeiroz
Copy link
Copy Markdown
Member

Commit 537c2a6 ("treewide: avoid deref symlinks when installing .so") intended to avoid duplicating .so* files, but this package actually relies on install dereferencing the file that matches the SONAME version, to avoid installing unnecessary symlinks.

Fixes: #29387
Fixes: 537c2a6 ("treewide: avoid deref symlinks when installing .so")

Ping @BKPepe

@danielfdickinson
Copy link
Copy Markdown
Contributor

I can confirm this fixes php8-mod-mbstring which depends on oniguruma.

Comment thread libs/oniguruma/Makefile
define Package/oniguruma/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libonig.so.$(ABI_VERSION) $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libonig.so.$(ABI_VERSION) $(1)/usr/lib/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I figured out what went wrong. I pushed the commit almost completely without the commit description. It was heavily inspired by openwrt/openwrt@38b22b1 and #9233

You are right, my change is not sufficient and breaks the library, but here is what is going on. To understand this issue, we need to look at two use-cases. One with ABI_VERSION, which I broke, and the other one without ABI_VERSION, which was fixed.

With ABI versioning:

Before:

tar -Oxzf bin/packages/arm_cortex-a9_vfpv3-d16/packages/oniguruma_6.9.9-r1_arm_cortex-a9_vfpv3-d16.ipk ./data.tar.gz | tar -tzvf -
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./usr/
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./usr/lib/
-rwxr-xr-x  0 0      0      526493 Feb  5  2024 ./usr/lib/libonig.so.5

Current master - basically broken:

tar -Oxzf bin/packages/arm_cortex-a9_vfpv3-d16/packages/oniguruma_6.9.9-r1_arm_cortex-a9_vfpv3-d16.ipk ./data.tar.gz | tar -tzvf -
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./usr/
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./usr/lib/
lrwxrwxrwx  0 0      0           0 Feb  5  2024 ./usr/lib/libonig.so.5 -> libonig.so.5.4.0

After applying this fix (just adding *):

Suggested change
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libonig.so.$(ABI_VERSION) $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libonig.so.$(ABI_VERSION)* $(1)/usr/lib/

It looks like this:

tar -Oxzf bin/packages/arm_cortex-a9_vfpv3-d16/packages/oniguruma_6.9.9-r1_arm_cortex-a9_vfpv3-d16.ipk ./data.tar.gz | tar -tzvf -
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./usr/
drwxr-xr-x  0 0      0           0 Feb  5  2024 ./usr/lib/
lrwxrwxrwx  0 0      0           0 Feb  5  2024 ./usr/lib/libonig.so.5 -> libonig.so.5.4.0
-rwxr-xr-x  0 0      0      526493 Feb  5  2024 ./usr/lib/libonig.so.5.4.0

Without ABI versioning:

  • libre2 package
    Before:
tar -Oxzf bin/packages/arm_cortex-a9_vfpv3-d16/packages/re2_2023.02.01\~b025c6a3-r1_arm_cortex-a9_vfpv3-d16.ipk ./data.tar.gz | tar -tzvf - 
drwxr-xr-x  0 0      0           0 Aug 18  2024 ./
drwxr-xr-x  0 0      0           0 Aug 18  2024 ./usr/
drwxr-xr-x  0 0      0           0 Aug 18  2024 ./usr/lib/
-rw-r--r--  0 0      0      331875 Aug 18  2024 ./usr/lib/libre2.so
-rw-r--r--  0 0      0      331875 Aug 18  2024 ./usr/lib/libre2.so.10
-rw-r--r--  0 0      0      331875 Aug 18  2024 ./usr/lib/libre2.so.10.0.0

After applying my commit:

tar -Oxzf bin/packages/arm_cortex-a9_vfpv3-d16/packages/re2_2023.02.01\~b025c6a3-r1_arm_cortex-a9_vfpv3-d16.ipk ./data.tar.gz | tar -tzvf -
drwxr-xr-x  0 0      0           0 Aug 18  2024 ./
drwxr-xr-x  0 0      0           0 Aug 18  2024 ./usr/
drwxr-xr-x  0 0      0           0 Aug 18  2024 ./usr/lib/
lrwxrwxrwx  0 0      0           0 Aug 18  2024 ./usr/lib/libre2.so -> libre2.so.10
lrwxrwxrwx  0 0      0           0 Aug 18  2024 ./usr/lib/libre2.so.10 -> libre2.so.10.0.0
-rwxr-xr-x  0 0      0      331875 Aug 18  2024 ./usr/lib/libre2.so.10.0.0

To sum it up:

  • With ABI_VERSION, there was no symlink. Was this intentional?
  • Without ABI_VERSION, we were shipping three (!) files in case of libre2, which makes it huge and no symlinks at all.

I am not entirely sure how this pattern originated in the packages feed. If I look at the main openwrt repository, ABI_VERSION is not typically used this way in the Package/foo/install definitions. For instance, I checked the jansson package in the main repo, and it correctly ships the symlink when using ABI.

TL,DR: If I am not mistaken, even packages with ABI_VERSION should preserve the correct symlink structure pointing to the actual shared object. Can we agree on this one? If yes, I will prepare a new PR to fix other packages, which I broke. 😢

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't say for other packages, but my installing of libonig.so.5 only is intentional. That's the only file the OS needs to load the library. The unversioned libonig.so would be used to link the binary when building a binary. It could arguably be used if one were to use an openwrt host for building binaries. However, our package system does not handle multiple packages owning the symlink well, so I never tried to head in that direction.
Why do we need the libonig.so.5.4.0 file? To me it is a needless symlink that will mostly clutter /usr/lib.

TLDR: I would leave the package as I'm doing here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and I see your point about saving an inode and keeping the package layout minimal. My concern is mainly consistency across OpenWrt and easier debugging in practice.

When I look at /usr/lib on a running router, the symlinked layout is what I see for the large majority of shared libraries, including core OpenWrt ones. From my point of view, the bigger problem is having several different packaging styles for essentially the same kind of library, because that makes the feed harder to maintain and makes it less obvious which approach is considered correct.

In my view, it is more useful to know the exact library version that is present, not just the major version. Keeping only the major version visible does not seem like a good trade-off to me, especially when the symlink itself uses very little space. With ls -l, you can immediately see which exact library version is present. You can also inspect package contents through apk info -L oniguruma or opkg files oniguruma, but that still does not make the full version visible in the same straightforward way if only the major-version name is kept. It becomes even more confusing when the package version does not directly match the library version, because then it is no longer obvious which exact library build is actually installed unless the full version is visible in /usr/lib.

What I found is that The TLDP Program Library HOWTO explicitly describes the usual layout as SONAME -> Real Name, stating that a fully qualified soname is a symbolic link to the shared library’s real name, and that ldconfig creates sonames as symbolic links to the real names. The GNU Libtool manual’s Release numbers page also shows the same general idea of using a symlinked library name that points to the actual versioned file, although it is less explicit about SONAME terminology there. For that reason, I do not think omitting the library’s full release number is a good idea.

That being said, you are the maintainer of this package, so I will respect your decision here. I would just prefer that we keep one consistent shared-library layout across the feed, because mixing both approaches makes maintenance and debugging harder than necessary, and then we end up having to debate what is actually correct, why it should be done that way, and what the expected layout is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it looks like CI/CD agrees with me. :)
Screenshot_20260510_170127_Brave

@BKPepe BKPepe mentioned this pull request May 10, 2026
3 tasks
@BKPepe
Copy link
Copy Markdown
Member

BKPepe commented May 10, 2026

Completely off-topic, but I just noticed that the oniguruma repository is read-only (see https://github.com/kkos/oniguruma/) and that development has basically ended based on this commit - kkos/oniguruma@f95747b

Shouldn't we consider removing this package?

@wenmra
Copy link
Copy Markdown

wenmra commented May 10, 2026

Completely off-topic, but I just noticed that the oniguruma repository is read-only (see https://github.com/kkos/oniguruma/) and that development has basically ended based on this commit - kkos/oniguruma@f95747b

Shouldn't we consider removing this package?

Moved here? https://github.com/youkidearitai/oniguruma

@danielfdickinson
Copy link
Copy Markdown
Contributor

Shouldn't we consider removing this package?

php8-mod-mbstring, at least, depends on it. Might want to file a bug against PHP8 and get that straightened away before doing that.

@mhei

@cotequeiroz
Copy link
Copy Markdown
Member Author

As for removing the package, unless there's a stronger development commitment, it will eventually happen. We should wait for dependent packages to adapt themselves, assuming there's no security issue. I wouldn't count on it, considering the rising rate at which vulnerabilities are being found recently.

@BKPepe
Copy link
Copy Markdown
Member

BKPepe commented May 10, 2026

Moved here? https://github.com/youkidearitai/oniguruma

I took a look, but it only has 3 more commits, and just one of them is actually relevant:
youkidearitai/oniguruma@cd15809. Also, checking Repology, I can see only one distribution using that forked repository.

Might want to file a bug against PHP8 and get that straightened away before doing that.

There's already an issue open for it, along with a pull request: php/php-src#18467 and php/php-src#21490

@danielfdickinson
Copy link
Copy Markdown
Contributor

Looks like the PR has been merged in PHP8. So we could (safely) drop Oniguruma once that winds its way through the process and packaging.

Commit 537c2a6 ("treewide: avoid deref symlinks when installing .so")
intended to avoid duplicating .so* files, but this package actually
relies on install dereferencing the file that matches the SONAME
version, to avoid installing unnecessary symlinks.

Fixes: openwrt#29387
Fixes: 537c2a6 ("treewide: avoid deref symlinks when installing .so")
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
@cotequeiroz
Copy link
Copy Markdown
Member Author

I'll merge this as is. @BKPepe, feel free to change it to include the extra symlink if you wish.

@cotequeiroz cotequeiroz merged commit 8a9b1e9 into openwrt:master May 11, 2026
2 checks passed
@cotequeiroz cotequeiroz deleted the onig_so_fix branch May 13, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oniguruma5: .so file is missing

4 participants