Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#64869 closed defect (fixed)

PDAL @2.3.99.1: fatal error: 'filesystem' file not found

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: Veence (Vincent)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc: mascguy (Christopher Nielsen)
Port: PDAL

Description

PDAL fails to build on macOS Mojave and earlier:

https://build.macports.org/builders/ports-10.14_x86_64-builder/builds/121821/steps/install-port/logs/stdio

pdal/util/FileUtils.cpp:49:10: fatal error: 'filesystem' file not found
#include <filesystem>
         ^~~~~~~~~~~~
1 error generated.

Change History (13)

comment:1 Changed 3 years ago by Veence (Vincent)

Interesting. Apparently, this new version needs a boost dependency to run?

Now, the problem is: given that we have at least four versions of boost, how should I deal with this? With a lib dependency rather than a port one?

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

It needs <filesystem> which I understand is a C++17 thing. You can request MacPorts select a C++17-compatible compiler by writing compiler.cxx_standard 2017. The port already says compiler.cxx_standard 2011 so just change that to 2017.

Before it was in C++17 I guess this feature was in boost. If the preceding does not work and you want to use boost, use the boost portgroup. Boost versions are often incompatible with one another which is why we have multiple boost ports, so you can select whichever version is compatible with the particular project.

comment:3 Changed 3 years ago by Veence (Vincent)

Thanks a bunch Ryan.

Indeed, I had a look and have no dependency on boost in any of the executable/libraries files produced by PDAL.

So yes, I think the best way is to use 2017 as the minimum version of the compiler. Introducing an artificial dependency on boost doesn’t seem to me like a good idea, since I have no idea if the C++2017 <filesystem> and the boost one are equivalent.

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

Some C++17 features are implemented in part in libc++; there is no solution currently to allow programs that require those features to compile on earlier operating systems that have older versions of libc++. I don't remember if filesystem is one of those features. I guess we'll find out.

comment:5 Changed 3 years ago by Veence (Vincent)

Well, I’ve committed the change. Let’s see what happens…

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

Replying to ryandesign:

Some C++17 features are implemented in part in libc++; there is no solution currently to allow programs that require those features to compile on earlier operating systems that have older versions of libc++.

There is :

https://ports.macports.org/port/macports-libcxx/details/

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

macports-libcxx doesn’t always work, depending on some specifics, but it often works.

It’s best, as always, to run the test suite or at least verify function in some way.

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

Replying to Veence:

I’ve committed the change.

In [0a7a69d9c2415c5ba47c327ecf21eecc83e20728/macports-ports] I see. Don't forget to reference ticket URLs in your commit messages so that a comment about the commit gets automatically added to the ticket.

It looks like this hasn't fixed the build problem. According to this the C++17 filesystem feature requires macOS 10.15's version of libc++ or later.

As you originally suggested, you could conceivably make the port use some version of boost to satisfy this requirement on 10.14 and earlier.

Yes, there is the macports-libcxx port. I have no personal experience with it so I cannot comment on it.

comment:9 Changed 3 years ago by kencu (Ken)

works as I designed it to:

PortGroup           legacysupport 1.1

legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx yes
$ port -v installed pdal
The following ports are currently installed:
  PDAL @2.3.99.1_1+postgresql14+python310 (active) requested_variants='' platform='darwin 18' archs='x86_64' date='2022-03-21T18:25:12-0700'
$ otool -L /opt/local/bin/pdal
/opt/local/bin/pdal:
	/opt/local/lib/libMacportsLegacySupport.dylib (compatibility version 1.0.0, current version 1.0.4)
	/opt/local/lib/libpdalcpp.14.dylib (compatibility version 14.0.0, current version 14.0.0)
	/opt/local/lib/libpdal_util.14.dylib (compatibility version 14.0.0, current version 14.0.0)
	/opt/local/lib/libgdal.30.dylib (compatibility version 31.0.0, current version 31.2.0)
	/opt/local/lib/libcxx/libc++.1.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

I haven't tried any tests.

Probably could be tweaked to link statically in some cases, etc, but I'll leave that as an exercise to the reader.

Version 0, edited 3 years ago by kencu (Ken) (next)

comment:10 Changed 3 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:11 in reply to:  9 Changed 3 years ago by mascguy (Christopher Nielsen)

Replying to kencu:

works.:

PortGroup           legacysupport 1.1

legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx yes

I can confirm this works for 10.13 as well, so I'll push the change.

We can always revert if it causes issues. But thus far, macports-libcxx has worked beautifully. So I don't anticipate any issues.

comment:12 Changed 3 years ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: assignedclosed

In a261c62eb7c3293f83c245f927cfc5f344cafe5a/macports-ports (master):

pdal: use macports-libcxx for 10.14 and earlier
Fixes: #64869

comment:13 Changed 3 years ago by mascguy (Christopher Nielsen)

Builds succeed for macOS 10.8 and up, with macports-libcxx. Very nice!

Note: See TracTickets for help on using tickets.