Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#60169 closed defect (wontfix)

meson PortGroup: warn if universal build and llvm-ar exists

Reported by: kencu (Ken) Owned by: SoapZA
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cooljeanius (Eric Gallager)
Port: meson

Description (last modified by kencu (Ken))

meson will not build projects +universal if llvm-ar is found in the PATH

originally noted with at-spi2-atk but not specific to that port.

A possible solution could be in meson PG, to test for a universal build and file test for ${prefix}/bin/llvm-ar and generate an error or warning if it exists.

This only happens if someone has selected an llvm as the default.

If there is no advantage ever on Darwin to use llvm-ar (and I suspect that perhaps there is not, as our cctools ar has all we need in that area I believe) then we can just patch meson to stop looking for llvm-ar at all (which is, in fact, quite a bit easier).

Attachments (1)

at-spi2-atk-fail-universal.log (14.9 KB) - added by kencu (Ken) 5 years ago.

Download all attachments as: .zip

Change History (17)

Changed 5 years ago by kencu (Ken)

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

I am still not sure how to make meson / ninja output full build lines instead of these little summary lines, so I don't exactly know what instructions are being used to build the static library.

I remember something about static libraries being sent to libtool to build. I can't tell if that is happening here or not ...but if it is libtool, perhaps that is relevant.

comment:2 in reply to:  1 Changed 5 years ago by jmroot (Joshua Root)

Replying to kencu:

I am still not sure how to make meson / ninja output full build lines instead of these little summary lines

It looks like running ninja -v is the only way.

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

Oh -- maybe I can stick that in the build.pre_args or something.... thanks.

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

That worked, Josh. Maybe we should add something like this to the meson PortGroup and perhaps wherever ninja is called:

build.pre_args-prepend -v

here's the scoop on this port:

Found ninja-1.10.0 at /opt/local/bin/ninja
--->  Building at-spi2-atk
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_gnome_at-spi2-atk/at-spi2-atk/work/build" && /opt/local/bin/ninja -j4 -v 
[1/74] /opt/local/bin/clang-mp-9.0 -Idroute/8dce163@@droute@sta -Idroute -I../at-spi2-atk-2.34.2/droute -I. -I../at-spi2-atk-2.34.2/ -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -D_DEFAULT_SOURCE -DATK_DISABLE_DEPRECATION_WARNINGS -Os -arch x86_64 -arch i386 -MD -MQ 'droute/8dce163@@droute@sta/droute-pairhash.c.o' -MF 'droute/8dce163@@droute@sta/droute-pairhash.c.o.d' -o 'droute/8dce163@@droute@sta/droute-pairhash.c.o' -c ../at-spi2-atk-2.34.2/droute/droute-pairhash.c
[2/74] /opt/local/bin/clang-mp-9.0 -Idroute/8dce163@@droute@sta -Idroute -I../at-spi2-atk-2.34.2/droute -I. -I../at-spi2-atk-2.34.2/ -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -D_DEFAULT_SOURCE -DATK_DISABLE_DEPRECATION_WARNINGS -Os -arch x86_64 -arch i386 -MD -MQ 'droute/8dce163@@droute@sta/droute-variant.c.o' -MF 'droute/8dce163@@droute@sta/droute-variant.c.o.d' -o 'droute/8dce163@@droute@sta/droute-variant.c.o' -c ../at-spi2-atk-2.34.2/droute/droute-variant.c
[3/74] /opt/local/bin/clang-mp-9.0 -Idroute/8dce163@@droute-test@exe -Idroute -I../at-spi2-atk-2.34.2/droute -I. -I../at-spi2-atk-2.34.2/ -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include/at-spi-2.0 -I/opt/local/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -D_DEFAULT_SOURCE -DATK_DISABLE_DEPRECATION_WARNINGS -Os -arch x86_64 -arch i386 -MD -MQ 'droute/8dce163@@droute-test@exe/droute-test.c.o' -MF 'droute/8dce163@@droute-test@exe/droute-test.c.o.d' -o 'droute/8dce163@@droute-test@exe/droute-test.c.o' -c ../at-spi2-atk-2.34.2/droute/droute-test.c
[4/74] /opt/local/bin/clang-mp-9.0 -Idroute/8dce163@@droute@sta -Idroute -I../at-spi2-atk-2.34.2/droute -I. -I../at-spi2-atk-2.34.2/ -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -D_DEFAULT_SOURCE -DATK_DISABLE_DEPRECATION_WARNINGS -Os -arch x86_64 -arch i386 -MD -MQ 'droute/8dce163@@droute@sta/droute.c.o' -MF 'droute/8dce163@@droute@sta/droute.c.o.d' -o 'droute/8dce163@@droute@sta/droute.c.o' -c ../at-spi2-atk-2.34.2/droute/droute.c
[5/74] rm -f droute/libdroute.a && llvm-ar csrD droute/libdroute.a 'droute/8dce163@@droute@sta/droute.c.o' 'droute/8dce163@@droute@sta/droute-variant.c.o' 'droute/8dce163@@droute@sta/droute-pairhash.c.o'
[6/74] /opt/local/bin/clang-mp-9.0  -o droute/droute-test 'droute/8dce163@@droute-test@exe/droute-test.c.o' -L/opt/local/lib -Wl,-dead_strip_dylibs -Wl,-undefined,error -Wl,-headerpad_max_install_names -pipe -Os -arch x86_64 -arch i386 -Wl,-headerpad_max_install_names -arch x86_64 -arch i386 droute/libdroute.a /opt/local/lib/libglib-2.0.dylib /opt/local/lib/libintl.dylib -Wl,-framework -Wl,CoreFoundation /opt/local/lib/libdbus-1.dylib /opt/local/lib/libatspi.dylib -Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreFoundation -Wl,-headerpad_max_install_names -Wl,-rpath,@loader_path/ -Wl,-rpath,/opt/local/lib
FAILED: droute/droute-test 
/opt/local/bin/clang-mp-9.0  -o droute/droute-test 'droute/8dce163@@droute-test@exe/droute-test.c.o' -L/opt/local/lib -Wl,-dead_strip_dylibs -Wl,-undefined,error -Wl,-headerpad_max_install_names -pipe -Os -arch x86_64 -arch i386 -Wl,-headerpad_max_install_names -arch x86_64 -arch i386 droute/libdroute.a /opt/local/lib/libglib-2.0.dylib /opt/local/lib/libintl.dylib -Wl,-framework -Wl,CoreFoundation /opt/local/lib/libdbus-1.dylib /opt/local/lib/libatspi.dylib -Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreFoundation -Wl,-headerpad_max_install_names -Wl,-rpath,@loader_path/ -Wl,-rpath,/opt/local/lib
ld: warning: ignoring file droute/libdroute.a, file was built for archive which is not the architecture being linked (x86_64): droute/libdroute.a
Undefined symbols for architecture x86_64:
  "_droute_add_one", referenced from:
      _main in droute-test.c.o
  "_droute_new", referenced from:
      _main in droute-test.c.o
  "_droute_path_add_interface", referenced from:
      _main in droute-test.c.o
  "_droute_path_register", referenced from:
      _main in droute-test.c.o
