MacOS 2.99 .gir files and .typelib files generated with incorrect library locations
Environment/Versions
- GIMP version: 2.99.8 and
master
- Package:
gimp-macos-build
- Operating System: macOS
Description of the bug
During the MacOS build, all binaries, including .dylib
s are linked with their dependencies having the full build path embedded in them. During the packaging phase, all the fully qualified paths are fixed up with @rpath/dylib_name.dylib
so that they can be found inside the MacOS application package.
This same fixup needs to happen for .gir
and .typelib
files.
However, though this should be straightforward for .gir
files, they are XML, there is no provided tool to fix up .typelib
files (MacOS provides otool
and install_name_tool
for .dylib
files).
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Build Gimp 2.99 on one mac
- After building Gimp, change the location of the hard coded files by executing
$ mv ~/gtk/inst ~/gtk/inst.unreachable
and then run Gimp on the build machine. Alternatively, run Gimp 2.99 on another mac.
…
Expected result: .dylib
files in .typelib
files are found correctly.
Actual result: dylib
files fail to load with the dlopen
call including an absolute path from the build machine.
Additional information
This is the specific error:
gi._error.GError: g-invoke-error-quark: Could not locate g_option_error_quark: dlopen(/Users/lukasoberhuber/gtk/inst/lib/libglib-2.0.0.dylib, 9): image not found (1)
This is the full trace:
** (process:88380): WARNING **: 11:07:37.349: Failed to load shared library '/Users/lukasoberhuber/gtk/inst/lib/libglib-2.0.0.dylib' referenced by the typelib: dlopen(/Users/lukasoberhuber/gtk/inst/lib/libglib-2.0.0.dylib, 9): image not found
Traceback (most recent call last):
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/gimp/2.99/plug-ins/colorxhtml/colorxhtml.py", line 26, in <module>
from gi.repository import Gimp
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/importer.py", line 144, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/importer.py", line 144, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/importer.py", line 144, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/importer.py", line 144, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/importer.py", line 144, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/importer.py", line 144, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/importer.py", line 145, in load_module
dynamic_module = load_overrides(introspection_module)
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/overrides/__init__.py", line 118, in load_overrides
override_mod = importlib.import_module(override_package_name)
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/overrides/GLib.py", line 37, in <module>
from gi import _option as option
File "/Users/lukasoberhuber/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/python3.9/site-packages/gi/_option.py", line 40, in <module>
OPTION_CONTEXT_ERROR_QUARK = GLib.quark_to_string(GLib.option_error_quark())
gi._error.GError: g-invoke-error-quark: Could not locate g_option_error_quark: dlopen(/Users/lukasoberhuber/gtk/inst/lib/libglib-2.0.0.dylib, 9): image not found (1)