From d866ba3971ed2990d0c855f2ea51a98824e3ebdc Mon Sep 17 00:00:00 2001 From: Felix Schaller Date: Fri, 3 Feb 2023 00:38:40 +0100 Subject: [PATCH 1/7] =?UTF-8?q?Fix=20Python=20CFFI=20error=20LNK2001:=20un?= =?UTF-8?q?resolved=20external=20symbol=20PyInit=5F=5F=E2=80=A6=20by=20Sol?= =?UTF-8?q?ution=20from:=20https://techoverflow.net/2022/01/23/how-to-fix-?= =?UTF-8?q?python-cffi-error-lnk2001-unresolved-external-symbol-pyinit=5F?= =?UTF-8?q?=5F/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyrtools/Windows.c | 5 +++++ setup.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 pyrtools/Windows.c diff --git a/pyrtools/Windows.c b/pyrtools/Windows.c new file mode 100644 index 0000000..e4dec3a --- /dev/null +++ b/pyrtools/Windows.c @@ -0,0 +1,5 @@ +/** + * This contains hacks to get the installation on Windows working. + * This fixes error LNK2001: unresolved external symbol PyInit__cv_algorithms + */ +void PyInit_wrapConv(void) { } \ No newline at end of file diff --git a/setup.py b/setup.py index b1e5b71..a9ceb53 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,7 @@ pyrtools_version_spec.loader.exec_module(pyrtools_version_module) VERSION = pyrtools_version_module.version +platform_src = ["pyrtools/windows.c"] if os.name == 'nt' else [] setup( name='pyrtools', @@ -35,7 +36,7 @@ sources=['pyrtools/pyramids/c/convolve.c', 'pyrtools/pyramids/c/edges.c', 'pyrtools/pyramids/c/wrap.c', - 'pyrtools/pyramids/c/internal_pointOp.c'], + 'pyrtools/pyramids/c/internal_pointOp.c'] + platform_src, depends=['pyrtools/pyramids/c/convolve.h', 'pyrtools/pyramids/c/internal_pointOp.h'], extra_compile_args=['-fPIC', '-shared'])], From 62bb743ed20e92e56fb53b981943fde24bb2ad24 Mon Sep 17 00:00:00 2001 From: Felix Schaller Date: Fri, 3 Feb 2023 01:12:57 +0100 Subject: [PATCH 2/7] fix Library lookup for windows environments --- pyrtools/pyramids/c/wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrtools/pyramids/c/wrapper.py b/pyrtools/pyramids/c/wrapper.py index bb88bf3..f7b17e2 100644 --- a/pyrtools/pyramids/c/wrapper.py +++ b/pyrtools/pyramids/c/wrapper.py @@ -9,7 +9,7 @@ # the wrapConv.so file can have some system information after it from the compiler, so we just find # whatever it is called -libpath = glob.glob(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'wrapConv*.so')) +libpath = glob.glob(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'wrapConv*.*')) # print(libpath) # load the c library From 1ca1ee3dfc235397e64d4ea01f73cb4f1183c037 Mon Sep 17 00:00:00 2001 From: freshNfunky Date: Fri, 3 Feb 2023 13:25:44 +0100 Subject: [PATCH 3/7] Update README.md add some Notes to the Readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index d79671d..88e4a37 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +------------------------------ +patched by: +Felix Schaller +(c) felixschaller.com +########################################################################################################################################################### +WARNING: this patch solves the "fix Python CFFI error LNK2001: unresolved external symbol PyInit__…" compile problem. But it yet requires an interface fpr python. For more Info see the Documention here: https://docs.python.org/3/extending/building.html and here: https://www.codeproject.com/articles/820116/embedding-python-program-in-a-c-cplusplus-code +########################################################################################################################################################### + # pyrtools: tools for multi-scale image processing [![PyPI Version](https://img.shields.io/pypi/v/pyrtools.svg)](https://pypi.org/project/pyrtools/) From 66eddd94ad3208ec7e010747396fe0219bc028c0 Mon Sep 17 00:00:00 2001 From: freshNfunky Date: Fri, 3 Feb 2023 13:26:08 +0100 Subject: [PATCH 4/7] Update README.md update Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88e4a37..49fbc4a 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ patched by: Felix Schaller (c) felixschaller.com -########################################################################################################################################################### +######################################################################### WARNING: this patch solves the "fix Python CFFI error LNK2001: unresolved external symbol PyInit__…" compile problem. But it yet requires an interface fpr python. For more Info see the Documention here: https://docs.python.org/3/extending/building.html and here: https://www.codeproject.com/articles/820116/embedding-python-program-in-a-c-cplusplus-code -########################################################################################################################################################### +######################################################################### # pyrtools: tools for multi-scale image processing From 8bbad85e6cb11cc5e37bfc0bddb17f5fc0dc0d04 Mon Sep 17 00:00:00 2001 From: freshNfunky Date: Fri, 3 Feb 2023 13:26:43 +0100 Subject: [PATCH 5/7] Update README.md update --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 49fbc4a..625af9f 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,12 @@ patched by: Felix Schaller (c) felixschaller.com -######################################################################### + +######################################################################### \\ + WARNING: this patch solves the "fix Python CFFI error LNK2001: unresolved external symbol PyInit__…" compile problem. But it yet requires an interface fpr python. For more Info see the Documention here: https://docs.python.org/3/extending/building.html and here: https://www.codeproject.com/articles/820116/embedding-python-program-in-a-c-cplusplus-code -######################################################################### + +######################################################################### \\ # pyrtools: tools for multi-scale image processing From 57d7be9d332882d80b7bfa4d45ddcb087dc767d3 Mon Sep 17 00:00:00 2001 From: freshNfunky Date: Fri, 3 Feb 2023 13:27:56 +0100 Subject: [PATCH 6/7] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 625af9f..21f527f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ------------------------------ -patched by: -Felix Schaller -(c) felixschaller.com +patched by:\ +Felix Schaller\ +(c) 2023 felixschaller.com\ ######################################################################### \\ From fff67534f77f1c72bb6192d79707147609a7481b Mon Sep 17 00:00:00 2001 From: freshNfunky Date: Fri, 3 Feb 2023 13:28:17 +0100 Subject: [PATCH 7/7] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 21f527f..8c94e21 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ ------------------------------ -patched by:\ -Felix Schaller\ -(c) 2023 felixschaller.com\ +patched by: \ +Felix Schaller \ +(c) 2023 felixschaller.com \ -######################################################################### \\ +######################################################################### \ WARNING: this patch solves the "fix Python CFFI error LNK2001: unresolved external symbol PyInit__…" compile problem. But it yet requires an interface fpr python. For more Info see the Documention here: https://docs.python.org/3/extending/building.html and here: https://www.codeproject.com/articles/820116/embedding-python-program-in-a-c-cplusplus-code -######################################################################### \\ +######################################################################### \ # pyrtools: tools for multi-scale image processing