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

Fix issues when building with gcc on linux #220

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wangyinz
Copy link

I was trying to build Dobby with gcc on a linux system and ran into multiple issues.

The first issue is due to the use of __has_feature, which is only defined in llvm, and gcc will throw an error when preprocessing that keyword. I got it fixed by defining it to 0 when no defined by the compiler, which is in commit 582a3e9.

Then, there are two libraries defined for Darwin only but got accidentally built without checking the platform. This is fixed by adding a if statement to the CMake definition, which is in commit 5e9770d.

The example got a dependency on pthread, but it is not linked by cmake by default (at least not with gcc). I added a dependency in fe2bf6d.

While fixing these, I also noticed the issue reported in #217. This is due to how logging is enabled here:

#if !defined(LOG_FUNCTION_IMPL)
#define LOG_FUNCTION_IMPL logger_log_impl
#endif
void *logger_create(const char *tag, const char *file, LogLevel level, bool enable_time_tag, bool enable_syslog);
void logger_set_options(void *logger, const char *tag, const char *file, LogLevel level, bool enable_time_tag,
bool enable_syslog);
void logger_log_impl(void *logger, LogLevel level, const char *fmt, ...);
#if defined(LOGGING_DISABLE)
#define LOG_FUNCTION_IMPL(...)
#endif

The LOG_FUNCTION_IMPL will only be overidden when LOGGING_DISABLE is defined. But it isn't even when DOBBY_DEBUG is set to OFF. This is fixed by the else branch in e8de563

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

Successfully merging this pull request may close these issues.

1 participant