ld: symbol(s) not found for architecture x86_64

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

changing the ar to cctools fixed the universal build without using the muniversal PG.

configure.env-append AR=/opt/local/bin/ar

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

I had previously done this : sudo port select llvm mp-llvm-7.0

It turns out that the llvm-7.0 I had installed was not universal.

Deselcting any llvm like this sudo port select llvm none also fixes the universal build.

It appears that llvm-ar is being found if present, and the build errors out. If llvm-ar is not found, meson falls back to ar it seems, and that works.

note:

[5/74] rm -f droute/libdroute.a && llvm-ar csrD droute/libdroute.a 'droute/8dce163@@droute@sta/droute.c.o' 'droute/8dce163@@droute@sta/droute-variant.c.o' 'droute/8dce163@@droute@sta/droute-pairhash.c.o'

vs

[5/74] rm -f droute/libdroute.a && ar csr droute/libdroute.a 'droute/8dce163@@droute@sta/droute.c.o' 'droute/8dce163@@droute@sta/droute-variant.c.o' 'droute/8dce163@@droute@sta/droute-pairhash.c.o'

I had thought that selecting an llvm that was installed +universal might work, but surprisingly to me, it still errored out, so perhaps there is more sleuthing to do to see why that failed.

For now, having an llvm-ar of any kind on the PATH seems to cause universal builds to fail.

Last edited 5 years ago by kencu (Ken) (previous) (diff)

comment:7 Changed 5 years ago by dbevans (David B. Evans)

@kencu, I'm not sure whether this is a problem with at-spi2-atk and what exactly the fix might be. If you could submit a PR when you know what to do, I'd appreciate it.

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

I agree -- not sure either -- so long as the user does not sudo port select any llvm version, things should be OK.

Forcing the AR to always be the cctools AR for meson builds is perhaps the proper fix, but ... what ... would we do that generally for meson always, or port-by-port ... ?

I'm inclined to just perhaps file this under "weirdness" and see if it affects anyone else before acting on it...

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

Description: modified (diff)
Owner: changed from dbevans to SoapZA
Port: meson added; at-spi2-atk removed
Summary: at-spi2-atk @2.34.2 will no longer build +universalmeson will not build +universal if llvm-ar is found in the PATH

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

Summary: meson will not build +universal if llvm-ar is found in the PATHmeson will not build projects +universal if llvm-ar is found in the PATH

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

So meson specifically and purposefully will seek out llvm-ar and use it in general to support LTO and other enhancements.

But on macOS our cctools port provides an ar that does support LTO and also +universal I believe, and I think we should never seek out llvm-ar and use it.

If this turns out to be robustly true, then it's a simple patch in meson to stop looking for llvm-ar in the PATH.

Still this issue will only arise if the user has specifically made llvm-ar show up in the PATH, most likely by using sudo port select llvm SOMELLVM to do so, and then tries to build +universal.

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:12 Changed 4 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

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

this bit me yet again in #61686

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

Description: modified (diff)
Summary: meson will not build projects +universal if llvm-ar is found in the PATHmeson PortGroup: warn if universal build and llvm-ar exists

comment:15 Changed 3 years ago by kencu (Ken)

Resolution: wontfix
Status: assignedclosed

I'm not planning to fix this any longer.

comment:16 in reply to:  5 Changed 3 years ago by barracuda156

Replying to kencu:

changing the ar to cctools fixed the universal build without using the muniversal PG.

configure.env-append AR=/opt/local/bin/ar

Doesn't seem to work for building llvm-3.3, which fails universal due to AR: https://trac.macports.org/ticket/64253

Note: See TracTickets for help on using tickets.