Skip to content

error: no member named 'st_atim' in 'struct stat' #7

@ryandesign

Description

@ryandesign

Hello, we have an old version of mg in MacPorts which I'm trying to update to your latest version 20180927. I'm trying to build it on macOS High Sierra.

First, it told me to install libbsd. I tried to build libbsd, but it failed. I reported that to the developers of libbsd. Then, since macOS is based on BSD, I tried patching your makefile so that it would not require a separate libbsd.

That got me further, and now it fails to build for me with this error:

fileio.c:282:20: error: no member named 'st_atim' in 'struct stat'
        new_times[0] = sb.st_atim;
                       ~~ ^
fileio.c:283:20: error: no member named 'st_mtim' in 'struct stat'
        new_times[1] = sb.st_mtim;
                       ~~ ^
2 errors generated.

I've run into this problem with other projects as well. Seems this is just one of those things that different operating systems do differently: macOS doesn't use the names st_atim, st_ctim, st_mtim, but instead uses st_atimespec, st_ctimespec, st_mtimespec.

Since the last release, I see you've added cmake support. Maybe you could have cmake detect which time fields to use on the current OS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions