#67808 closed defect (fixed)

graph-tool 2.46 build fails on Apple Silicon

Reported by: essandess (Steve Smith) Owned by: essandess (Steve Smith)
Priority: Normal Milestone:
Component: ports Version:
Keywords: arm64 Cc: essandess (Steve Smith)
Port: py-graph-tool

Description

I'm reposting this issue here in case someone knows how to fix this issue on the MacPorts side:

https://git.skewed.de/count0/graph-tool/-/issues/761

graph-tool builds fail for Apple Silicon arm64. I've tested separately on a Mac Studio with an M2 Ultra and a MBA with an M1, and see the same issue. The exact same build procedure works on macOS x86_64.

The build errors are:

:info:build In file included from ./src/graph/graph.hh:42:
:info:build ./src/graph/graph_properties.hh:466:19: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
:info:build     : public std::unary_function<typename IndexMap::key_type, size_t>
:info:build              ~~~~~^~~~~~~~~~~~~~
:info:build                   __unary_function

A full log file is attached with ./configure and other outputs.

Build environment:

macOS 13.4.1 22F770820d arm64
Xcode 14.3.1 14E300c
Python 3.10

Attachments (1)

main_py310-graph-tool.log.gz (18.6 KB) - added by essandess (Steve Smith) 16 months ago.
Log file of the failed build.

Download all attachments as: .zip

Change History (9)

Changed 16 months ago by essandess (Steve Smith)

Log file of the failed build.

comment:1 Changed 16 months ago by essandess (Steve Smith)

I also see that the latest version graph-tool 2.57 fails with the same error on all architectures.

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

Looks like it's trying to use std::unary_function which was removed from the C++ standard as of C++17. gcc has not yet removed unary_function even when requesting C++17 mode but clang has.

I also see references to boost 1.76 in the log. boost 1.76 uses unary_function. Use a newer version of boost that no longer attempts to use unary_function.

comment:3 Changed 16 months ago by essandess (Steve Smith)

Thanks! I tried adding an explicit

boost.version 1.81

to the py-graph-tool and its dependent cgal5 ports, but these unary_function errors still appear because they're in the graph-tool code.

Is there a way of specifying another compiler that uses unary_function?

Last edited 16 months ago by essandess (Steve Smith) (previous) (diff)

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

Sure. I see in the log it's using clang 16. I believe clang 15 and later have removed unary_function so you could try:

PortGroup compiler_blacklist_versions 1.0
compiler.blacklist-append {macports-clang-1[5-9]} {macports-clang-[2-9][0-9]} {clang >= 1403}
Last edited 16 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:5 Changed 16 months ago by jmroot (Joshua Root)

The newer compilers should still support older C++ standards, so it's probably worth trying -std=c++14 or whatever before you go blacklisting current compilers.

comment:6 Changed 16 months ago by jmroot (Joshua Root)

Oh I see, the code actually requires other C++17 features despite using this feature that has been removed as of C++17. What a mess.

comment:7 Changed 16 months ago by essandess (Steve Smith)

Good news: Simply removing unary_function per, e.g. https://stackoverflow.com/questions/63577103/what-is-an-equivalent-replacement-for-stdunary-function-in-c17, creates a working, compilable project.

Please see https://github.com/macports/macports-ports/pull/19570

And this code is fast on a Mac Studio M2 Ultra!

comment:8 Changed 16 months ago by essandess (Steve Smith)

Owner: set to essandess
Resolution: fixed
Status: newclosed

In d58e0f4851eb6ff00daf021a3a7d87cd3dd02fcd/macports-ports (master):

py-graph-tool: Update to version 2.57

  • Add Py 311, Remove Py 37
  • Use boost181
  • Bugfix for unary_function C++17 removal

Fixes: #67808

Note: See TracTickets for help on using tickets.