8000 Docker build on Apple M1 Pro fails · Issue #17 · nvictus/pybbi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Docker build on Apple M1 Pro fails #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pkerpedjiev opened this issue Dec 26, 2021 · 5 comments · Fixed by #18
Closed

Docker build on Apple M1 Pro fails #17

pkerpedjiev opened this issue Dec 26, 2021 · 5 comments · Fixed by #18

Comments

@pkerpedjiev
Copy link
Collaborator
pkerpedjiev commented Dec 26, 2021

This can be reproduced using the following Dockerfile:

FROM python:3.10-buster


RUN git clone --depth 1 --branch v0.3.0 https://github.com/nvictus/pybbi.git
WORKDIR /pybbi

RUN python setup.py develop

Which yields the following error:

#6 35.22     gcc -pthread -shared -Wl,--no-as-needed build/temp.linux-aarch64-3.10/tmp/pip-install-9qwissbi/pybbi_a9b215e7b84842eeb5602c22e3022feb/bbi/cbbi.o -L/tmp/pip-install-9qwissbi/pybbi_a9b215e7b84842eeb5602c22e3022feb/src/x86_64 -L/usr/local/lib -lkent -lssl -lcrypto -lpng16 -lz -o build/lib.linux-aarch64-3.10/bbi/cbbi.cpython-310-aarch64-linux-gnu.so
#6 35.22     /usr/bin/ld: cannot find -lkent
#6 35.22     collect2: error: ld returned 1 exit status
#6 35.22     error: command '/usr/bin/gcc' failed with exit code 1

Running python setup.py develop finishes without error.

Edit:

I think it might be because the libkent library gets built in aarch64/libkent.a but gcc expects it to be in x86_64/libkent.a:

Library being built:

ar rcus aarch64/libkent.a aliType.o annoAssembly.o ...

and pybbi being built:

gcc -pthread -shared -Wl,--no-as-needed build/temp.linux-aarch64-3.10/pybbi/bbi/cbbi.o -L/pybbi/src/x86_64

Looks like $(MACHTYPE) in ./Makefile doesn't match $(MACHTYPE) in src/Makefile.

Interesting... if I change the Dockerfile to:

FROM python:3.10-buster


COPY src src
COPY bbi bbi
COPY setup.py setup.py
COPY README.md README.md
COPY Makefile Makefile
COPY include include

RUN python setup.py develop

It runs successfully.

Edit 2:

I think this has something to do with Rosetta running on my mac. uname -m outputs x86_64 on my terminal. Now the question is why the first Makefile is using aarch64 🤔

Edit 3:

The second Dockerfile ran successfully because I had previously built the library outside of the Docker and the COPY src src line included the already built libkent. If I remove that file and run the second Dockerfile above, it fails like the first one.

@pkerpedjiev
Copy link
Collaborator Author

Found the issue. Here's a fix:

#18

@pkerpedjiev
Copy link
Collaborator Author

Would be great to get a new release with this PR 🙏

@nvictus
Copy link
Owner
nvictus commented Dec 27, 2021

Thanks for the fix and sorry for the delay. The source dist is now up on PyPI: https://pypi.org/project/pybbi/0.3.1/#files

@nvictus
Copy link
Owner
nvictus commented Dec 28, 2021

So, I cavalierly dropped the six dependency without checking that it was actually eliminated... Use this release instead https://pypi.org/project/pybbi/0.3.2/#files

@nvictus
Copy link
Owner
nvictus commented Dec 28, 2021

I was also able to generate a dual-architecture universal2 wheel for cp310 on Mac OS. You may want to try it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0