wangkuiyi / recordio

Apache License 2.0
11 stars 2 forks source link

Need help understanding .travis.yml #33

Closed wangkuiyi closed 5 years ago

wangkuiyi commented 5 years ago

I see that in our .travis.yml file, we have

https://github.com/wangkuiyi/recordio/blob/1d22ccb5f4abf66e217ed21c41c0c0e37c9b499b/.travis.yml#L23

I tried to run it in a Docker container with Python 3.7 and Go 1.12 compiler installed. However, it fails with the following error messages.

root@5b1d7a99e130:/work/python# python setup.py -q install
$ GOPATH=/tmp/tmp0933ggqq go get -d
/tmp/ccx6kWHo.o: In function `main':
test.c:(.text+0xa): undefined reference to `f'
collect2: error: ld returned 1 exit status
$ CGO_CFLAGS=-I/usr/local/include/python3.7m CGO_LDFLAGS=-Wl,--unresolved-symbols=ignore-all GOPATH=/tmp/tmp0933ggqq go build -buildmode=c-shared -o /work/python/build/lib.linux-x86_64-3.7/recordio/librecordio.cpython-37m-x86_64-linux-gnu.so
zip_safe flag not set; analyzing archive contents...
recordio.__pycache__.librecordio.cpython-37: module references __file__
recordio.__pycache__.recordio.cpython-37: module references __file__

May I know what is the purpose of the command python setup.py -q install? Why does it run in Travis CI but not in my container? How am I supposed to make it running in my container?

ywskycn commented 5 years ago

@wangkuiyi the install may not be needed, "python setup.py install" is to install the python package to current python environment, so other code can import it directly. In this case, we don't need install, but run the test directly. cc @zou000

For the install issue inside docker container, let me double check why.

wangkuiyi commented 5 years ago

I updated and merged https://github.com/wangkuiyi/recordio/pull/32 to provide a Dockerfile. Could you please take a look at it? I can run pip wheel . in a container running that Docker image. But not python setup.py -q test. Thanks!

ywskycn commented 5 years ago

I cannot directly use that the Dockerfile due to network issue when accessing pypi. So I built an image using the Dockerfile until line 8, and do the pip install setuptools-golang pytest-runner pytest (refer to PR38) inside the container and manually pass --extra-index-url=https://mirrors.aliyun.com/pypi/simple to get around network issue.

After that, run python setup.py -q test, and got.

$ GOPATH=/tmp/tmpdyoc1wm9 go get -d
/tmp/ccjmcZcV.o: In function `main':
test.c:(.text+0xa): undefined reference to `f'
collect2: error: ld returned 1 exit status
$ CGO_CFLAGS=-I/usr/local/include/python3.7m CGO_LDFLAGS=-Wl,--unresolved-symbols=ignore-all GOPATH=/tmp/tmpdyoc1wm9 go build -buildmode=c-shared -o /work/python/build/lib.linux-x86_64-3.7/recordio/librecordio.cpython-37m-x86_64-linux-gnu.so
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.12.0
rootdir: /work/python, inifile: setup.cfg
collected 3 items

tests/recordio_test.py ...                                                                                                                                                                           [100%]

============================================================================================= warnings summary =============================================================================================
recordio/recordio.py:8
  /work/python/recordio/recordio.py:8: DeprecationWarning: SO is deprecated, use EXT_SUFFIX
    os.path.dirname(__file__), "librecordio" + get_config_var("SO")

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=================================================================================== 3 passed, 1 warnings in 0.32 seconds ===================================================================================

Unittests can pass but still saw warning/error msgs at the beginning.

wangkuiyi commented 5 years ago

I Googled and found two issues related to the error "undefined reference to f":

  1. https://github.com/golang/go/issues/25752
  2. https://github.com/asottile/setuptools-golang/issues/12

It seems that this error message is not critical. I am closing this issue.