Play-
Play- copied to clipboard
Compilation issue, m_workThreadId was not declared in this scope
I'm trying to compile Play on a Musl system, but it fails close to the end with the message in the title.
/home/bart/Documents/Git/alpine/aports/testing/libretro-play/src/Play--755706625b7711f7e5a39891ebf126b979b5853f/Source/Profiler.cpp:33:39: error: 'm_workThreadId' was not declared in this scope
33 | assert(std::this_thread::get_id() == m_workThreadId);
| ^~~~~~~~~~~~~~
ummm...
its an odd issue, its caused by trying to enable profiling + assert
being evaluated without a debug build flag, and the flag is needed to declare m_workThreadId.
either way, assuming you did enable profiling, disable it, since it does nothing on libretro builds.
Well I didn't enable it manually if that is what you're asking. Not sure how to disable it?
my bad, I look at this again, and you don't need profiling enabled to compile that code.
the issue with assert and debug flag is still the issue, perhaps trying building with explicit release flag
# you might need to remove build directory and start fresh to get the flag picked up
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
if this doesn't work, we'd need a bit more detail, what compiler/version you're using, and what's the generated build system, makefile, ninja etc, OS/version might be able to test to reproduce the issue.
(if makefile, you can run make VERBOSE=1
so we can see what flags the compiler is getting)
Hmm, yes -DCMAKE_BUILD_TYPE=Release
works, interesting. Still, it'd be good if the actual issue of it not being declared in that scope would be fixed at some point :smile:
Thanks for your help so far though!
ya, according to https://en.cppreference.com/w/cpp/error/assert
it might be better to check for lack of NDEBUG
macro as oppose to availability of _DEBUG
macro, though I've a feeling different setup make their own rules regarding that.
I'll test all my setups (ubuntu, ghostBSD, osx, windows 10) later, but it'd be good to confirm the behaviour on your setup as well.
https://github.com/jpd002/Play-/blob/9003e644b89a5b476e6ea0dbcb52ec27a0119f6f/Source/Profiler.h#L49
just change this to #ifndef NDEBUG
and see how does it behave with and without the release flag.