Opened 3 months ago

Last modified 2 months ago

#70228 new defect

expat @2.6.2+universal: syntactically invalid expat-config-version.cmake file

Reported by: RobK88 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: Cc: Veence (Vincent), nilason (Nicklas Larsson), RobK88, Dave-Allured (Dave Allured), cooljeanius (Eric Gallager), TheLastLovemark
Port: expat

Description (last modified by RobK88)

See attached main.log

bash-3.2$ sudo port clean gdal
Password:
--->  Cleaning gdal
bash-3.2$ 
bash-3.2$ 
bash-3.2$ sudo port upgrade gdal configure.compiler=macports-clang-16
--->  Computing dependencies for gdal
--->  Fetching archive for gdal
--->  Attempting to fetch gdal-3.9.0_0+postgresql16+proj9.darwin_11.x86_64.tbz2 from http://packages.macports.org/gdal
--->  Attempting to fetch gdal-3.9.0_0+postgresql16+proj9.darwin_11.x86_64.tbz2 from http://ywg.ca.packages.macports.org/mirror/macports/packages/gdal
--->  Attempting to fetch gdal-3.9.0_0+postgresql16+proj9.darwin_11.x86_64.tbz2 from http://bos.us.packages.macports.org/gdal
--->  Fetching distfiles for gdal
--->  Verifying checksums for gdal
--->  Extracting gdal
--->  Configuring gdal
Error: Failed to configure gdal: configure failure: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gis_gdal/gdal/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
bash-3.2$

Attachments (4)

main.log (43.5 KB) - added by RobK88 3 months ago.
main.log
expat-config-version.cmake (2.9 KB) - added by RobK88 3 months ago.
main.2.log (3.3 MB) - added by RobK88 3 months ago.
Failed Build - main.log
main.3.log (3.3 MB) - added by RobK88 3 months ago.
Failed Build Using Clang-16 - main.log

Change History (21)

Changed 3 months ago by RobK88

Attachment: main.log added

main.log

comment:1 Changed 3 months ago by RobK88

Description: modified (diff)

comment:2 Changed 3 months ago by RobK88

Cc: RobK88 added

comment:3 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

It says the reason is:

CMake Error at /opt/local/lib/cmake/expat-2.6.2/expat-config-version.cmake:66 (if):
  Flow control statements are not properly nested.
Call Stack (most recent call first):
  cmake/helpers/CheckDependentLibraries.cmake:141 (find_package)
  cmake/helpers/CheckDependentLibraries.cmake:359 (gdal_check_package)
  gdal.cmake:266 (include)
  CMakeLists.txt:240 (include)
CMake Warning at cmake/helpers/CheckDependentLibraries.cmake:141 (find_package):
  Could not find a configuration file for package "EXPAT" that is compatible
  with requested version "".
  The following configuration files were considered but not accepted:
    /opt/local/lib/cmake/expat-2.6.2/expat-config.cmake, version: unknown
Call Stack (most recent call first):
  cmake/helpers/CheckDependentLibraries.cmake:359 (gdal_check_package)
  gdal.cmake:266 (include)
  CMakeLists.txt:240 (include)
-- Configuring incomplete, errors occurred!

We did not see this problem on the buildbot. There may be something wrong with your /opt/local/lib/cmake/expat-2.6.2/expat-config-version.cmake. You could attach it here. Is your expat port installed with the universal variant?

comment:4 Changed 3 months ago by RobK88

I will attach my expat-config-version.cmake file.

Yes, I am using the +universal variant of expat.

bash-3.2$ port installed expat
The following ports are currently installed:
  expat @2.5.0_0
  expat @2.6.2_0
  expat @2.6.2_0+universal (active)
bash-3.2$

Changed 3 months ago by RobK88

Attachment: expat-config-version.cmake added

comment:5 Changed 3 months ago by RobK88

I was able to finally configure gdal@3.9.0 when i used the regular non-universal variant if expat. But the port fails at the build stage.

I will attach main.log.

bash-3.2$ sudo port activate expat @2.6.2_0
Password:
--->  Deactivating expat @2.6.2_0+universal
--->  Cleaning expat
--->  Activating expat @2.6.2_0
--->  Cleaning expat
bash-3.2$ 
bash-3.2$ port installed expat
The following ports are currently installed:
  expat @2.5.0_0
  expat @2.6.2_0 (active)
  expat @2.6.2_0+universal
bash-3.2$ 
bash-3.2$ sudo port clean gdal
--->  Cleaning gdal
bash-3.2$ 

bash-3.2$ sudo port upgrade gdal
--->  Computing dependencies for gdal
--->  Fetching archive for gdal
--->  Attempting to fetch gdal-3.9.0_0+postgresql16+proj9.darwin_11.x86_64.tbz2 from http://packages.macports.org/gdal
--->  Attempting to fetch gdal-3.9.0_0+postgresql16+proj9.darwin_11.x86_64.tbz2 from http://ywg.ca.packages.macports.org/mirror/macports/packages/gdal
--->  Attempting to fetch gdal-3.9.0_0+postgresql16+proj9.darwin_11.x86_64.tbz2 from http://bos.us.packages.macports.org/gdal
--->  Fetching distfiles for gdal
--->  Verifying checksums for gdal
--->  Extracting gdal
--->  Configuring gdal
--->  Building gdal                                      
Error: Failed to build gdal: command execution failed    
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gis_gdal/gdal/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.

I tried other compilers like clang-11 and clang-16. Same result. The builds fails.

Note: gdal used to build just fine on Lion when using clang-16. #68645

Last edited 3 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

Changed 3 months ago by RobK88

Attachment: main.2.log added

Failed Build - main.log

Changed 3 months ago by RobK88

Attachment: main.3.log added

Failed Build Using Clang-16 - main.log

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

Replying to RobK88:

I will attach my expat-config-version.cmake file.

Yes, I am using the +universal variant of expat.

Yes, that file has been merged incorrectly by the muniversal portgroup. That is to say, the files built for the two architectures differed, and the muniversal portgroup tried to merge them using C preprocessor syntax, but the cmake file format does not accommodate such merging so the resulting file is syntactically invalid.

I'm certain I have seen this in another ticket, and was surprised that the muniversal portgroup attempted this merging, and suggested that the fix should be that the muniversal portgroup would error out if it encountered differing cmake files, but I guess that wasn't done yet and I can't find that ticket now.

I have filed a bug report with expat to see if they can remove the differences that led to the necessity to merge: https://github.com/libexpat/libexpat/issues/875

comment:7 in reply to:  5 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to RobK88:

I was able to finally configure gdal@3.9.0 when i used the regular non-universal variant if expat. But the port fails at the build stage.

Ok, this is a second and completely unrelated problem. The problems in that log start with:

Undefined symbols for architecture x86_64:
  "std::bad_optional_access::~bad_optional_access()", referenced from:
      __ZNSt3__127__throw_bad_optional_accessB7v160006Ev in gdalargumentparser.cpp.o
      __ZNSt3__127__throw_bad_optional_accessB7v160006Ev in gdalinfo_lib.cpp.o
      __ZNSt3__127__throw_bad_optional_accessB7v160006Ev in gdalwarp_lib.cpp.o
      __ZNSt3__127__throw_bad_optional_accessB7v160006Ev in ogrinfo_lib.cpp.o
      __ZNSt3__127__throw_bad_optional_accessB7v160006Ev in nearblack_lib.cpp.o

According to #68220 this will happen on any macOS version earlier than 10.13 because those libc++ versions are too old. The legacy support portgroup has a feature to let a port use a newer libc++ from MacPorts instead. I do not know whether using that would have other undesirable consequences.

comment:8 Changed 3 months ago by RobK88

Thanks Ryan for the explanation. I do hope that the +universal variant for expat gets fixed.

Yes, the build error is completely different. But I am a little confused. The gdal port already uses the legacy-support portgroup. It looks like another fix will be needed.

comment:9 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

The gdal port includes the legacysupport 1.0 portgroup. The legacysupport 1.1 portgroup has an optional feature that ports can opt into (legacysupport.use_mp_libcxx yes) to use a newer MacPorts libc++.

comment:10 Changed 3 months ago by RobK88

Awesome! When I get a chance, I will give that a try.

comment:11 Changed 3 months ago by aeiouaeiouaeiouaeiouaeiouaeiou

So what's the progress on resolving this issue?

comment:12 in reply to:  11 Changed 3 months ago by nilason (Nicklas Larsson)

Replying to aeiouaeiouaeiouaeiouaeiouaeiou:

So what's the progress on resolving this issue?

There is a PR addressing this.

comment:13 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

The PR only addresses the second problem, reported in comment:5 and caused by a too-old libc++. It does not address the original problem, that of universal builds of expat having syntactically invalid cmake files, which is a cmake bug which expat, although not built using cmake, has copied.

comment:14 Changed 2 months ago by nilason (Nicklas Larsson)

In 9f71f7ee408955813c6a97366fa52a9d3bb7bc21/macports-ports (master):

gdal: enable MacPort's libc++ on macOS 10.12 and earlier

See: #70228

comment:15 Changed 2 months ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:16 Changed 2 months ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:17 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: TheLastLovemark added
Keywords: lion removed
Port: expat added; gdal removed
Summary: gdal @3.9.0 - Fails to Configure on Lionexpat @2.6.2+universal: syntactically invalid expat-config-version.cmake file

Has duplicate #70445.

Note: See TracTickets for help on using tickets.