Bug 402335 - mtp/kiod_module/mtpstorage.cpp:548:81: error: no member named 'st_mtim' in 'stat'
Summary: mtp/kiod_module/mtpstorage.cpp:548:81: error: no member named 'st_mtim' in 's...
Status: REPORTED
Alias: None
Product: kio-extras
Classification: Frameworks and Libraries
Component: default (show other bugs)
Version: 18.12.0
Platform: Homebrew (macOS) macOS
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL: https://github.com/KDE-mac/homebrew-k...
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-19 07:43 UTC by Yurii Kolesnykov
Modified: 2018-12-29 03:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch (693 bytes, patch)
2018-12-29 03:58 UTC, Kieran Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yurii Kolesnykov 2018-12-19 07:43:35 UTC
kio-extras doesn't build after 18.12 release


STEPS TO REPRODUCE
1. Try to build kio-extras under macOS

OBSERVED RESULT
build fails with error
https://gist.github.com/d9176b08b5d59f328f194f90041def88

EXPECTED RESULT
kio-extras builds fine

SOFTWARE/OS VERSIONS
MacOS: 10.14.2
KDE Frameworks Version: 5.53
Qt Version: 5.12
Comment 1 Kieran Ramos 2018-12-29 03:39:24 UTC
I have more details on the problem:

On Ubuntu 'st_mtim' is a timespec struct, but on Darwin the same timespec struct (defined in stat.h) is called 'st_mtimespec'. There is a macro for 'st_mtim.tv_sec' on Ubuntu called 'st_mtime'. The same macro is available in Darwin (defined as 'st_mtimespec.tv_sec') so I think all that is necessary is to change line 548 of mtpstorage.cpp to 'srcBuf.st_mtime'.

Here is where the macro is defined on Darwin in stat.h:

#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define st_atime st_atimespec.tv_sec
#define st_mtime st_mtimespec.tv_sec
#define st_ctime st_ctimespec.tv_sec
#define st_birthtime st_birthtimespec.tv_sec
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
Comment 2 Kieran Ramos 2018-12-29 03:58:06 UTC
Created attachment 117165 [details]
Patch

I've attached a patch to mtpstorage.cpp. With this patch kio-extras builds on macOS (via Homebrew KDE repo), but I don't know how to verify the functionality is correct.