build for python 3.6 in docker using amazonlinux
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 357
- Avg merge
- 11h 4m
- Merged PRs (30d)
- 1
Description
From https://github.com/dazza-codes/docker-google-s2-lambda
The build works, but it has cmake/swig WARNINGs and the python import fails. The Dockerfile uses `FROM amazonlinux` and it installs the usual development libs to download and build/install python 3.6.10 (into /usr/local/bin/python3) and then the cmake3 uses it to configure the python paths. The `gtest` package is installed from `yum`. The build goes like:
```
Step 10/11 : ENV PY3 /usr/local/bin/python3
---> Using cache
---> ec80418cbfed
Step 11/11 : RUN cmake3 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DPYTHON_INCLUDE_DIR=$(${PY3} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_LIBRARY=$(${PY3} -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") -DPYTHON_EXECUTABLE:FILEPATH=${PY3} .. && make && make install
---> Running in ccb0560057f6
-- The C compiler identification is GNU 7.3.1
-- The CXX compiler identification is GNU 7.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The following features have been enabled:
* SHARED_LIBS, builds shared libraries instead of static.
-- The following features have been disabled:
* GFLAGS, allows changing command line flags.
* GLOG, provides logging configurability.
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.0.2k")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found SWIG: /usr/bin/swig (found version "3.0.12")
-- Found PythonInterp: /usr/local/bin/python3 (found version "3.6.10")
GTEST_ROOT:
-- Found PythonLibs: /usr/local/lib (found version "3.6.10")
CMake Warning (dev) at /usr/share/cmake3/Modules/UseSWIG.cmake:564 (message):
Policy CMP0078 is not set. Run "cmake --help-policy CMP0078" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Call Stack (most recent call first):
src/python/CMakeLists.txt:12 (swig_add_library)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
WARNING: Target "_pywraps2" requests linking to directory "/usr/local/lib". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /app/s2geometry/build
```
SO the worry is
```
WARNING: Target "_pywraps2" requests linking to directory "/usr/local/lib". Targets may link only to libraries. CMake is dropping the item.
```
The rest of the build _seems_ OK, e.g.
```
Scanning dependencies of target point_index
[ 97%] Building CXX object examples/CMakeFiles/point_index.dir/point_index.cc.o
[ 98%] Linking CXX executable point_index
[ 98%] Built target point_index
Scanning dependencies of target pywraps2_swig_compilation
[ 99%] Swig compile s2.i for python
/app/s2geometry/src/s2/s2region.h:45: Warning 362: operator= ignored
/app/s2geometry/src/s2/s2cell_union.h:73: Warning 509: Overloaded method S2CellUnion::S2CellUnion(std::vector< uint64,std::allocator< uint64 > > const &) effectively ignored,
/app/s2geometry/src/s2/s2cell_union.h:69: Warning 509: as it is shadowed by S2CellUnion::S2CellUnion(std::vector< S2CellId,std::allocator< S2CellId > >).
[ 99%] Built target pywraps2_swig_compilation
Scanning dependencies of target _pywraps2
[ 99%] Building CXX object python/CMakeFiles/_pywraps2.dir/CMakeFiles/_pywraps2.dir/s2PYTHON_wrap.cxx.o
[100%] Linking CXX shared module _pywraps2.so
[100%] Built target _pywraps2
[ 3%] Built target s2testing
[ 94%] Built target s2
[ 96%] Built target term_index
[ 98%] Built target point_index
[ 99%] Built target pywraps2_swig_compilation
[100%] Built target _pywraps2
```
But it's not really. i.e. the python modules are messed up:
```
$ docker run --rm -it google-s2
bash-4.2# python3
Python 3.6.10 (default, Mar 13 2020, 01:24:15)
[GCC 7.3.1 20180712 (Red Hat 7.3.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywraps2 as s2
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'pywraps2'
bash-4.2# python3
Python 3.6.10 (default, Mar 13 2020, 01:24:15)
[GCC 7.3.1 20180712 (Red Hat 7.3.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/usr/lib/python3.6/site-packages')
>>> import pywraps2 as s2
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pywraps2.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 658, in _load_unlocked
File "", line 571, in module_from_spec
File "", line 922, in create_module
File "", line 219, in _call_with_frames_removed
ImportError: libs2.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.6/site-packages/pywraps2.py", line 17, in
_pywraps2 = swig_import_helper()
File "/usr/lib/python3.6/site-packages/pywraps2.py", line 16, in swig_import_helper
return importlib.import_module('_pywraps2')
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libs2.so: cannot open shared object file: No such file or directory
>>>
bash-4.2# exit
```
Contributor guide
Assessment
This issue has not been assessed yet.