Opened 6 years ago

Closed 4 years ago

#56932 closed defect (fixed)

at-spi2-core @2.28.0 fails to build on Mac OS X 10.4.11 due to issues with -rpath in meson

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.5.3
Keywords: tiger Cc: devans@…
Port: at-spi2-core

Description

/opt/local/include/glib-2.0/gobject/gobject.h:725: warning: value computed is not used
g-ir-scanner: link: /opt/local/bin/gcc-apple-4.2 -arch ppc -o /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_gnome_at-spi2-core/at-spi2-core/work/build/tmp-introspectEtuyJ0/Atspi-2.0 /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_gnome_at-spi2-core/at-spi2-core/work/build/tmp-introspectEtuyJ0/Atspi-2.0.o -L. -latspi -ldbus-1 -lgobject-2.0 -lglib-2.0 -lintl -lX11 -lXtst -lXi -L/opt/local/lib -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -Wl,-framework -Wl,CoreFoundation
[48/53] Compiling C object 'registryd/registryd@@at-spi2-registryd@exe/event-source.c.o'.
[49/53] Compiling C object 'registryd/registryd@@at-spi2-registryd@exe/ucs2keysym.c.o'.
In file included from /opt/local/include/glib-2.0/gobject/gbinding.h:29,
                 from /opt/local/include/glib-2.0/glib-object.h:23,
                 from ../at-spi2-core-2.28.0/registryd/registry.h:28,
                 from ../at-spi2-core-2.28.0/registryd/deviceeventcontroller.h:34,
                 from ../at-spi2-core-2.28.0/registryd/ucs2keysym.c:35:
/opt/local/include/glib-2.0/gobject/gobject.h: In function 'g_set_object':
/opt/local/include/glib-2.0/gobject/gobject.h:725: warning: value computed is not used
[50/53] Linking target registryd/at-spi2-registryd.
FAILED: registryd/at-spi2-registryd 
/opt/local/bin/gcc-apple-4.2  -o registryd/at-spi2-registryd 'registryd/registryd@@at-spi2-registryd@exe/de-marshaller.c.o' 'registryd/registryd@@at-spi2-registryd@exe/registry-main.c.o' 'registryd/registryd@@at-spi2-registryd@exe/registry.c.o' 'registryd/registryd@@at-spi2-registryd@exe/introspection.c.o' 'registryd/registryd@@at-spi2-registryd@exe/deviceeventcontroller.c.o' 'registryd/registryd@@at-spi2-registryd@exe/reentrant-list.c.o' 'registryd/registryd@@at-spi2-registryd@exe/deviceeventcontroller-x11.c.o' 'registryd/registryd@@at-spi2-registryd@exe/display.c.o' 'registryd/registryd@@at-spi2-registryd@exe/event-source.c.o' 'registryd/registryd@@at-spi2-registryd@exe/ucs2keysym.c.o' -L/opt/local/lib -Wl,-dead_strip_dylibs -pipe -Os -arch ppc -Wl,-headerpad_max_install_names -arch ppc atspi/libatspi.0.dylib /opt/local/lib/libgio-2.0.dylib /opt/local/lib/libgobject-2.0.dylib /opt/local/lib/libglib-2.0.dylib /opt/local/lib/libintl.dylib -Wl,-framework -Wl,CoreFoundation /opt/local/lib/libdbus-1.dylib -Wl,-framework -Wl,CoreFoundation -ldl /opt/local/lib/libX11.dylib /opt/local/lib/libXtst.dylib /opt/local/lib/libXi.dylib '-Wl,-rpath,$ORIGIN/../atspi'  
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
[51/53] Generating Atspi-2.0.typelib with a custom command.
ninja: build stopped: subcommand failed.
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_gnome_at-spi2-core/at-spi2-core/work/build" && /opt/local/bin/ninja 
Exit code: 1

This case has some similarities with #56729, in which ${prefix}/lib/gobject-introspection/giscanner/ccompiler.py is the culprit. I commented all lines with -rpath in this file in order to build poppler. So it must be Ninja that is misconfigured to use -rpath on Tiger.

Attachments (1)

main.log (45.9 KB) - added by ballapete (Peter "Pete" Dyballa) 6 years ago.
Main.log from PPC Tiger

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger

comment:1 Changed 6 years ago by kencu (Ken)

I believe the issue here is really with meson, which uses rpath by default on macOS now. I have edited the meson files manually as below, commenting out the noted lines that add rpath commands, and so far it seems to be working on Tiger. It's a hack at present, no doubt about it, but I think it's possible that we might come up with something elegant enough to have a patch for, even if it is unlikely to ever be accepted upstream given the age and penetration of Tiger.

Notice there are a couple of control variables in meson, build_rpath and include_rpath that might possibly be manipulated to allow Tiger to work without these hacks.

Somehow, these ports still find their link libraries when installed -- I think the final stage of the meson install on macOS puts in normal, real link names to the libraries.

Another approach might be to modify ld64 to ignore the rpath commands on Tiger rather than erroring out when they are found -- might work -- I don't know yet what downsides we might discover if we did that.

$ port -v installed meson
The following ports are currently installed:
  meson @0.47.1_0 (active) platform='darwin 8' archs='noarch' date='2018-08-19T08:00:42-0700'

