libgcc_s.so.1 must be installed for pthread_cancel to work

I'm on python; I am trying to shut down a function running through a ThreadPoolExecutor, but the shutdown is crashing with the error:

libgcc_s.so.1 must be installed for pthread_cancel to work 

The function is submitted with:

record_future = self.executor.submit(next,primitive) 

primitive is an iterator that usually returns a value but in some cases, it needs to wait a while before returning a value (because of long calculations, etc). In these cases, when I need to shut down the running thread, I cannot wait for the iterator to finish returning, and need to shut it down immediately. I did it with:

executor.shutdown(wait=False) 

However, when execution reaches this point, I get the libgcc error.

I tried 'solving' it by manually installing with:

apt-get install libgcc1:amd64 

but no dice. I am not sure where exactly python is looking for this library, otherwise I would try creating a symbolic link, because the library is already installed at:

$ /sbin/ldconfig -p | grep libgcc libgcc_s.so.1 (libc6,x32) => /usr/libx32/libgcc_s.so.1 libgcc_s.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcc_s.so.1 libgcc_s.so.1 (libc6) => /usr/lib32/libgcc_s.so.1 

3 Answers

I found a potential workaround in the Python mailing list to explicitly load libgcc_.so.1 via ctypes as follows:

import ctypes libgcc_s = ctypes.CDLL('libgcc_s.so.1') 

One has to make sure that this is loaded before any threads are created and that the variable libgcc_s lasts until all of the threads are closed (i.e. put this at the beginning of your file).

3

Are you using Python 3.7 or 3.8?

I also encounter this error in Python's sounddevice using my Anaconda Python 3.8, but it does not happen using my Anaconda Python 3.7. I have tested all workarounds in Google search, and have made sure all related packages and libraries are of the same version, it still does not work. My last conjecture is Python 3.8 vs 3.7 version difference. Though it might not be the case ^_^

3

Hey I found a solutions for ubuntu user in this blog , in summary try before running the script

export OMP_NUM_THREADS=1.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like