From 9073b9b1b425c3ecf9b20c48165004f3492d4709 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 12 May 2020 18:50:24 -0700 Subject: [PATCH] Library cleanup (#43) * library cleanup * no static libraries * apks need static zmq * Typo * No hacky script --- Dockerfile | 4 +--- SConscript | 6 ++++-- install_capnp.sh | 28 ---------------------------- messaging/messaging_pyx_setup.py | 2 +- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/Dockerfile b/Dockerfile index f681dce68ff4b5..c399e19a64e5ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ from ubuntu:16.04 -RUN apt-get update && apt-get install -y libzmq3-dev clang wget git autoconf libtool curl make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl +RUN apt-get update && apt-get install -y libzmq3-dev capnproto libcapnp-dev clang wget git autoconf libtool curl make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}" @@ -10,8 +10,6 @@ RUN pyenv rehash RUN pip3 install pyyaml==5.1.2 Cython==0.29.14 scons==3.1.1 pycapnp==0.6.4 WORKDIR /project/cereal -COPY install_capnp.sh . -RUN ./install_capnp.sh ENV PYTHONPATH=/project diff --git a/SConscript b/SConscript index ed63c1717b797f..d65ad55e336da3 100644 --- a/SConscript +++ b/SConscript @@ -43,8 +43,10 @@ Depends('messaging/impl_zmq.cc', services_h) # note, this rebuilds the deps shared, zmq is statically linked to make APK happy # TODO: get APK to load system zmq to remove the static link -shared_lib_shared_lib = [zmq, 'm', 'stdc++'] + ["gnustl_shared"] if arch == "aarch64" else [zmq] -env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib) +if arch == "aarch64": + zmq_static = FindFile("libzmq.a", "/usr/lib") + shared_lib_shared_lib = [zmq_static, 'm', 'stdc++', "gnustl_shared"] + env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib) env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq']) Depends('messaging/bridge.cc', services_h) diff --git a/install_capnp.sh b/install_capnp.sh index cc570b60ffc884..2d2d43d6141ce9 100755 --- a/install_capnp.sh +++ b/install_capnp.sh @@ -10,31 +10,3 @@ CXXFLAGS="-fPIC" ./configure make -j$(nproc) make install - -# manually build binaries statically -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -cp .libs/capnp /usr/local/bin/ -cp .libs/capnpc-c++ /usr/local/bin/ -cp .libs/capnpc-capnp /usr/local/bin/ -cp .libs/*.a /usr/local/lib - -cd /tmp -echo "Installing c-capnp" -git clone https://github.com/commaai/c-capnproto.git -cd c-capnproto -git submodule update --init --recursive -autoreconf -f -i -s -CXXFLAGS="-fPIC" ./configure -make -j$(nproc) -make install - -# manually build binaries statically -gcc -fPIC -o .libs/capnpc-c compiler/capnpc-c.o compiler/schema.capnp.o compiler/str.o ./.libs/libcapnp_c.a - -cp .libs/capnpc-c /usr/local/bin/ -cp .libs/*.a /usr/local/lib diff --git a/messaging/messaging_pyx_setup.py b/messaging/messaging_pyx_setup.py index f5962d0c2b2310..3e1c41ce15f58b 100644 --- a/messaging/messaging_pyx_setup.py +++ b/messaging/messaging_pyx_setup.py @@ -30,7 +30,7 @@ def get_ext_filename(self, ext_name): sourcefiles = ['messaging_pyx.pyx'] -extra_compile_args = ["-std=c++11"] +extra_compile_args = ["-std=c++14"] libraries = ['zmq'] ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pylint: disable=unexpected-keyword-arg