$ pwd
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild

$ ag KEN .
compilers/compilers.py

995:        #KEN abs_rpaths = [os.path.join(build_dir, p) for p in rpath_paths]
996:        #KEN if build_rpath != '':
997:        #KEN    abs_rpaths.append(build_rpath)
1000:        #KEN args += ['-Wl,-rpath,' + rp for rp in abs_rpaths]
1036:        #KEN in the runtime path will be undefined and any binariesargs.append('-Wl,-rpath,' + paths)

modules/gnome.py
305:                #KEN if include_rpath:
306:                #KEN    link_command.append('-Wl,-rpath,' + d)
307:            #KEN if include_rpath:
308:            #KEN    link_command.append('-Wl,-rpath,' + libdir)
358:#KEN                        if include_rpath:
359:#KEN                            external_ldflags.update(['-Wl,-rpath {}'.format(lib_dir)])
Last edited 6 years ago by kencu (Ken) (previous) (diff)

comment:2 Changed 6 years ago by kencu (Ken)

Summary: at-spi2-core @2.28.0 fails to build on PPC Tiger, Mac OS X 10.4.11, because of issue with -rpathat-spi2-core @2.28.0 fails to build on Mac OS X 10.4.11 due to issues with -rpath in meson

comment:3 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

The recent version of meson (@0.49.0_0) is a bit different then the files Ken found in summer. Since I can understand Python a bit but are not able to write it, I chose a very simple and working and just working patch:

diff -u /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/compilers/compilers.py-orig /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/compilers/compilers.py
--- /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/compilers/compilers.py-orig	2018-12-09 15:27:23.000000000 +0100
+++ /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/compilers/compilers.py	2018-12-28 20:48:06.000000000 +0100
@@ -1194,22 +1194,6 @@
             # linked against local libraries will fail to resolve them.
             args.append('-Wl,-z,origin')
 
-        if mesonlib.is_osx():
-            # macOS does not support colon-separated strings in LC_RPATH,
-            # hence we have to pass each path component individually
-            args += ['-Wl,-rpath,' + rp for rp in all_paths]
-        else:
-            # In order to avoid relinking for RPATH removal, the binary needs to contain just
-            # enough space in the ELF header to hold the final installation RPATH.
-            paths = ':'.join(all_paths)
-            if len(paths) < len(install_rpath):
-                padding = 'X' * (len(install_rpath) - len(paths))
-                if not paths:
-                    paths = padding
-                else:
-                    paths = paths + ':' + padding
-            args.append('-Wl,-rpath,' + paths)
-
         if get_compiler_is_linuxlike(self):
             # Rpaths to use while linking must be absolute. These are not
             # written to the binary. Needed only with GNU ld:

-rpath is not needed in my version of osx. And here is no alternative OS running. So I can do both: remove the osx case and not care of the else clause.

Using this patched version of meson allowed to build at-spi2-core @2.28.0_0. When ImageMagick will be built I'll try to figure out a patch. Or way to patch.

comment:4 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

I don't know how to integrate the additional patch step for Tiger, but I can describe how it works with ed – I think this is most reliable.

My algorithm is this:

· search forward for the characteristic string argument '-Wl,-rpath,'

· search backward for the characteristic start of if clause if mesonlib.is_osx(): (or empty line and then go down one line with +?)

· mark the line found

· search forward for the first empty line (I think this tells the Python interpreter the end of the if clause)

· now delete from the marked line until here all lines

· write back into the file the edited contents and quit

So the ed script looks simple like this:

/'-Wl,-rpath,'
?if mesonlib.is_osx():
ka
/^$
'a,.d
wq

It can be applied à la

ed compilers.py < compilers/compilers.ed

or inline à la

printf "/'-Wl,-rpath,'\n?if mesonlib.is_osx():\nka\n/^$\n'a,.d\nwq\n" | ed compilers/compilers.py

Presumingly this is the preferred way…

diff shows this difference between original file and patched file:

@@ -1194,22 +1194,6 @@
             # linked against local libraries will fail to resolve them.
             args.append('-Wl,-z,origin')
 
-        if mesonlib.is_osx():
-            # macOS does not support colon-separated strings in LC_RPATH,
-            # hence we have to pass each path component individually
-            args += ['-Wl,-rpath,' + rp for rp in all_paths]
-        else:
-            # In order to avoid relinking for RPATH removal, the binary needs to contain just
-            # enough space in the ELF header to hold the final installation RPATH.
-            paths = ':'.join(all_paths)
-            if len(paths) < len(install_rpath):
-                padding = 'X' * (len(install_rpath) - len(paths))
-                if not paths:
-                    paths = padding
-                else:
-                    paths = paths + ':' + padding
-            args.append('-Wl,-rpath,' + paths)
-
         if get_compiler_is_linuxlike(self):
             # Rpaths to use while linking must be absolute. These are not
             # written to the binary. Needed only with GNU ld:

comment:5 Changed 4 years ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In 581a5bc25e8112c7586aa6415e020706c1ca7518/macports-ports (master):

at-spi2-core: workaround no rpath on Tiger

meson uses @rpaths but Tiger does not support them.
This workaround allows the dylibs to be found by
gobject-introspection during installation

closes: #56932
closes: #61311

Note: See TracTickets for help on using tickets.