[riot-users] Use POSIX pthreads in pkg

Philipp Blum philipp-blum at jakiku.de
Sun Oct 21 20:21:17 CEST 2018


 

Hi, 

I have a library which includes <pthreads.h>. 
I use a github repo and create a static library with Cmake. It copies it
then to binddir of riot. 

I basically copied another libraries Makefile, to understand how it
supposed to work. 

all: $(PKG_BUILDDIR)/src/Makefile
    $(MAKE) -C $(PKG_BUILDDIR) && \
    cp $(PKG_BUILDDIR)/libiota_wallet.a $(BINDIR)/iota-wallet.a

$(PKG_BUILDDIR)/src/Makefile: $(TOOLCHAIN_FILE)
    cd $(PKG_BUILDDIR) && \
    cmake -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
          -DCCNL_RIOT=1 -DRIOT_CFLAGS="$(RIOT_CFLAGS)"
-DBUILD_TESTING=OFF .

$(TOOLCHAIN_FILE): git-download
    $(RIOTTOOLS)/cmake/generate-xcompile-toolchain.sh >
$(TOOLCHAIN_FILE) 

I got another file named Makefile.dep, where I placed my dependencies: 

USEMODULE += posix
USEMODULE += pthread 

and a Makefile.include 

INCLUDES += -I$(PKGDIRBASE)/iota-wallet/src 

When I start make in my application folder I get the following error
message: 

/home/citrullin/git/riot_libs/examples/iota_transaction_light/bin/pkg/bluepill/iota-wallet/src/iota/bundle.c:
In function 'create_bundle_bytes':
/home/citrullin/git/riot_libs/examples/iota_transaction_light/bin/pkg/bluepill/iota-wallet/src/iota/bundle.c:62:5:
error: implicit declaration of function 'pthread_mutex_lock'; did you
mean 'pthread_atfork'? [-Werror=implicit-function-declaration]
     pthread_mutex_lock(&iota_wallet_bundle_essence_mutex);
     ^~~~~~~~~~~~~~~~~~
     pthread_atfork 

The bundle.c and the bundle.h have: 

#include <pthread.h> 

So, that shouldn't be an issue. So what did I miss. How do I make it
possible that the compiler finds the pthread implementation? 

Thanks for you help :) 

best regards 

Philipp 

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20181021/bc0db000/attachment.html>


More information about the users mailing list