Bug 430896 - macOS: fatal error: 'endian.h' file not found
Summary: macOS: fatal error: 'endian.h' file not found
Status: REPORTED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: 20.12
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL: https://invent.kde.org/packaging/home...
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-28 11:43 UTC by Yurii Kolesnykov
Modified: 2021-01-14 12:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yurii Kolesnykov 2020-12-28 11:43:11 UTC
SUMMARY
libktorrent doesn't build on macOS

STEPS TO REPRODUCE
1. Try to build libktorrent on macOS

OBSERVED RESULT
../src/dht/key.cpp:30:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^~~~~~~~~~
1 error generated.

Full log: https://git.io/JLyDa

EXPECTED RESULT
libktorrent should build on macOS

SOFTWARE/OS VERSIONS
macOS: 11.1 (20C69)
KDE Plasma Version: 5.20.4
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I had tried to add workaround for macOS (#include <machine/endian.h>) as for BSD systems (patch is here: https://invent.kde.org/packaging/homebrew-kde/-/snippets/1434), but now I see:

../src/dht/key.cpp:95:29: error: use of undeclared identifier 'htobe32'

Full log: https://git.io/JLyy0

Same issue was fixed zeromq by this PR (MPL-licensed): https://github.com/zeromq/zmqpp/pull/174/files

A similar header is available in chromium/webrtc (under BSDL): https://chromium.googlesource.com/external/webrtc/+/master/rtc_base/byte_order.h