Bug 485854 - kde-frameworks/kio-6.1.0: [LLVM-18] src/gui/systemd/scopedprocessrunner.cpp:60:9: error: use of undeclared identifier 'close'
Summary: kde-frameworks/kio-6.1.0: [LLVM-18] src/gui/systemd/scopedprocessrunner.cpp:6...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 6.1.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-20 14:16 UTC by Gonçalo Negrier Duarte
Modified: 2024-04-27 15:44 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
kde-frameworks/kio-6.1.0 build log (294.21 KB, text/plain)
2024-04-20 14:16 UTC, Gonçalo Negrier Duarte
Details
emerge info log (20.23 KB, text/plain)
2024-04-20 14:18 UTC, Gonçalo Negrier Duarte
Details
fix-undecleared-identifier-close.patch (408 bytes, text/plain)
2024-04-22 08:31 UTC, Michael
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gonçalo Negrier Duarte 2024-04-20 14:16:32 UTC
Created attachment 168714 [details]
kde-frameworks/kio-6.1.0 build log

I having the error above when compiling the kde-frameworks/kio-6.1.0 on the llvm-18 profile. 

This bug seems to have been cause by this commit here: 
https://invent.kde.org/frameworks/kio/-/commit/152fa94b5fb2c3226b0f8f7975c1f06bec4ecdaa

I gonna attach the emerge --info and build.log, the same are also present on the gentoo bug tracker: https://bugs.gentoo.org/930154

STEPS TO REPRODUCE
1.  Have LLVM-18.1.4
2.  Update KDE Plasma 6.0.4, Gear 24.02.2 and Frameworks 6.1.0 
2. Compiled kde-frameworks/kio-6.1.0 with useflags "acl handbook kwallet wayland"

OBSERVED RESULT
```bash
/var/tmp/portage/kde-frameworks/kio-6.1.0/work/kio-6.1.0/src/gui/systemd/scopedprocessrunner.cpp:60:9: error: use of undeclared identifier 'close'
   60 |         close(efd);
      |         ^
1 error generated.
```

EXPECTED RESULT

Compliled without any error

SOFTWARE/OS VERSIONS
Linux: Gentoo Linux 2.15
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0*
Qt Version: 6.7.0

ADDITIONAL INFORMATION

I was able to update to KDE Frameworks 6.1.0 by apply a patch that revert the commit above

For my understanding I don't think this bug is llvm-18 specific I think can also happen on gcc

Best Regards,
Gonçalo Negrier Duarte
Comment 1 Gonçalo Negrier Duarte 2024-04-20 14:18:14 UTC
Created attachment 168715 [details]
emerge info log
Comment 2 Michael 2024-04-22 08:31:27 UTC
Created attachment 168786 [details]
fix-undecleared-identifier-close.patch

Happens for me as well on Gentoo with LLVM/Clang 17.
I've attached patch as a workaround that includes unistd.h that defines "close", however I'm not sure if this has some unwanted side effects, but so far everything seems to work fine.

STEPS TO REPRODUCE
1.  Have llvm-17.0.6
2.  Update KDE Plasma 6.0.4, Gear 24.02.2 and Frameworks 6.1.0 
2. Compile kde-frameworks/kio-6.1.0 clang and USE flags "X wayland"

SOFTWARE/OS VERSIONS
Linux: Gentoo Linux 2.15
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Comment 3 Gonçalo Negrier Duarte 2024-04-22 10:28:44 UTC
(In reply to Michael from comment #2)
> Created attachment 168786 [details]
> fix-undecleared-identifier-close.patch
> 
> Happens for me as well on Gentoo with LLVM/Clang 17.
> I've attached patch as a workaround that includes unistd.h that defines
> "close", however I'm not sure if this has some unwanted side effects, but so
> far everything seems to work fine.

Can confirm it work also for me, I don't think will cause any side effects, basically it solve the undefined close.
Send that patch to gentoo bug as well, might be added as workaround for now
Comment 4 Andreas Sturmlechner 2024-04-22 15:17:03 UTC
Thanks, can you please take your patch to https://invent.kde.org/frameworks/kio by creating an MR there?
Comment 5 Michael 2024-04-26 23:01:38 UTC
Here is the MR https://invent.kde.org/frameworks/kio/-/merge_requests/1619
Comment 6 Gonçalo Negrier Duarte 2024-04-27 15:44:56 UTC
Gonna just marked as fixed since the MR was merged