Opened 4 years ago

Closed 4 years ago

#62095 closed defect (duplicate)

Poppler should no longer use flag -macho as newer llvms will not accept it.

Reported by: szhorvat (Szabolcs Horvát) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc: devans@…
Port: poppler

Description

The 'poppler' port fails to build.

I am on macOS 10.14.6 with Xcode 11.3.1.

The log file is attached.

Attachments (1)

main.log (692.2 KB) - added by szhorvat (Szabolcs Horvát) 4 years ago.

Download all attachments as: .zip

Change History (18)

Changed 4 years ago by szhorvat (Szabolcs Horvát)

Attachment: main.log added

comment:1 Changed 4 years ago by michaelld (Michael Dickens)

Resolution: duplicate
Status: newclosed

You're running into a known cctoools bug. Please try the following:

sudo port install cctools +xcode
sudo port clean poppler
sudo port install poppler

Duplicate of #61967

comment:2 Changed 4 years ago by michaelld (Michael Dickens)

If the above fails, please reopen this ticket and note the new build log based off of cctools +xcode.

comment:3 Changed 4 years ago by szhorvat (Szabolcs Horvát)

This did indeed work, but I'm confused: I already had the +xcode variant installed. So what did sudo port install cctools +xcode accomplish them?

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

actually, it's officially a poppler bug now, because -macho is no longer a valid flag to use (but older llvm's still accept it).

comment:5 in reply to:  3 Changed 4 years ago by kencu (Ken)

Replying to szhorvat:

This did indeed work, but I'm confused: I already had the +xcode variant installed. So what did sudo port install cctools +xcode accomplish them?

now that is a puzzle....if you can reproduce it, perhaps we can sort out that voodoo.

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

Resolution: duplicate
Status: closedreopened
Summary: Poppler fails to buildPoppler should no longer use flag -macho as newer llvms will not accept it.

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

but --which software exactly is adding the flag? poppler, or go-i?

comment:8 Changed 4 years ago by michaelld (Michael Dickens)

... or neither? doing a quick "grep" on the source for "macho" shows nothing. I'm guessing this is in the scanner & it's coming from some Python import. Let me do some sleuthing ...

comment:9 Changed 4 years ago by michaelld (Michael Dickens)

"source" here being both GO-I and Poppler ... which is why I think flag is being added in elsewhere ...

comment:10 Changed 4 years ago by michaelld (Michael Dickens)

Adding -v to the system call to clang, I see this:

:info:build g-ir-scanner: link: /usr/bin/clang -arch x86_64 -o /opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib/tmp-introspect2qnikau5/Poppler-0.18 -v /opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib/tmp-introspect2qnikau5/Poppler-0.18.o -L. -Wl,-rpath,. -L/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build -Wl,-rpath,/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build -L/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib -Wl,-rpath,/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib -lpoppler-glib -lpoppler -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -Wl,-framework -Wl,CoreFoundation
:info:build Apple clang version 12.0.0 (clang-1200.0.32.28)
:info:build Target: x86_64-apple-darwin20.3.0
:info:build Thread model: posix
:info:build InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
:info:build llvm-objdump: Unknown command line argument '-macho'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
:info:build llvm-objdump: Did you mean '-h'?
:info:build llvm-objdump: Unknown command line argument '-dylibs-used'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
:info:build llvm-objdump: Did you mean '--dylibs-used'?
:info:build llvm-objdump: Unknown command line argument '-non-verbose'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
:info:build llvm-objdump: Did you mean '--non-verbose'?
:info:build Traceback (most recent call last):
:info:build   File "/opt/local/bin/g-ir-scanner", line 99, in <module>
:info:build     sys.exit(scanner_main(sys.argv))
...

There is no -macho in the command call. Might be in the call environment ... looking into that.

comment:11 Changed 4 years ago by michaelld (Michael Dickens)

OK some progress!

(0) make sure you have cctools +llvm11 installed.

(1) Add this to the Portfile for GO-I or poppler: build.env-append "GI_SCANNER_DEBUG=save-temps"

(2) issue sudo port build poppler or GO-I etc... it should fail during a GO-I scan

(3) review the log for the otool -L command being issued; for example here's the one from 'poppler' that I see

:info:build Caught exception: <class 'subprocess.CalledProcessError'> CalledProcessError(1, ['otool', '-L', '/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib/tmp-introspectdnhi97mq/Poppler-0.18'])

(4) reform and issue this command directly; from my (3) I'd do:

otool -L /opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib/tmp-introspectdnhi97mq/Poppler-0.18

which for me results in the following:

llvm-objdump: Unknown command line argument '-macho'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
llvm-objdump: Did you mean '-h'?
llvm-objdump: Unknown command line argument '-dylibs-used'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--dylibs-used'?
llvm-objdump: Unknown command line argument '-non-verbose'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--non-verbose'?

(5) now do sudo port install cctools +xcode to load up a different otool

(6) reissue the command from (4), which now for me does:

otool -L /opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib/tmp-introspectdnhi97mq/Poppler-0.18
/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib/tmp-introspectdnhi97mq/Poppler-0.18:
	/opt/local/lib/libpoppler-glib.8.dylib (compatibility version 8.0.0, current version 8.19.0)
	/opt/local/lib/libpoppler.105.dylib (compatibility version 105.0.0, current version 105.0.0)
	/opt/local/lib/libgio-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
	/opt/local/lib/libgobject-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
	/opt/local/lib/libgmodule-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
	/opt/local/lib/libglib-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
	/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)

This implies to me that the issue is actually with cctools and/or llvm here, since the exact same command using different variants of cctools results in success or failure.

comment:12 Changed 4 years ago by michaelld (Michael Dickens)

Quick note that otool for variant +xcode is provided by Xcode while that for +llvm11 is provided directly by cctools ... so guessing that there's some change in how otool calls objdump between llvm10 and llvm11, since the former works but the latter doesn't, at least in this regard.

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

yes, they changed the accepted flag between those two.

The exact commit is referenced in one of these tickets, if that is of any interest, but there's nothing fancy in the commit: just "we don't accept -macho anymore".

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

Soon, that will flow into xcode, and xcode's llvm-objdump won't accept it either, unless Apple's fork keeps it patched to accept the flag for a few years (which is what I would do -- I"m not sure what amount of OCD behaviour led them to decide to start rejecting the flag anyway, and cause all this heartache for no visible benefit -- but I digress).

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

comment:15 Changed 4 years ago by michaelld (Michael Dickens)

looking at the cctools code in cctools-927.0.2/otool/main.c, line 80 reads:

enum bool show_objdump_command = FALSE; /* print the objdump command */

change this to TRUE; build and install. then run the otool command again:

+ /opt/local/bin/llvm-objdump-mp-11 -macho -dylibs-used -non-verbose /opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_graphics_poppler/poppler/work/build/glib/tmp-introspectdnhi97mq/Poppler-0.18
llvm-objdump: Unknown command line argument '-macho'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
llvm-objdump: Did you mean '-h'?
llvm-objdump: Unknown command line argument '-dylibs-used'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--dylibs-used'?
llvm-objdump: Unknown command line argument '-non-verbose'.  Try: '/opt/local/libexec/llvm-11/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--non-verbose'?

... so ... this is a cctools issue, not GO-I or poppler.

comment:16 Changed 4 years ago by michaelld (Michael Dickens)

So this is a duplicate of #61967 ... and that ticket's topic is correct / relevant. How about let's close this in favor of just that other ticket?

comment:17 Changed 4 years ago by michaelld (Michael Dickens)

Resolution: duplicate
Status: reopenedclosed
Note: See TracTickets for help on using tickets.