最近在使用jupyter-notebook下用opencv出现了个奇怪的错误。辛辛苦苦google了好久总算找到这个问题的解决办法了
LD_PRELOAD=libgomp.so.1 jupyter-notebook,提前加载经确认就是个bug,分享下防止小伙伴们撞枪口了。
Jakub Jelinek 2019-06-19 15:57:30 UTC
That is a bug in whatever dlopened libgomp.so.1 and before doing that ate all the preallocated TLS area.
The GNU TLS2 model which I'm afraid aarch64 uses unfortunately eats from the same TLS preallocated pool as libraries that require static TLS like libgomp, where it is performance critical to have it as static TLS.
Either don't dlopen libgomp, or LD_PRELOAD it, link it with the application that dlopens it, cut down the uses of other TLS or dlopen libgomp earlier.
There is nothing that can be done on the gcc side.
https://bugzilla.redhat.com/show_bug.cgi?id=1722181
ImportErrorTraceback (most recent call last)
<ipython-input-2-07a3f2957c05> in <module>
1 get_ipython().run_line_magic('matplotlib', 'inline')
2 import numpy as np
----> 3 import cv2
4 from matplotlib import pyplot as plt
5 import urllib.request as ul
ImportError: /lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block
离线
恩,和加载顺序有关,简直坑中之坑
离线
我记得是连接器ld.so里面的环境变量
离线