diff --git a/SConstruct b/SConstruct index 603af0bf15..e80fe3f76f 100644 --- a/SConstruct +++ b/SConstruct @@ -202,6 +202,7 @@ if arch in ["x86_64", "Darwin", "larch64"]: ] qt_env["LINKFLAGS"] += ["-F" + QT_BASE + "lib"] else: + qt_env['QTDIR'] = "/usr" qt_dirs = [ f"/usr/include/{real_arch}-linux-gnu/qt5", f"/usr/include/{real_arch}-linux-gnu/qt5/QtWidgets", diff --git a/common/clock.pyx b/common/clock.pyx index 654d53f8f0..9702e488cf 100644 --- a/common/clock.pyx +++ b/common/clock.pyx @@ -1,3 +1,4 @@ +# cython: language_level = 3 from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t IF UNAME_SYSNAME == "Darwin": diff --git a/common/common_pyx_setup.py b/common/common_pyx_setup.py index 52252521fa..547fca819d 100644 --- a/common/common_pyx_setup.py +++ b/common/common_pyx_setup.py @@ -4,9 +4,9 @@ from Cython.Build import cythonize from common.cython_hacks import BuildExtWithoutPlatformSuffix sourcefiles = ['clock.pyx'] -extra_compile_args = ["-std=c++11", "-Wno-nullability-completeness"] +extra_compile_args = ["-std=c++14"] -setup(name='Common', +setup(name='common', cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, ext_modules=cythonize( Extension( @@ -14,7 +14,7 @@ setup(name='Common', language="c++", sources=sourcefiles, extra_compile_args=extra_compile_args, - ) + ), + nthreads=4, ), - nthreads=4, ) diff --git a/common/kalman/simple_kalman_impl.pxd b/common/kalman/simple_kalman_impl.pxd index c81f959272..cb39a45bca 100644 --- a/common/kalman/simple_kalman_impl.pxd +++ b/common/kalman/simple_kalman_impl.pxd @@ -1,3 +1,5 @@ +# cython: language_level = 3 + cdef class KF1D: cdef public: double x0_0 @@ -13,4 +15,4 @@ cdef class KF1D: double A_K_0 double A_K_1 double A_K_2 - double A_K_3 \ No newline at end of file + double A_K_3 diff --git a/common/kalman/simple_kalman_setup.py b/common/kalman/simple_kalman_setup.py index 27a700f25f..d0781c9ff3 100644 --- a/common/kalman/simple_kalman_setup.py +++ b/common/kalman/simple_kalman_setup.py @@ -7,5 +7,4 @@ from common.cython_hacks import BuildExtWithoutPlatformSuffix setup(name='Simple Kalman Implementation', cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, ext_modules=cythonize(Extension("simple_kalman_impl", - ["simple_kalman_impl.pyx"], - extra_compile_args=["-Wno-nullability-completeness"]))) + ["simple_kalman_impl.pyx"]))) diff --git a/common/params_pyx.pyx b/common/params_pyx.pyx index 153875e5b4..391173165e 100755 --- a/common/params_pyx.pyx +++ b/common/params_pyx.pyx @@ -1,4 +1,4 @@ -# distutils: langauge = c++ +# distutils: language = c++ # cython: language_level = 3 from libcpp cimport bool from libcpp.string cimport string diff --git a/common/transformations/setup.py b/common/transformations/setup.py index 1881d8da1f..4f18423fc2 100644 --- a/common/transformations/setup.py +++ b/common/transformations/setup.py @@ -1,42 +1,20 @@ -import os import numpy -import sysconfig from Cython.Build import cythonize -from Cython.Distutils import build_ext from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module - -def get_ext_filename_without_platform_suffix(filename): - name, ext = os.path.splitext(filename) - ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') - - if ext_suffix == ext: - return filename - - ext_suffix = ext_suffix.replace(ext, '') - idx = name.find(ext_suffix) - - if idx == -1: - return filename - else: - return name[:idx] + ext - - -class BuildExtWithoutPlatformSuffix(build_ext): - def get_ext_filename(self, ext_name): - filename = super().get_ext_filename(ext_name) - return get_ext_filename_without_platform_suffix(filename) - +from common.cython_hacks import BuildExtWithoutPlatformSuffix setup( name='Cython transformations wrapper', cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, ext_modules=cythonize( - Extension( - "transformations", - sources=["transformations.pyx"], - language="c++", - extra_compile_args=["-std=c++14", "-Wno-nullability-completeness"], - include_dirs=[numpy.get_include()], + Extension( + "transformations", + sources=["transformations.pyx"], + language="c++", + extra_compile_args=["-std=c++14", "-Wno-cpp"], + include_dirs=[numpy.get_include()], + ), + nthreads=4, ) -)) +) diff --git a/common/transformations/transformations.pxd b/common/transformations/transformations.pxd index cb3ee53b19..7af0098701 100644 --- a/common/transformations/transformations.pxd +++ b/common/transformations/transformations.pxd @@ -1,3 +1,4 @@ +#cython: language_level=3 from libcpp cimport bool cdef extern from "orientation.cc": diff --git a/common/transformations/transformations.pyx b/common/transformations/transformations.pyx index 194257e037..12d6e2ab58 100644 --- a/common/transformations/transformations.pyx +++ b/common/transformations/transformations.pyx @@ -26,7 +26,7 @@ cdef np.ndarray[double, ndim=2] matrix2numpy(Matrix3 m): [m(2, 0), m(2, 1), m(2, 2)], ]) -cdef Matrix3 numpy2matrix (np.ndarray[double, ndim=2, mode="fortran"] m): +cdef Matrix3 numpy2matrix(np.ndarray[double, ndim=2, mode="fortran"] m): assert m.shape[0] == 3 assert m.shape[1] == 3 return Matrix3(m.data) diff --git a/selfdrive/common/params.cc b/selfdrive/common/params.cc index 2b78a0e11c..2abfca11dd 100644 --- a/selfdrive/common/params.cc +++ b/selfdrive/common/params.cc @@ -173,7 +173,7 @@ int Params::write_db_value(const char* key, const char* value, size_t value_size tmp_path = params_path + "/.tmp_value_XXXXXX"; tmp_fd = mkstemp((char*)tmp_path.c_str()); bytes_written = write(tmp_fd, value, value_size); - if (bytes_written != value_size) { + if (bytes_written < 0 || (size_t)bytes_written != value_size) { result = -20; goto cleanup; } diff --git a/selfdrive/common/util.c b/selfdrive/common/util.c index 33930f9ec1..d51bc8c6c6 100644 --- a/selfdrive/common/util.c +++ b/selfdrive/common/util.c @@ -4,13 +4,16 @@ #include #include #include -#include +#include + #ifdef __linux__ #include #include +#ifndef __USE_GNU #define __USE_GNU -#include #endif +#include +#endif // __linux__ void* read_file(const char* path, size_t* out_len) { FILE* f = fopen(path, "r");