Opened 15 months ago

Last modified 15 months ago

#66874 assigned defect

expat @2.5.0: building via autotools leaves cmake files unprocessed

Reported by: RJVB (René Bertin) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: expat

Description

Working on upgrading audacity I ran into an issue with port:expat. On my system, building it with autotools (and +universal) as the port is written leaves the installed file expat-config-version.cmake with the following un(pre)processed block:

# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
#ifndef __LP64__
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "")
#else
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
#endif
  return()
endif()

# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
#ifndef __LP64__
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4")
  math(EXPR installedBits "4 * 8")
#else
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
  math(EXPR installedBits "8 * 8")
#endif
  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

cmake will evidently choke on the #ifndef statements.

I'm not seeing this in default build nor in the buildbot version.

It seems something goes wrong during the muniversal merging of the destroots: the files are correct but evidently different from each other in the destroot-xx dirs. It looks like /usr/bin/diff is the culprit for the mangled result.

The easy solution here would be to build using cmake but that would introduce a circular dependency, so a hand-coded solution must be found in the post-destroot phase. CMake must have bit-width checking features. Or simply install the version created by the cmake build because that lacks the entire offending section (which appears dispensable anyway).

Change History (3)

comment:1 in reply to:  description Changed 15 months ago by RJVB (René Bertin)

Replying to RJVB:

Or simply install the version created by the cmake build because that lacks the entire offending section (which appears dispensable anyway).

The following expression in the post-destroot will have the same effect, removing the line that says "don't have CMAKE_SIZEOF_VOID_P" and everything below:

reinplace "/ have CMAKE_SIZEOF_VOID_P/,\$d" ${destroot}${prefix}/lib/cmake/expat-${version}/expat-config-version.cmake
Last edited 15 months ago by RJVB (René Bertin) (previous) (diff)

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

Cc: ryandesign removed
Owner: set to ryandesign
Status: newassigned
Summary: building expat via autotools leaves cmake files unprocessedexpat @2.5.0: building via autotools leaves cmake files unprocessed

The #ifndef __LP64__ directives are added by the muniversal portgroup when files differ in a universal build; you won't see this appear in non-universal builds.

These are C preprocessor directives so they only make sense in files processed by the C preprocessor, which this .cmake file isn't. The muniversal portgroup has some code for how to handle different types of files, with the C preprocessor method being used as a fallback in case it doesn't know. If an improvement could be made to the muniversal portgroup about this, it would be that it should fail if .cmake files differ.

It sounds like the change you're suggesting to make to the .cmake file is not specific to MacPorts, so you should submit it to the developers of expat.

comment:3 Changed 15 months ago by RJVB (René Bertin)

expat doesn't even building universal binaries, so why would upstream bother, even more if a universal build can already be obtained via a cmake-based build?

Note: See TracTickets for help on using tickets.