pyx.build: Fix it on macOS (v↑ setuptools_dso (1.4 -> 1.6))
Starting from setuptools-dso 1.6 pyx.build no longer fails on macOS due to: https://github.com/mdavidsaver/setuptools_dso/commit/dd2cf303 https://github.com/mdavidsaver/setuptools_dso/commit/6883d6dc https://github.com/mdavidsaver/setuptools_dso/commit/78ae8852 https://github.com/mdavidsaver/setuptools_dso/pull/9 https://github.com/mdavidsaver/setuptools_dso/issues/8 It was previously failing with setuptools-dso==1.5: (py3.venv) kirr@Kirills-iMac pygolang % python -m pytest ==================================== test session starts ===================================== platform darwin -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1 rootdir: /Users/kirr/pygolang collected 100 items golang/_gopath_test.py .. [ 2%] golang/context_test.py .. [ 4%] golang/cxx_test.py .. [ 6%] golang/errors_test.py ........ [ 14%] golang/fmt_test.py ... [ 17%] golang/golang_test.py ............................................. [ 62%] golang/io_test.py . [ 63%] golang/strconv_test.py .. [ 65%] golang/strings_test.py ..... [ 70%] golang/sync_test.py ............. [ 83%] golang/time_test.py ........ [ 91%] golang/pyx/build_test.py FF. [ 94%] golang/pyx/runtime_test.py . [ 95%] gpython/gpython_test.py ssss. [100%] ========================================== FAILURES ========================================== _______________________________________ test_pyx_build _______________________________________ def test_pyx_build(): pyxuser = testprog + "/golang_pyx_user" pyrun(["setup.py", "build_ext", "-i"], cwd=pyxuser) # run built test. _ = pyout(["-c", # XXX `import golang` is a hack: it dynamically loads _golang.so -> libgolang.so, # and this way dynamic linker already has libgolang.so DSO found and in # memory for all further imports. If we don't, current state of setuptools_dso # is that `import pyxuser.test` will fail finding libgolang.so. "import golang;" + > "from pyxuser import test; test.main()"], cwd=pyxuser) golang/pyx/build_test.py:40: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ golang/golang_test.py:1709: in pyout return pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ argv = ['-c', 'import golang;from pyxuser import test; test.main()'], stdin = None, stdout = b'', stderr = None kw = {'cwd': '/Users/kirr/pygolang/golang/pyx/testprog/golang_pyx_user'}, retcode = 1 def pyrun(argv, stdin=None, stdout=None, stderr=None, **kw): retcode, stdout, stderr = _pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw) if retcode: > raise RuntimeError(' '.join(argv) + '\n' + (stderr and str(stderr) or '(failed)')) E RuntimeError: -c import golang;from pyxuser import test; test.main() E (failed) golang/golang_test.py:1703: RuntimeError ------------------------------------ Captured stdout call ------------------------------------ running build_ext cythoning pyxuser/test.pyx to pyxuser/test.cpp building 'pyxuser.test' extension creating build creating build/temp.macosx-10.15-x86_64-3.7 creating build/temp.macosx-10.15-x86_64-3.7/pyxuser clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/Users/kirr/pygolang -I/Users/kirr/py3.venv/bin/../include/site/python3.7 -I/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c pyxuser/test.cpp -o build/temp.macosx-10.15-x86_64-3.7/pyxuser/test.o -std=c++11 -fno-strict-aliasing creating build/lib.macosx-10.15-x86_64-3.7 creating build/lib.macosx-10.15-x86_64-3.7/pyxuser clang++ -bundle -undefined dynamic_lookup build/temp.macosx-10.15-x86_64-3.7/pyxuser/test.o -L/Users/kirr/pygolang/golang/runtime -llibgolang -o build/lib.macosx-10.15-x86_64-3.7/pyxuser/test.cpython-37m-darwin.so otool -L build/lib.macosx-10.15-x86_64-3.7/pyxuser/test.cpython-37m-darwin.so build/lib.macosx-10.15-x86_64-3.7/pyxuser/test.cpython-37m-darwin.so: @loader_path/liblibgolang.0.1.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0) install_name_tool -change @loader_path/liblibgolang.0.1.dylib @loader_path/../golang/runtime/liblibgolang.0.1.dylib build/lib.macosx-10.15-x86_64-3.7/pyxuser/test.cpython-37m-darwin.so otool -L build/lib.macosx-10.15-x86_64-3.7/pyxuser/test.cpython-37m-darwin.so build/lib.macosx-10.15-x86_64-3.7/pyxuser/test.cpython-37m-darwin.so: @loader_path/../golang/runtime/liblibgolang.0.1.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0) copying build/lib.macosx-10.15-x86_64-3.7/pyxuser/test.cpython-37m-darwin.so -> pyxuser ------------------------------------ Captured stderr call ------------------------------------ Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: dlopen(/Users/kirr/pygolang/golang/pyx/testprog/golang_pyx_user/pyxuser/test.cpython-37m-darwin.so, 2): Library not loaded: @loader_path/../golang/runtime/liblibgolang.0.1.dylib Referenced from: /Users/kirr/pygolang/golang/pyx/testprog/golang_pyx_user/pyxuser/test.cpython-37m-darwin.so Reason: image not found _______________________________________ test_dso_build _______________________________________ def test_dso_build(): dsouser = testprog + "/golang_dso_user" pyrun(["setup.py", "build_dso", "-i"], cwd=dsouser) pyrun(["setup.py", "build_ext", "-i"], cwd=dsouser) # run built test. _ = pyout(["-c", # XXX `import golang` is a hack - see test_pyx_build for details. "import golang;" + > "from dsouser import test; test.main()"], cwd=dsouser) golang/pyx/build_test.py:54: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ golang/golang_test.py:1709: in pyout return pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ argv = ['-c', 'import golang;from dsouser import test; test.main()'], stdin = None, stdout = b'', stderr = None kw = {'cwd': '/Users/kirr/pygolang/golang/pyx/testprog/golang_dso_user'}, retcode = 1 def pyrun(argv, stdin=None, stdout=None, stderr=None, **kw): retcode, stdout, stderr = _pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw) if retcode: > raise RuntimeError(' '.join(argv) + '\n' + (stderr and str(stderr) or '(failed)')) E RuntimeError: -c import golang;from dsouser import test; test.main() E (failed) golang/golang_test.py:1703: RuntimeError ------------------------------------ Captured stdout call ------------------------------------ running build_dso Building DSOs building 'dsouser.dso' DSO as build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib creating build creating build/temp.macosx-10.15-x86_64-3.7 creating build/temp.macosx-10.15-x86_64-3.7/dsouser clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/Users/kirr/pygolang -c dsouser/dso.cpp -o build/temp.macosx-10.15-x86_64-3.7/dsouser/dso.o -std=c++11 -fno-strict-aliasing creating build/lib.macosx-10.15-x86_64-3.7 creating build/lib.macosx-10.15-x86_64-3.7/dsouser clang++ -dynamiclib -undefined dynamic_lookup build/temp.macosx-10.15-x86_64-3.7/dsouser/dso.o -L/Users/kirr/pygolang/golang/runtime -llibgolang -o build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib -install_name @loader_path/libdso.dylib otool -L build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib: @loader_path/libdso.dylib (compatibility version 0.0.0, current version 0.0.0) @loader_path/liblibgolang.0.1.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0) install_name_tool -change @loader_path/liblibgolang.0.1.dylib @loader_path/../golang/runtime/liblibgolang.0.1.dylib build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib otool -L build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib: @loader_path/libdso.dylib (compatibility version 0.0.0, current version 0.0.0) @loader_path/../golang/runtime/liblibgolang.0.1.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0) copying build/lib.macosx-10.15-x86_64-3.7/dsouser/libdso.dylib -> dsouser running build_ext cythoning dsouser/test.pyx to dsouser/test.cpp building 'dsouser.test' extension clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/Users/kirr/pygolang -I/Users/kirr/py3.venv/bin/../include/site/python3.7 -I/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c dsouser/test.cpp -o build/temp.macosx-10.15-x86_64-3.7/dsouser/test.o -std=c++11 -fno-strict-aliasing clang++ -bundle -undefined dynamic_lookup build/temp.macosx-10.15-x86_64-3.7/dsouser/test.o -L/Users/kirr/pygolang/golang/runtime -Lbuild/lib.macosx-10.15-x86_64-3.7/dsouser -llibgolang -ldso -o build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so otool -L build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so: @loader_path/liblibgolang.0.1.dylib (compatibility version 0.0.0, current version 0.0.0) @loader_path/libdso.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0) install_name_tool -change @loader_path/liblibgolang.0.1.dylib @loader_path/../golang/runtime/liblibgolang.0.1.dylib build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so install_name_tool -change @loader_path/libdso.dylib @loader_path/./libdso.dylib build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so otool -L build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so: @loader_path/../golang/runtime/liblibgolang.0.1.dylib (compatibility version 0.0.0, current version 0.0.0) @loader_path/./libdso.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0) copying build/lib.macosx-10.15-x86_64-3.7/dsouser/test.cpython-37m-darwin.so -> dsouser ------------------------------------ Captured stderr call ------------------------------------ Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: dlopen(/Users/kirr/pygolang/golang/pyx/testprog/golang_dso_user/dsouser/test.cpython-37m-darwin.so, 2): Library not loaded: @loader_path/../golang/runtime/liblibgolang.0.1.dylib Referenced from: /Users/kirr/pygolang/golang/pyx/testprog/golang_dso_user/dsouser/test.cpython-37m-darwin.so Reason: image not found ========================== 2 failed, 94 passed, 4 skipped in 20.26s ==========================
Showing
Please register or sign in to comment