Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building from source on Android Studio for Linux fails on version 1.16.0 #169

Open
mvidaldp opened this issue Apr 20, 2022 · 0 comments
Open
Assignees

Comments

@mvidaldp
Copy link

mvidaldp commented Apr 20, 2022

Building from source on Android Studio for Linux fails on version 1.16.0 due to missing include for Linux on thirdparty/loguru.cpp

Error message: use of undeclared identifier 'pthread_getname_np'

It is fixed by using the missing include (it's there on version 1.15.2 sources).

So change this:

#if LOGURU_PTHREADS
	#include <pthread.h>
	#if defined(__FreeBSD__)
		#include <pthread_np.h>
		#include <sys/thr.h>
	#elif defined(__OpenBSD__)
		#include <pthread_np.h>
	#endif
#endif

To this:

#if LOGURU_PTHREADS
	#include <pthread.h>
	#if defined(__FreeBSD__)
		#include <pthread_np.h>
		#include <sys/thr.h>
	#elif defined(__OpenBSD__)
		#include <pthread_np.h>
	#endif
	#ifdef __linux__
		/* On Linux, the default thread name is the same as the name of the binary.
		   Additionally, all new threads inherit the name of the thread it got forked from.
		   For this reason, Loguru use the pthread Thread Local Storage
		   for storing thread names on Linux. */
		#ifndef LOGURU_PTLS_NAMES
			#define LOGURU_PTLS_NAMES 1
		#endif
	#endif
#endif
@tstenner tstenner self-assigned this Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants