Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to libjpeg-turbo 2.x #19

Closed
totaam opened this issue Jul 13, 2021 · 12 comments
Closed

update to libjpeg-turbo 2.x #19

totaam opened this issue Jul 13, 2021 · 12 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Jul 13, 2021

Not so easy:

  • bumped in the moduleset dc471a1 + typo 473f31e
  • must set checkoutdir for github archives f6e3e6f
  • force the correct install lib dir: 61fccd4

Then hit the same issues as #2 (comment):

Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libturbojpeg.0.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libturbojpeg.0.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libturbojpeg.0.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libturbojpeg.0.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libturbojpeg.0.dylib
Cannot find a matching prefix for @rpath/libjpeg.62.dylib
Cannot find a matching prefix for @rpath/libturbojpeg.0.dylib
sh: gtk-query-immodules-2.0: command not found
g_module_open() failed for image/.Xpra.app/Contents/Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so: dlopen(image/.Xpra.app/Contents/Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so, 10): Library not loaded: @rpath/libjpeg.62.dylib
  Referenced from: /Users/macos/xpra/packaging/MacOS/image/.Xpra.app/Contents/Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so
  Reason: image not found
g_module_open() failed for image/.Xpra.app/Contents/Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so: dlopen(image/.Xpra.app/Contents/Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so, 10): Library not loaded: @rpath/libjpeg.62.dylib
  Referenced from: /Users/macos/gtk/inst/lib/libtiff.5.dylib
  Reason: image not found
Running install name tool
@totaam
Copy link
Collaborator Author

totaam commented Jul 13, 2021

And the problem comes from:

$ otool -L $JHBUILD_PREFIX/lib/libjpeg.62.3.0.dylib 
$JHBUILD_PREFIX/lib/libjpeg.62.3.0.dylib:
	@rpath/libjpeg.62.dylib (compatibility version 62.0.0, current version 62.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
$ otool -L $JHBUILD_PREFIX/lib/libturbojpeg.0.2.0.dylib 
$JHBUILD_PREFIX/lib/libturbojpeg.0.2.0.dylib:
	@rpath/libturbojpeg.0.dylib (compatibility version 0.0.0, current version 0.2.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

Found that I can set the install name directly without reference to the old install name by passing the -id flag.
So this can be fixed with:

install_name_tool -id "$JHBUILD_PREFIX/lib/libjpeg.62.dylib" $JHBUILD_PREFIX/lib/libjpeg.62.3.0.dylib
install_name_tool -id "$JHBUILD_PREFIX/lib/libturbojpeg.0.dylib" $JHBUILD_PREFIX/lib/libturbojpeg.0.2.0.dylib

Then rebuild any library that linked with the broken id. (ie: libtiff, libwebp, gdk-pixbuf, gstreamer, etc)


There must be a way to tell cmake to use this path instead of injecting rpath in there.
Which would be a much better solution than patching things up afterwards.

totaam added a commit that referenced this issue Sep 18, 2021
@totaam
Copy link
Collaborator Author

totaam commented Nov 24, 2021

Bumped to 2.1.2 in 66f0aa3

No rush to upgrade to 3.0.x which may well cause us some new problems!

@totaam totaam mentioned this issue Feb 13, 2022
@totaam
Copy link
Collaborator Author

totaam commented Aug 18, 2022

Still had to manually fix things with install_name_tool for libjpeg-turbo 2.1.4 : cc8463d

@totaam
Copy link
Collaborator Author

totaam commented Feb 20, 2023

Bumped to 2.1.5.1 in b57ba2e

@totaam
Copy link
Collaborator Author

totaam commented Feb 20, 2023

After a lot of trial and error, well, mostly errors: cc47e60, 70cd71b.

These magic incantations override the default cmakeargs and the resulting libjpeg.62.dylib has the correct paths: e0ce1f5 + 321c427

$ otool -L ${JHBUILD_PREFIX}/lib/libjpeg.62.3.0.dylib 
/Users/macos/gtk/inst/lib/libjpeg.62.3.0.dylib:
	@rpath/libjpeg.62.dylib (compatibility version 62.0.0, current version 62.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

@totaam totaam closed this as completed Feb 20, 2023
@totaam
Copy link
Collaborator Author

totaam commented Feb 20, 2023

No it doesn't 😞
Still needed:

install_name_tool -id "$JHBUILD_PREFIX/lib/libjpeg.62.dylib" $JHBUILD_PREFIX/lib/libjpeg.62.3.0.dylib
install_name_tool -id "$JHBUILD_PREFIX/lib/libturbojpeg.0.dylib" $JHBUILD_PREFIX/lib/libturbojpeg.0.2.0.dylib

@totaam totaam reopened this Feb 20, 2023
@totaam
Copy link
Collaborator Author

totaam commented Mar 2, 2023

Looks finally fixed thanks to CMAKE_MACOSX_RPATH=true in de72485.

Recommended reading: Understanding RPATH (With CMake)

This was also causing problems with brotli (which was picked up be freetype if re-building..), now also fixed: 78501f8

@totaam totaam closed this as completed Mar 2, 2023
@totaam
Copy link
Collaborator Author

totaam commented Mar 3, 2023

Nope, this might have worked for packaging thanks to rpath support in gtk-mac-bundler but this now causes problems earlier when building gdk-pixbuf... 😭

@totaam
Copy link
Collaborator Author

totaam commented Nov 12, 2023

Bumped to 3.0.1 in dcc4512 + fixups in 49dfe00 + f0c382c

The dyld path still needs fixing:

install_name_tool -id "$JHBUILD_PREFIX/lib/libjpeg.62.dylib" $JHBUILD_PREFIX/lib/libjpeg.62.4.0.dylib
install_name_tool -id "$JHBUILD_PREFIX/lib/libturbojpeg.0.dylib" $JHBUILD_PREFIX/lib/libturbojpeg.0.3.0.dylib

@totaam
Copy link
Collaborator Author

totaam commented Jan 3, 2024

Correct solution detailed here: Xpra-org/xpra#4085 (comment)

cpatulea added a commit to cpatulea/gtk-osx-build that referenced this issue Jan 7, 2024
cpatulea added a commit to cpatulea/gtk-osx-build that referenced this issue Jan 7, 2024
@cpatulea
Copy link

cpatulea commented Jan 7, 2024

For the rpath issue, I may have found a fix: cpatulea@7841daa

Seems other modules take similar flags: https://github.com/cpatulea/gtk-osx-build/blob/7841daaf6fc67ee12da813576c78a3f85274a9df/jhbuildrc-gtk-osx#L500C1-L500C17

cpatulea added a commit to cpatulea/gtk-osx-build that referenced this issue Jan 13, 2024
@totaam
Copy link
Collaborator Author

totaam commented Jan 24, 2024

Finally, it works:

$ jhbuild buildone -f libjpeg
(..)
$ jhbuild shell
(..)
$ otool -L $JHBUILD_PREFIX/lib/libjpeg.dylib
/Users/totaam/gtk/inst/lib/libjpeg.dylib:
	/Users/totaam/gtk/inst/lib/libjpeg.62.dylib (compatibility version 62.0.0, current version 62.4.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

Thanks @cpatulea !

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

No branches or pull requests

2 participants