Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] build issue with threads

I'm helping someone build mosquitto on NetBSD 7 (and yes I know that's
old).  It's mostly ok, but I am running into pthread weirdness.

The symptom is a complain about redefinition of pthread symbols.  NetBSD
7 has as far as I know perfectly ok pthreads, but /usr/include/pthread.h
does declare some __libc_pthread_foo and define macros from pthread_foo.

From cmake cache files, pthreads are detected as ok and use in client
programs.

But in mosquitto_internal.h

  #if defined(WITH_THREADING) && !defined(WITH_BROKER)
  #  include <pthread.h>
  #else
  #  include <dummypthread.h>
  #endif

which seems to try to disable threads within the broker.

Somehow, one of the dependencies is including pthread.h (which is now
pretty normal).  I took out websockets, but I see now that openssl
includes it.

So I guess in the end:

  Mosquitto broker wants to not use threads, and to build code that
  has thread calls with and without actually calling them.

  The strategy of #defining away thread calls depends on the thread
  calls not being macros, which I'm pretty sure POSIX doesn't require or
  there would have lots of complaints in NetBSD-land, and we are
  generally very serious about standards compliance.


I added #undef just before and that resolved the issue.  I know NetBSD 7
is EOL but this seems like a bug anyway.

Attachment: signature.asc
Description: PGP signature


Back to the top