nvictus/pybbi

Getting error "cannot find -lkent" when building docker image on macOS M1

TkhiienLok opened this issue · 4 comments

macOS 11.3.1, processor Apple Silicon M1

I was building docker image FROM ubuntu:18.04 and was installing a package which has pybbi as a dependency, but it stuck with a log:

#18 360.1     Running setup.py install for pybbi: started
#18 362.3     Running setup.py install for pybbi: finished with status 'error'
#18 362.3     ERROR: Command errored out with exit status 1:
#18 362.3      command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-tx6j1d7m/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/pybbi
#18 362.3          cwd: /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/
#18 362.3     Complete output (46 lines):
#18 362.3     /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
#18 362.3       warnings.warn(msg)
#18 362.3     running install
#18 362.3     running build
#18 362.3     running build_py
#18 362.3     creating build
#18 362.3     creating build/lib.linux-aarch64-3.6
#18 362.3     creating build/lib.linux-aarch64-3.6/bbi
#18 362.3     copying bbi/__init__.py -> build/lib.linux-aarch64-3.6/bbi
#18 362.3     copying bbi/_bbi.py -> build/lib.linux-aarch64-3.6/bbi
#18 362.3     running build_ext
#18 362.3     Compiling libkent archive...
#18 362.3     make: Nothing to be done for 'build-ucsc'.
#18 362.3     Building extension module...
#18 362.3     building 'bbi.cbbi' extension
#18 362.3     creating build/temp.linux-aarch64-3.6
#18 362.3     creating build/temp.linux-aarch64-3.6/tmp
#18 362.3     creating build/temp.linux-aarch64-3.6/tmp/pip-install-urdd3o44
#18 362.3     creating build/temp.linux-aarch64-3.6/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1
#18 362.3     creating build/temp.linux-aarch64-3.6/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi
#18 362.3     aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/include -I/usr/include/libpng16 -I/usr/include/python3.6m -c /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.c -o build/temp.linux-aarch64-3.6/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.o
#18 362.3     In file included from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
#18 362.3                      from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
#18 362.3                      from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
#18 362.3                      from /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.c:725:
#18 362.3     /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#18 362.3      #warning "Using deprecated NumPy API, disable it with " \
#18 362.3       ^~~~~~~
#18 362.3     In file included from /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.c:734:0:
#18 362.3     /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/include/crTree.h:72:69: warning: 'struct hash' declared inside parameter list will not be visible outside of this definition or declaration
#18 362.3      void crTreeFileCreateInputCheck(struct crTreeItem *itemList, struct hash *chromHash,
#18 362.3                                                                          ^~~~
#18 362.3     /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/include/crTree.h:79:9: warning: 'struct hash' declared inside parameter list will not be visible outside of this definition or declaration
#18 362.3       struct hash *chromHash,       /* Hash of all chromosome names. */
#18 362.3              ^~~~
#18 362.3     /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.c: In function '__pyx_pw_3bbi_4cbbi_7BBIFile_13fetch':
#18 362.3     /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.c:7582:5: warning: '__pyx_v_fetcher' may be used uninitialized in this function [-Wmaybe-uninitialized]
#18 362.3          __pyx_f_3bbi_4cbbi_array_query_summarized(((PyArrayObject *)__pyx_v_out), __pyx_v_bins, __pyx_v_self->bbi, __pyx_v_fetcher, __pyx_v_chromName, __pyx_v_start, __pyx_v_end, __pyx_v_chromSize, __pyx_v_oob, __pyx_v_summary_type);
#18 362.3          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#18 362.3     /tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.c:6889:21: note: '__pyx_v_fetcher' was declared here
#18 362.3        BbiFetchIntervals __pyx_v_fetcher;
#18 362.3                          ^~~~~~~~~~~~~~~
#18 362.3     aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--no-as-needed -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-aarch64-3.6/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/bbi/cbbi.o -L/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/src/x86_64 -lkent -lssl -lcrypto -lpng16 -lz -o build/lib.linux-aarch64-3.6/bbi/cbbi.cpython-36m-aarch64-linux-gnu.so
#18 362.3     /usr/bin/ld: cannot find -lkent
#18 362.3     collect2: error: ld returned 1 exit status
#18 362.3     error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
#18 362.3     ----------------------------------------
#18 362.3 ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-urdd3o44/pybbi_9883cff76c204f39b0d733d33d061fe1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-tx6j1d7m/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/pybbi Check the logs for full command output.

So, it looks like it can't find libkent
/usr/bin/ld: cannot find -lkent

But I tried running docker build with the same Dockerfile on laptop with Ubuntu 18.04.5 LTS and didn't encounter any issues with that.

So is it possible to resolve this somehow for macOS with M1 chip? Should I install kent library before running docker build? If yes, what library is it and should it be installed before running docker build or I should add some libraries to Dockerfile to install with apt-get?

Sorry, I can see that there is a resolved discussion #17

Release v0.3.1 should be compilable on M1. Please re-open if there are still issues.

Thank you, v0.3.1 fixed this.

Great! I prematurely removed a dependency in that last release, which may cause issues if your environment doesn't have it, so please use v0.3.2.