Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save district10/c9d3e2a353b3435a5545b80bf7aba746 to your computer and use it in GitHub Desktop.
Save district10/c9d3e2a353b3435a5545b80bf7aba746 to your computer and use it in GitHub Desktop.
open3d for ubuntu 16.04
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

@district10
Copy link
Author

district10 commented Feb 12, 2022

Dockerfile

FROM dockcross/manylinux2014-x64
# https://github.com/dockcross/dockcross#dockcrossmanylinux2014-x64

ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 TZ=Asia/Shanghai PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 EDITOR=vim
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install --all
RUN yum install -y bison curl flex git git graphviz htop rsync cmake-gui the_silver_searcher sudo tmux tree unzip vim wget && rm -rf /var/cache/yum

RUN yum install -y epel-release cmake3 && \
    yum remove -y cmake && \
    ln -s /usr/bin/cmake3 /usr/bin/cmake && \
    cmake --version && \
    rm -rf /var/cache/yum
RUN yum install -y openssl-devel
RUN cd /tmp && \
    wget https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2.tar.gz && \
    tar xvzf cmake*.tar.gz && cd cmake* && \
    mkdir -p build && cd build && \
    cmake .. && make && make install && \
    cd /tmp && rm -rf *
# yum search XXX
RUN yum install \
    libX11-devel.x86_64 \
    libXcursor-devel.x86_64 \
    libXi-devel \
    libXinerama-devel.x86_64 \
    libXrandr-devel.x86_64 \
    libcxx-devel.x86_64 \
    mesa-libGLU-devel \
    xorg-x11-server-devel \
    -y

build script

clone open3d, add Makefile:

PROJECT_SOURCE_DIR ?= $(abspath ./)
BUILD_DIR ?= $(PROJECT_SOURCE_DIR)/build
INSTALL_DIR ?= $(BUILD_DIR)/install
NUM_JOB ?= 8
PYTHON_EXECUTABLE ?= $(shell which python3.7)
WHEELS_DIR ?= $(PROJECT_SOURCE_DIR)/wheels

all:
	@echo nothing special
clean:
	rm -rf $(BUILD_DIR)
force_clean:
	docker run --rm -v `pwd`:`pwd` -w `pwd` -it alpine/make make clean

CMAKE_ARGS ?= \
	-DBUILD_EXAMPLES=OFF \
	-DBUILD_FILAMENT_FROM_SOURCE=ON \
	-DBUILD_GUI=OFF \
	-DBUILD_PYTHON_MODULE=ON -DPYTHON_EXECUTABLE=$(PYTHON_EXECUTABLE) \
	-DBUILD_SHARED_LIBS=OFF \
	-DBUILD_WEBRTC=OFF \
	-DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR)
build:
	mkdir -p $(WHEELS_DIR)
	mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && \
		cmake $(CMAKE_ARGS) $(PROJECT_SOURCE_DIR) && \
		make -j$(NUM_JOBS) && \
        make install pip-package && \
		cp lib/python_package/pip_package/*.whl $(WHEELS_DIR)

build_python_all:
	make build_py36
	make build_py37
	make build_py38
	make build_py39
	make build_py310
build_py36:
	PYTHON_EXECUTABLE=$(shell which python3.6) make build
build_py37:
	PYTHON_EXECUTABLE=$(shell which python3.7) make build
build_py38:
	PYTHON_EXECUTABLE=$(shell which python3.8) make build
build_py39:
	PYTHON_EXECUTABLE=$(shell which python3.9) make build
build_py310:
	PYTHON_EXECUTABLE=$(shell which python3.10) make build
.PHONY: build_python_all build_py36 build_py37 build_py38 build_py39 build_py310

upload_wheels:
	python3 -m pip install twine
	twine upload wheels/* -r local

MANYLINUX_TAG := build-env-manylinux2014-x64:v0.0.3
test_in_manylinux:
	docker run --rm -v `pwd`:`pwd` -w `pwd` -it $(MANYLINUX_TAG) bash
build_wheels_in_manylinux:
	docker run --rm -v `pwd`:`pwd` -w `pwd` -it $(MANYLINUX_TAG) make build_python_all

Then run: make build_wheels_in_manylinux

@district10
Copy link
Author

python3 -m pip install pip -U
python3 -m pip install wheel numpy -U
python3 -m pip install path/to/open3d.whl

@ZCMax
Copy link

ZCMax commented Jul 25, 2022

Thanks so much!

@ZCMax
Copy link

ZCMax commented Jul 26, 2022

I want to know why the package is much smaller than the official open3d package for open3d==0.14.1?

@district10
Copy link
Author

I want to know why the package is much smaller than the official open3d package for open3d==0.14.1?

See compile commands: (above)

-DBUILD_GUI=OFF \
-DBUILD_WEBRTC=OFF \

and no CUDA, no datasets/model files?

I'm not quite sure.

You can compile it yourself with above Dockerfile (create a manylinux 2014 build environment) and Makefile (mount Open3d 0.14.1 source and compile python 3.6/3.7/3.8/3.9/3.10 pip wheels).

@district10
Copy link
Author

@district10
Copy link
Author

@district10
Copy link
Author

@jianbohuang
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment