Archived
Can't compile the Python package because of an undeclared value
Hello!
I try to build a small docker container with a python script that uses the Ice package and I can't build it via pip.
There are several official images with python and tried several of them in different combinations:
3.6.3-jessie — this is the image with python 3.6.3 based on Debian Jessie with a lot of packages and gcc version 4.9.2. It works well and everything is compiled smoothly I suppose because of gcc version. I'm not just satisfied with the container size in the result.
I also tried two images based on alpine linux version 3.4 and 3.6 with gcc version 5.3.0 and 6.3.0 respectively and in both cases I get the same exception:
src/ice/cpp/src/IceUtil/RecMutex.cpp: In member function 'void IceUtil::RecMutex::init(IceUtil::MutexProtocol)': src/ice/cpp/src/IceUtil/RecMutex.cpp:129:43: error: 'PTHREAD_MUTEX_RECURSIVE_NP' was not declared in this scope rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); ^ error: command 'gcc' failed with exit status 1
I tried to build zeroc-ice python packages version 3.6.4 and 3.7.0.1 and in all possible variants I got that error. It doesn't look like a missing dependency error for me and I don't know what I can I do here.
Do you have any thoughts about it? Is this because of the compiler version or I can just configure it somehow or add a dependency?
g++(tried clang too, the same result) bzip2-dev openssl-dev — this is a minimal dependencies to get that error that I found out
Comments
-
Hi,
I believe this is caused by the musl C library from Alpine Linux which doesn't support
PTHREAD_MUTEX_RECURSIVE_NP
but instead supportsPTHREAD_MUTEX_RECURSIVE
.You could try installing the PyPI package with the following to see if it works around the issue:
pip install --global-option=build_ext --global-option="-DPTHREAD_MUTEX_RECURSIVE_NP=1" zeroc-ice
Can you let us know now if that solves your issue? We'll look into fixing our code to check for this macro.
Cheers,
Benoit.0 -
Hi,
Thank you for the explanation! Unfortunately, your suggestion doesn't resolve the issue but I have another error message now:
src/ice/cpp/src/IceUtil/RecMutex.cpp: In member function 'void IceUtil::RecMutex::init(IceUtil::MutexProtocol)': <command-line>:0:30: error: lvalue required as left operand of assignment src/ice/cpp/src/IceUtil/RecMutex.cpp:129:43: note: in expansion of macro 'PTHREAD_MUTEX_RECURSIVE_NP' rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); ^~~~~~~~~~~~~~~~~~~~~~~~~~ error: command 'gcc' failed with exit status 1
0 -
Hi,
Can you try another workaround? Try using the following instead:
pip install --global-option=build_ext --global-option="-D__USE_UNIX98" zeroc-ice
Our code checks for this macro (defined with Glibc) and use
PTHREAD_MUTEX_RECURSIVE
andPTHREAD_MUTEX_ERROR_CHECK
when it's defined. We'll fix this check in an upcoming released in order to be compatible with the musl C library.Cheers,
Benoit0 -
Yep! This one works! Thank a lot, I will use this workaround until new release with the fix.
0