Build issues, Clang, C++11 or C++17, FreeBSD
adriaandegroot opened this issue · 3 comments
Trying to build NymphCast server on FreeBSD, with Clang (which defaults to at least C++11, and I think I set the port build as C++17), produces these errors:
./bytebauble.h:62:3: error: no type named 'size_t' in namespace 'std'; did you mean '__size_t'?
std::size_t bytesize = sizeof(in);
(missing #include <cstddef>
, although bytebauble.h
includes other headers which with GNU STL apparently pull in that definition. https://en.cppreference.com/w/cpp/types/size_t says it lives elsewhere.)
ffplay/audio_renderer.cpp:152:39: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
":channel_layout=0x%"PRIx64, is->audio_filter_src.channel_layou
(this is just a missing space, see e.g. ffplay/cmdutils.h
which uses PRIx64
as well)
./lcdapi/sensors/LCDSensor.h:56:13: error: cannot cast from type 'int' to pointer type 'pthread_t' (aka 'pthread *')
_thread(static_cast<pthread_t>(-1))
I really don't know what to do about this one. I'd drop the static cast and use nullptr
, but maybe there's something special going on?
I can PR these if you like.
Hello, and thank you for the comments :)
The issues you mentioned should be addressed in the current master. I changed the use of pthread_t, and the entire codebase compiles cleanly with MSVC 2017.
Remaining patches to build on FreeBSD are in that PR.
There's two things that I still change in packaging (e.g. relevant for #61 and not-really here):
- moving
version
toversion.mk
(and corresponding change in theMakefile
). This is very much an implementation detail, but Clang has a<version>
header (so does gcc, for that matter) and because of-I .
it ends up being picked up by system headers. Compilation errors look like:It's easiest just to rename the file and get it out of the way.In file included from /usr/include/c++/v1/exception:85: ./version:1:3: error: invalid preprocessing directive # Versioning file for the NymphCast server.
- Fixing up the
Makefile
:- replacing
make
by$(MAKE)
to ensure the same flavor of make is run each time. (This could probably be upstreamed, though) - using
c++
instead ofg++
,cc
instead ofgcc
. - dropping unneeded libraries like
-latomic
and-lstdc++fs
, which don't exist and are not needed on the FreeBSD / Clang side of things.
- replacing
One last one, (which would apply to the upstream ES-Core that is vendored into NymphCast, too):
--- gui/core/utils/TimeUtil.h.orig 2022-02-16 14:27:26 UTC
+++ gui/core/utils/TimeUtil.h
@@ -2,6 +2,7 @@
#ifndef ES_CORE_UTILS_TIME_UTIL_H
#define ES_CORE_UTILS_TIME_UTIL_H
+#include <ctime>
#include <string>
namespace Utils
This is one of those implicit-includes-that-annoys-people things. In FreeBSD recent releases do not need this anymore, as there was an effort to make the system headers less pedantically-annoying. But older, still supported versions, do. Not PR'ing this because it's not particularly necessary upstream, it's in packaging downstream anyway, and the problem is going away with the EoL of FreeBSD 12.
(Closing the issue, too: NymphCast builds on FreeBSDs 12, 13 and 14 and is available from packaging).