Opened 4 years ago

Closed 4 years ago

#61137 closed defect (fixed)

glib2 @2.58.3 +universal+x11: compile error: unterminated conditional directive (clang version?)

Reported by: JDLH (Jim DeLaHunt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc: dbevans (David B. Evans)
Port: glib2

Description (last modified by ryandesign (Ryan Carsten Schmidt))

When updating glib2 to @2.58.3 +universal+x11 on macOS 10.13.6 High Sierra, the compile of gclosure.c failed. The relevant part of the main.log reads,

:info:build In file included from gclosure.c:28:
:info:build /opt/local/include/ffi.h:44:2: error: unterminated conditional directive
:info:build #ifndef LIBFFI_H
:info:build  ^
:info:build In file included from gclosure.c:1160:
:info:build /opt/local/include/ffi.h:44:2: error: unterminated conditional directive
:info:build #ifndef LIBFFI_H
:info:build  ^

Full main.log attached.

/opt/local/include/ffi.h is provided by: libffi (per port provides).

The glib2 Portfile changed on Sep 5, 2020 with commit bd5d680 "ports that link with libffi: rebuild with libffi 3.3". It looks like just the revision number incremented, to force a rebuild.

The libffi Portfile changed on Sept 4, 2020 with commit 81c3c7d "libffi: Fix universal variant". As far as I can tell, this did not changed the contents of ffi.h.

The error message, "unterminated conditional directive", is mentioned in several bug reports. Many of those reports point to https://github.com/Sarcasm/flycheck-irony/issues/20, where it is described as a bug in LLVM, fixed in January 2018. Maybe that fix does not propagate back to macOS 10.13 High Sierra?

Attachments (1)

main.log (363.4 KB) - added by JDLH (Jim DeLaHunt) 4 years ago.
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/main.log

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by JDLH (Jim DeLaHunt)

Attachment: main.log added

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/main.log

comment:1 in reply to:  description Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

Replying to JDLH:

The libffi Portfile changed on Sept 4, 2020 with commit 81c3c7d "libffi: Fix universal variant". As far as I can tell, this did not changed the contents of ffi.h.

It should have changed the contents of /opt/local/include/ffi.h to just:

#ifndef __LP64__
#include "i386-ffi.h"
#else
#include "x86_64-ffi.h"
#endif

The error you reported is the reason why I made that change now, and the reason why we had made the original equivalent change for previous libffi versions long ago (see #31459 and #25439), and it fixed the problem for me.

The error message, "unterminated conditional directive", is mentioned in several bug reports. Many of those reports point to https://github.com/Sarcasm/flycheck-irony/issues/20, where it is described as a bug in LLVM, fixed in January 2018. Maybe that fix does not propagate back to macOS 10.13 High Sierra?

No idea. There could be any number of reasons why the muniversal portgroup merger is unable to merge a file successfully. I haven't attempted to analyze why it is unable to merge ffi.h or whether the problem is the one described in the link you mentioned.

comment:2 Changed 4 years ago by JDLH (Jim DeLaHunt)

My /opt/local/include/ffi.h has a lot more than those 5 lines:

g% wc -l /opt/local/include/ffi.h
     520 /opt/local/include/ffi.h

The lines around the test for __LP64__ are:

[… snip …]
#ifndef LIBFFI_H
#define LIBFFI_H

#ifdef __cplusplus
extern "C" {
#endif

/* Specify which architecture libffi is configured for. */
#ifndef __LP64__
#ifndef X86_DARWIN
#define X86_DARWIN
#else
#ifndef X86_64
#define X86_64
#endif
#endif
[… snip …]

So that looks a lot different than the excerpt you posted.

comment:3 Changed 4 years ago by JDLH (Jim DeLaHunt)

I just selfupdated, and MacPorts offered me libffi @3.3_1 +universal. I installed that, and ffi.h is now a lot smaller.

% wc -l /opt/local/include/ffi.h 
       5 /opt/local/include/ffi.h

% cat /opt/local/include/ffi.h
#ifndef __LP64__
#include "i386-ffi.h"
#else
#include "x86_64-ffi.h"
#endif

And with that, glib2 @2.58.3_1+universal+x11 builds just fine.

Problem solved, it looks like! Thank you.

comment:4 Changed 4 years ago by JDLH (Jim DeLaHunt)

Ah, a little problem. When I installed glib2, MacPorts wanted to run port rev-upgrade. The rev-upgrade of gobject-introspection @1.60.2+universal failed.

% sudo port install glib2 +universal+x11
--->  Computing dependencies for glib2
--->  Fetching archive for glib2
--->  Attempting to fetch glib2-2.58.3_1+universal+x11.darwin_17.i386-x86_64.tbz2 from https://packages.macports.org/glib2
--->  Attempting to fetch glib2-2.58.3_1+universal+x11.darwin_17.i386-x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/glib2/glib2
--->  Attempting to fetch glib2-2.58.3_1+universal+x11.darwin_17.i386-x86_64.tbz2 from https://kmq.jp.packages.macports.org/glib2
--->  Building glib2
--->  Staging glib2 into destroot
--->  Installing glib2 @2.58.3_1+universal+x11
--->  Activating glib2 @2.58.3_1+universal+x11
--->  Cleaning glib2
--->  Scanning binaries for linking errors
--->  Found 19 broken files, matching files to ports     
--->  Found 9 broken ports, determining rebuild order
You can always run 'port rev-upgrade' again to fix errors.
The following ports will be rebuilt:
 gobject-introspection @1.60.2+universal
 py27-gobject @2.28.7+x11
 py27-gobject3 @3.36.1
 py36-gobject3 @3.36.1
 py37-gobject3 @3.36.1
 py38-gobject3 @3.36.1
 llvm-8.0 @8.0.1
 llvm-9.0 @9.0.1
 rust @1.46.0
Continue? [Y/n]: y
--->  Computing dependencies for gobject-introspection
--->  Fetching archive for gobject-introspection
--->  Attempting to fetch gobject-introspection-1.60.2_1+universal.darwin_17.i386-x86_64.tbz2 from https://packages.macports.org/gobject-introspection
--->  Attempting to fetch gobject-introspection-1.60.2_1+universal.darwin_17.i386-x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/gobject-introspection/gobject-introspection
--->  Attempting to fetch gobject-introspection-1.60.2_1+universal.darwin_17.i386-x86_64.tbz2 from https://kmq.jp.packages.macports.org/gobject-introspection
--->  Fetching distfiles for gobject-introspection
--->  Verifying checksums for gobject-introspection
--->  Extracting gobject-introspection
--->  Applying patches to gobject-introspection
--->  Configuring gobject-introspection
--->  Building gobject-introspection
Error: Failed to build gobject-introspection: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_gnome_gobject-introspection/gobject-introspection/main.log for details.
Error: rev-upgrade failed: Error rebuilding gobject-introspection
Error: Follow https://guide.macports.org/#project.tickets to report a bug.

The interesting part of the failure appears to be that the linker was looking for /opt/local/lib/libffi.6.dylib, but all I had was /opt/local/lib/libffi.7.dylib. (Sorry, I worked around the problem, and lost that copy of the log file.)

I blundered around trying workarounds. Upgrading some of the ports apart from gobject-introspection succeeded.

% sudo port upgrade rust                 
--->  Computing dependencies for llvm-9.0
--->  Fetching archive for llvm-9.0
--->  Attempting to fetch llvm-9.0-9.0.1_1.darwin_17.x86_64.tbz2 from https://packages.macports.org/llvm-9.0
--->  Attempting to fetch llvm-9.0-9.0.1_1.darwin_17.x86_64.tbz2.rmd160 from https://packages.macports.org/llvm-9.0
--->  Installing llvm-9.0 @9.0.1_1
--->  Cleaning llvm-9.0
--->  Computing dependencies for llvm-9.0
--->  Deactivating llvm-9.0 @9.0.1_0
--->  Cleaning llvm-9.0
--->  Activating llvm-9.0 @9.0.1_1
--->  Cleaning llvm-9.0
--->  Computing dependencies for rust
--->  Fetching archive for rust
--->  Attempting to fetch rust-1.46.0_1.darwin_17.x86_64.tbz2 from https://packages.macports.org/rust
--->  Attempting to fetch rust-1.46.0_1.darwin_17.x86_64.tbz2.rmd160 from https://packages.macports.org/rust
--->  Installing rust @1.46.0_1
--->  Cleaning rust
--->  Computing dependencies for rust
--->  Deactivating rust @1.46.0_0
--->  Cleaning rust
--->  Activating rust @1.46.0_1
--->  Cleaning rust
--->  Scanning binaries for linking errors
--->  Found 15 broken files, matching files to ports     
--->  Found 7 broken ports, determining rebuild order
You can always run 'port rev-upgrade' again to fix errors.
The following ports will be rebuilt:
 gobject-introspection @1.60.2+universal
 py27-gobject @2.28.7+x11
 py27-gobject3 @3.36.1
 py36-gobject3 @3.36.1
 py37-gobject3 @3.36.1
 py38-gobject3 @3.36.1
 llvm-8.0 @8.0.1
Continue? [Y/n]: n

For some reason, doing this trick on py27-gobject +x11 also repaired gobject-introspection:

% sudo port upgrade py27-gobject +x11
Warning: Skipping upgrade since py27-cairo 1.18.2_0 >= py27-cairo 1.18.2_0, even though installed variants "" do not match "+x11". Use 'upgrade --enforce-variants' to switch to the requested variants.
--->  Computing dependencies for gobject-introspection
--->  Fetching archive for gobject-introspection
--->  Attempting to fetch gobject-introspection-1.60.2_1+universal.darwin_17.i386-x86_64.tbz2 from https://packages.macports.org/gobject-introspection
--->  Attempting to fetch gobject-introspection-1.60.2_1+universal.darwin_17.i386-x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/gobject-introspection/gobject-introspection
--->  Attempting to fetch gobject-introspection-1.60.2_1+universal.darwin_17.i386-x86_64.tbz2 from https://kmq.jp.packages.macports.org/gobject-introspection
--->  Building gobject-introspection
--->  Staging gobject-introspection into destroot
--->  Installing gobject-introspection @1.60.2_1+universal
--->  Cleaning gobject-introspection
--->  Computing dependencies for gobject-introspection
--->  Deactivating gobject-introspection @1.60.2_0+universal
--->  Cleaning gobject-introspection
--->  Activating gobject-introspection @1.60.2_1+universal
--->  Cleaning gobject-introspection
--->  Computing dependencies for py27-gobject
--->  Fetching archive for py27-gobject
--->  Attempting to fetch py27-gobject-2.28.7_1+x11.darwin_17.x86_64.tbz2 from https://packages.macports.org/py27-gobject
--->  Attempting to fetch py27-gobject-2.28.7_1+x11.darwin_17.x86_64.tbz2.rmd160 from https://packages.macports.org/py27-gobject
--->  Installing py27-gobject @2.28.7_1+x11
--->  Cleaning py27-gobject
--->  Computing dependencies for py27-gobject
--->  Deactivating py27-gobject @2.28.7_0+x11
--->  Cleaning py27-gobject
--->  Activating py27-gobject @2.28.7_1+x11
--->  Cleaning py27-gobject
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  Found 4 broken files, matching files to ports      
--->  Found 4 broken ports, determining rebuild order
You can always run 'port rev-upgrade' again to fix errors.
The following ports will be rebuilt:
 py27-gobject3 @3.36.1
 py36-gobject3 @3.36.1
 py37-gobject3 @3.36.1
 py38-gobject3 @3.36.1
Continue? [Y/n]: Y
--->  Computing dependencies for py27-gobject3
[ …snip… ]
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.

So, all's well that ends well? I'm running a port upgrade outdated again.

comment:5 Changed 4 years ago by JDLH (Jim DeLaHunt)

Everything upgraded, albeit with some hiccups. I think this problem is solved for me.

So what was the underlying problem? I think it boils down to, yesterday, I did port upgrade outdated and it upgraded libffi to @3.3_0+universal:

The following installed ports are outdated:
glib2                          2.58.3_0 < 2.58.3_1       
[… snip …]
libffi                         3.2.1_0 < 3.3_0           
[… snip …]
% sudo port upgrade outdated
Password:
--->  Computing dependencies for libffi
--->  Fetching archive for libffi
[… snip …]
--->  Attempting to fetch libffi-3.3_0+universal.darwin_17.i386-x86_64.tbz2 from https://kmq.jp.packages.macports.org/libffi
--->  Fetching distfiles for libffi
--->  Attempting to fetch libffi-3.3.tar.gz from https://distfiles.macports.org/libffi
--->  Verifying checksums for libffi
--->  Extracting libffi
--->  Configuring libffi
--->  Building libffi
--->  Staging libffi into destroot
--->  Installing libffi @3.3_0+universal
--->  Cleaning libffi
--->  Deactivating libffi @3.2.1_0+universal
--->  Cleaning libffi
--->  Activating libffi @3.3_0+universal
--->  Cleaning libffi
--->  Computing dependencies for glib2
--->  Fetching archive for glib2
--->  Attempting to fetch glib2-2.58.3_1+universal+x11.darwin_17.i386-x86_64.tbz2 from https://packages.macports.org/glib2
--->  Attempting to fetch glib2-2.58.3_1+universal+x11.darwin_17.i386-x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/glib2/glib2
--->  Attempting to fetch glib2-2.58.3_1+universal+x11.darwin_17.i386-x86_64.tbz2 from https://kmq.jp.packages.macports.org/glib2
--->  Fetching distfiles for glib2
--->  Verifying checksums for glib2
--->  Extracting glib2
--->  Applying patches to glib2
--->  Configuring glib2
--->  Building glib2
Error: Failed to build glib2: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_glib2/glib2/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.

Today, I did port upgrade outdated and it upgraded libffi to @3.3_1+universal:

% sudo port upgrade outdated and not \( glib2 or rdepends:glib2 \)
Password:
--->  Fetching archive for gnome-user-docs
[… snip …]
--->  Cleaning gnome-user-docs
--->  Computing dependencies for libffi
--->  Fetching archive for libffi
--->  Attempting to fetch libffi-3.3_1+universal.darwin_17.i386-x86_64.tbz2 from https://packages.macports.org/libffi
--->  Attempting to fetch libffi-3.3_1+universal.darwin_17.i386-x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/libffi/libffi
--->  Attempting to fetch libffi-3.3_1+universal.darwin_17.i386-x86_64.tbz2 from https://kmq.jp.packages.macports.org/libffi
--->  Fetching distfiles for libffi
--->  Verifying checksums for libffi
--->  Extracting libffi
--->  Configuring libffi
--->  Building libffi
--->  Staging libffi into destroot
--->  Installing libffi @3.3_1+universal
--->  Cleaning libffi
--->  Deactivating libffi @3.3_0+universal
--->  Cleaning libffi
--->  Activating libffi @3.3_1+universal
--->  Cleaning libffi
[… snip …]

It appears that libffi @3.3_1+universal removed the problem that broke glib2. I don't know why my port upgrade outdated yesterday got @3.3_0 instead of @3.3_1 of libffi.

comment:6 in reply to:  5 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Replying to JDLH:

The interesting part of the failure appears to be that the linker was looking for /opt/local/lib/libffi.6.dylib, but all I had was /opt/local/lib/libffi.7.dylib. (Sorry, I worked around the problem, and lost that copy of the log file.)

The relevant information would be: what program or library was looking for libffi.6.dylib, and the solution would be to upgrade that program or library first.

For example, one possibility might be that you had the cctools port installed with the +llvm90 variant, and the problem was that you hadn't upgraded llvm-9.0 yet.

Replying to JDLH:

It appears that libffi @3.3_1+universal removed the problem that broke glib2.

Yes.

I don't know why my port upgrade outdated yesterday got @3.3_0 instead of @3.3_1 of libffi.

You hadn't run sudo port selfupdate or sudo port sync recently enough prior to that, or the fix had not propagated from our git repository to the rsync server yet (it takes about an hour).

Note: See TracTickets for help on using tickets.