nrn icon indicating copy to clipboard operation
nrn copied to clipboard

Windows RxD CI is broken

Open alexsavulescu opened this issue 3 years ago • 18 comments

Latest msys package mingw-w64-x86_64-gcc-11.2.0-1 breaks the install.

1st issue: '/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/liblto_plugin-0.dll': No such file or directory 2nd subsequent issue: changing liblto_plugin-0.dll to liblto_plugin.dll fixes installer issue, but rxd testing fails:

test_rxd (neuron.tests.test_rxd.RxDTestCase) ... Traceback (most recent call last):
  File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1871, in _init
    initializer._do_init()
  File "C:\nrn_test\lib\python\neuron\rxd\initializer.py", line 58, in _do_init
    rxd._init()
  File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1894, in _init
    _compile_reactions()
  File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1506, in _compile_reactions
    _c_compile(fxn_string),
  File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 564, in _c_compile
    dll = ctypes.cdll["%s.so" % os.path.abspath(filename)]
  File "C:\Python36\lib\ctypes\__init__.py", line 423, in __getitem__
    return getattr(self, name)
  File "C:\Python36\lib\ctypes\__init__.py", line 418, in __getattr__
    dll = self._dlltype(name)
  File "C:\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

alexsavulescu avatar Nov 04 '21 21:11 alexsavulescu

Haven't been able to reproduce locally. Looks like the windows image (Azure/GHA) has the latest gcc already installed via msys2.

In order to get gcc 11.2.0 from a fresh msys2 local install :

pacman -Syu
pacman -Su

Trying the Windows Installer from https://github.com/neuronsimulator/nrn/pull/1521 also worked, but in this case I had to upgrade numpy. It is likely that numpy has something to do with the aforementioned issue.

alexsavulescu avatar Nov 05 '21 15:11 alexsavulescu

On upgrading msys2 via pacman -Syu, etc, I see the same build problem using my mingw_files/howto-cmake 36 37 38 39

cp: cannot stat '/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/liblto_plugin-0.dll': No such file or directory

and with your suggestion about liblto_plugin.dll the build with make setup_exe succeeded. Actually, I'm not sure how to run the tests on windows, so didn't get to the rxd tests. @ramcdougal any thoughts?

nrnhines avatar Nov 05 '21 17:11 nrnhines

python -c "import neuron; neuron.test_rxd(); quit()" should suffice for testing

alexsavulescu avatar Nov 05 '21 18:11 alexsavulescu

In my context (the virtual box guest that built and installed, and the bash.exe icon in the Desktop/NEURON8.0AMD64 folder.)

bash-5.1$ e:/python39/python  -c "import neuron; neuron.test_rxd(); quit()"
test_ecs_diffusion_fixed_step (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_coarse (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_fine (neuron.tests.test_rxd.RxDTestCase) ... ok
test_rxd (neuron.tests.test_rxd.RxDTestCase) ... Traceback (most recent call last):
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 1871, in _init
    initializer._do_init()
  File "C:\nrn\lib\python\neuron\rxd\initializer.py", line 58, in _do_init
    rxd._init()
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 1894, in _init
    _compile_reactions()
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 1506, in _compile_reactions
    _c_compile(fxn_string),
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 524, in _c_compile
    with open(filename + ".c", "w") as f:
PermissionError: [Errno 13] Permission denied: 'rxddllec198bc2-3e68-11ec-ab04-080027399180.c'

Maybe I don't have a all the python modules needed for these tests?

nrnhines avatar Nov 05 '21 18:11 nrnhines

after Successfully installed numpy-1.21.0

bash-5.1$ e:/python39/python  -c "import neuron; neuron.test_rxd(); quit()"
test_ecs_diffusion_fixed_step (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_coarse (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_fine (neuron.tests.test_rxd.RxDTestCase) ... ok
test_rxd (neuron.tests.test_rxd.RxDTestCase) ... ok

nrnhines avatar Nov 05 '21 19:11 nrnhines

Tried Python3.7 and with the existing numpy 1.15.4 see the Permission denied: 'rxddllab51f9fe-3efc-11ec-a9f7-080027399180.c'. After upgrading pip and numpy (1.21.4) still see the same error

bash-5.1$ python -c 'import sys; print(sys.version); import numpy; print (numpy.__version__); import neuron; neuron.test
_rxd(); quit()'
3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
1.21.4
test_ecs_diffusion_fixed_step (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_coarse (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_fine (neuron.tests.test_rxd.RxDTestCase) ... ok
test_rxd (neuron.tests.test_rxd.RxDTestCase) ... Traceback (most recent call last):
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 1871, in _init
    initializer._do_init()
  File "C:\nrn\lib\python\neuron\rxd\initializer.py", line 58, in _do_init
    rxd._init()
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 1894, in _init
    _compile_reactions()
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 1506, in _compile_reactions
    _c_compile(fxn_string),
  File "C:\nrn\lib\python\neuron\rxd\rxd.py", line 524, in _c_compile
    with open(filename + ".c", "w") as f:
PermissionError: [Errno 13] Permission denied: 'rxddll6ac3acba-3efe-11ec-ac23-080027399180.c'

And now I'm getting the same error with Python3.9 instead of, as mentioned above,

test_rxd (neuron.tests.test_rxd.RxDTestCase) ... ok

Note: between the successful and unsuccessful Python3.9 tests, I did install e:/Python310, but wouldn't expect that to be a problem. Also experiencing same problem with Python3.10

nrnhines avatar Nov 06 '21 13:11 nrnhines

The problems with Permission denied: 'rxddllc4396552-3fef-11ec-ae73-080027399180.c' were because python was launched in c:/. No problem when launched in c:/tmp.

nrnhines avatar Nov 07 '21 17:11 nrnhines

I'm perplexed. The manual build with

$ for i in 36 37 38 39 310 ; do e:/python$i/python -c 'import numpy; print(numpy.__version__); quit()' ; done1.19.5
1.19.5
1.19.5
1.19.5
1.21.4

is working when installed and using the nrn bash terminal

bash-5.1$ cd tmp
bash-5.1$ for i in 36 37 38 39 310 ; do e:/python$i/python -c 'import neuron; neuron.test_rxd(); quit()' ; done
test_ecs_diffusion_fixed_step (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_coarse (neuron.tests.test_rxd.RxDTestCase) ... ok
test_ecs_diffusion_variable_step_fine (neuron.tests.test_rxd.RxDTestCase) ... ok
test_rxd (neuron.tests.test_rxd.RxDTestCase) ... ok

----------------------------------------------------------------------
Ran 4 tests in 10.781s
... four more just like it

but the CI for windows is generating (for 3.6 to 3.9)

2021-11-07T19:32:43.9247632Z D:\a\1\s>C:\Python36\python.exe -m pip install numpy==1.19.5   || goto :error 
...
2021-11-07T19:32:48.7763784Z Successfully installed numpy-1.19.5
...
2021-11-07T19:41:26.3853087Z D:\a\1\s>C:\Python36\python -c "import neuron; neuron.test(); neuron.test_rxd(); quit()"   || set "errorfound=y" 
...
2021-11-07T19:41:29.9713620Z test_ecs_diffusion_fixed_step (neuron.tests.test_rxd.RxDTestCase) ... ok
2021-11-07T19:41:30.4626423Z test_ecs_diffusion_variable_step_coarse (neuron.tests.test_rxd.RxDTestCase) ... ok
2021-11-07T19:41:30.9387592Z test_ecs_diffusion_variable_step_fine (neuron.tests.test_rxd.RxDTestCase) ... ok
2021-11-07T19:41:32.9591433Z test_rxd (neuron.tests.test_rxd.RxDTestCase) ... Traceback (most recent call last):
2021-11-07T19:41:32.9592227Z   File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1871, in _init
2021-11-07T19:41:32.9592662Z     initializer._do_init()
2021-11-07T19:41:32.9593126Z   File "C:\nrn_test\lib\python\neuron\rxd\initializer.py", line 58, in _do_init
2021-11-07T19:41:32.9593519Z     rxd._init()
2021-11-07T19:41:32.9593914Z   File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1894, in _init
2021-11-07T19:41:32.9594315Z     _compile_reactions()
2021-11-07T19:41:32.9594739Z   File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1506, in _compile_reactions
2021-11-07T19:41:32.9595161Z     _c_compile(fxn_string),
2021-11-07T19:41:32.9595573Z   File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 564, in _c_compile
2021-11-07T19:41:32.9596011Z     dll = ctypes.cdll["%s.so" % os.path.abspath(filename)]
2021-11-07T19:41:32.9596462Z   File "C:\Python36\lib\ctypes\__init__.py", line 423, in __getitem__
2021-11-07T19:41:32.9596867Z     return getattr(self, name)
2021-11-07T19:41:32.9597280Z   File "C:\Python36\lib\ctypes\__init__.py", line 418, in __getattr__
2021-11-07T19:41:32.9597690Z     dll = self._dlltype(name)
2021-11-07T19:41:32.9598095Z   File "C:\Python36\lib\ctypes\__init__.py", line 348, in __init__
2021-11-07T19:41:32.9598502Z     self._handle = _dlopen(self._name, mode)
2021-11-07T19:41:32.9598916Z OSError: [WinError 193] %1 is not a valid Win32 application

... 3 more just like it

nrnhines avatar Nov 07 '21 22:11 nrnhines

Must have something to do with the CI runners (Azure and GHA share the same image).

alexsavulescu avatar Nov 08 '21 08:11 alexsavulescu

@adamjhn looks like the issue is coming from def _c_compile(formula): in rxd.py in dll = ctypes.cdll["%s.so" % os.path.abspath(filename)]. Would you have any idea?

alexsavulescu avatar Nov 08 '21 09:11 alexsavulescu

I wonder if the toolchain we supply now for the latest msys2 incomplete. Might be useful,for debugging, if it could be made more verbose.

nrnhines avatar Nov 08 '21 11:11 nrnhines

Couldn't find any difference between GHA/Azure and my virtualbox image by comparing the GCC commands issued via _c_compile. I did find a difference wrt to the SOs and missing msvcrt.dll on GHA:

# GHA
runneradmin@fv-az102-753 MINGW64 /d/a/nrn/nrn
$ ldd rxddllefa08bf1-4173-11ec-939f-002248779a5d.so
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff93f1c0000)
        KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff93c5a0000)
        KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff93bd10000)

vs

# Win VBox
savulesc@DESKTOP-QB117K7 MINGW64 /c/Users/savulesc
$ ldd  rxddllb22db1c5-4170-11ec-b5b7-08002731c1c0.so
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffbba770000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffbb91f0000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffbb83c0000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffbb98e0000)

Maybe this explains OSError: [WinError 193] %1 is not a valid Win32 application

GCC command and output:

gcc_cmd = C:\nrn_test\mingw\mingw64\bin\x86_64-w64-mingw32-gcc.exe -IC:\Python37\Include -IC:\nrn_test\..\..\include\nrn -v -shared   rxddlld9b50388-4173-11ec-8686-002248779a5d.c C:\nrn_test\bin\librxdmath.dll -o rxddlld9b50388-4173-11ec-8686-002248779a5d.so 
###############
Outputz: Using built-in specs.
COLLECT_GCC=C:\nrn_test\mingw\mingw64\bin\x86_64-w64-mingw32-gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-11.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --wit...
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Rev1, Built by MSYS2 project) 
COLLECT_GCC_OPTIONS='-I' 'C:\Python37\Include' '-I' 'C:\nrn_test\..\..\include\nrn' '-v' '-shared' '-o' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so' '-mtune=generic' '-march=x86-64' '-dumpdir' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so-'
 C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/cc1.exe -quiet -v -I C:\Python37\Include -I C:\nrn_test\..\..\include\nrn -iprefix C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/ -D_REENTRANT rxddlld9b50388-4173-11ec-8686-002248779a5d.c -quiet -dumpdir rxddlld9b50388-4173-11ec-8686-002248779a5d.so- -dumpbase rxddlld9b50388-4173-11ec-8686-002248779a5d.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -o C:\Users\RUNNER~1\AppData\Local\Temp\cchbXPil.s
GNU C17 (Rev1, Built by MSYS2 project) version 11.2.0 (x86_64-w64-mingw32)
	compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../include"
ignoring duplicate directory "C:/nrn_test/mingw/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/11.2.0/include"
ignoring nonexistent directory "D:/a/_temp/msys64/mingw64/include"
ignoring nonexistent directory "/mingw64/include"
ignoring duplicate directory "C:/nrn_test/mingw/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed"
ignoring duplicate directory "C:/nrn_test/mingw/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "D:/a/_temp/msys64/mingw64/x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:\nrn_test\..\..\include\nrn"
#include "..." search starts here:
#include <...> search starts here:
 C:\Python37\Include
 C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/include
 C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed
 C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C17 (Rev1, Built by MSYS2 project) version 11.2.0 (x86_64-w64-mingw32)
	compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 897684f6bd95d46b7e0f23c8f6f5aafc
COLLECT_GCC_OPTIONS='-I' 'C:\Python37\Include' '-I' 'C:\nrn_test\..\..\include\nrn' '-v' '-shared' '-o' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so' '-mtune=generic' '-march=x86-64' '-dumpdir' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so-'
 as -v -I C:\Python37\Include -I C:\nrn_test\..\..\include\nrn -o C:\Users\RUNNER~1\AppData\Local\Temp\cc2KRpAy.o C:\Users\RUNNER~1\AppData\Local\Temp\cchbXPil.s
GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30
COMPILER_PATH=C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/;C:/nrn_test/mingw/mingw64/bin/../lib/gcc/
LIBRARY_PATH=C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/;C:/nrn_test/mingw/mingw64/bin/../lib/gcc/;C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../lib/;C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/;C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../
COLLECT_GCC_OPTIONS='-I' 'C:\Python37\Include' '-I' 'C:\nrn_test\..\..\include\nrn' '-v' '-shared' '-o' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so' '-mtune=generic' '-march=x86-64' '-dumpdir' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so.'
 ld -plugin C:/nrn_test/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/liblto_plugin.dll -plugin-opt= -plugin-opt=-fresolution=C:\Users\RUNNER~1\AppData\Local\Temp\ccFcEA2O.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lkernel32 -m i386pep --shared -Bdynamic -e DllMainCRTStartup --enable-auto-image-base -o rxddlld9b50388-4173-11ec-8686-002248779a5d.so C:/nrn_test/mingw/mingw64/bin/../lib/gc...
COLLECT_GCC_OPTIONS='-I' 'C:\Python37\Include' '-I' 'C:\nrn_test\..\..\include\nrn' '-v' '-shared' '-o' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so' '-mtune=generic' '-march=x86-64' '-dumpdir' 'rxddlld9b50388-4173-11ec-8686-002248779a5d.so.'
	ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff93f1c0000)
	KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff93c5a0000)
	KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff93bd10000)
test_rxd (neuron.tests.test_rxd.RxDTestCase) ... Traceback (most recent call last):
  File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1886, in _init
    initializer._do_init()
  File "C:\nrn_test\lib\python\neuron\rxd\initializer.py", line 58, in _do_init
    rxd._init()
  File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1909, in _init
    _compile_reactions()

  File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 1521, in _compile_reactions
0
    _c_compile(fxn_string),
filename D:\a\nrn\nrn\rxddlld9b50388-4173-11ec-8686-002248779a5d
File "C:\nrn_test\lib\python\neuron\rxd\rxd.py", line 579, in _c_compile
ctypes.cdll:{'_dlltype': <class 'ctypes.CDLL'>, 'C:\\nrn_test\\bin\\libnrniv.dll': <CDLL 'C:\nrn_test\bin\libnrniv.dll', handle 7ff90cd00000 at 0x29962c5cd48>, 'C:\\nrn_test\\bin\\libnrnpython37.dll': <CDLL 'C:\nrn_test\bin\libnrnpython37.dll', handle 7ff930b40000 at 0x29962c3e248>, 'C:\\nrn_test\\bin\\librxdmath.dll': <CDLL 'C:\nrn_test\bin\librxdmath.dll', handle 7ff930c10000 at 0x299654321c8>}
    dll = ctypes.CDLL("%s.so" % os.path.abspath(filename))
  File "C:\Python37\lib\ctypes\__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

alexsavulescu avatar Nov 09 '21 16:11 alexsavulescu

Tried all GHA/Azure windows images (2022, 2019, 2016) and the same issue occurs. Also tried to build the rxd extensions with mingw (via #1339) just to rule that VC build is not interfering somehow.

alexsavulescu avatar Nov 11 '21 08:11 alexsavulescu

Is it the case that the common factor in all this is the latest msys2? But it is a puzzle why the manual builds on, for example, my virtualbox windows guest don't have the OSError: [WinError 193] %1 is not a valid Win32 application issue. I suppose I could try starting from a fresh bare vb windows guest. But your observation about msvcrt.dll does seem like an important clue :)

nrnhines avatar Nov 11 '21 10:11 nrnhines

Is it the case that the common factor in all this is the latest msys2?

That's what I'm trying to ascertain. But it could be something related to the images as well (looks like they were all updated recently) or a combination of both. I'm trying to use the chocolatey install where it still uses gcc 10, but running into other issues: #1529

I suppose I could try starting from a fresh bare vb windows guest

This is what I also tried (see my 2nd comment) and I couldn't reproduce the issue.

In another train of thoughts, it would have helped to have a different CI vendor since GHA and Azure share the same images.

alexsavulescu avatar Nov 11 '21 11:11 alexsavulescu

To make sure I was seeing all the stderr, I replaced os.system with subprocess.run for the gcc_cmd and also listed the folder and ran cygcheck on the .so file.

-        os.system(gcc_cmd)
-        os.system("cygcheck " + filename + ".so")
+        #os.system(gcc_cmd)
+        result = subprocess.run(gcc_cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+        print(result.returncode, result.stdout, result.stderr)
+        os.system("ls")
+        os.system("cygcheck ./" + filename + ".so")

Note that cygcheck outputs

2021-11-13T15:05:57.8322989Z D:\a\nrn\nrn\rxddll342d0714-4493-11ec-84e7-000d3a6dfc52.so
2021-11-13T15:05:57.8323965Z   C:\Windows\system32\KERNEL32.dll
2021-11-13T15:05:57.8325051Z     C:\Program Files\PowerShell\7\api-ms-win-core-rtlsupport-l1-1-0.dll
2021-11-13T15:05:57.8326122Z     C:\Windows\system32\ntdll.dll
2021-11-13T15:05:57.8326715Z     C:\Windows\system32\KERNELBASE.dll
...
2021-11-13T15:05:57.8395531Z   C:\Windows\system32\msvcrt.dll

So my focus on msvcrt.dll seems misplaced. The raw log of the ci output is strangely out of order. On my vb windows guest the order is as expected. I.e. gcc_cmd output, ls, cygcheck, (and no traceback because there was no error) But the ci raw log displays ls, cygcheck, traceback, and gcc_cmd output.

nrnhines avatar Nov 14 '21 13:11 nrnhines

I guess the output gets out of order in conjunction with exception processing

alexsavulescu avatar Nov 14 '21 13:11 alexsavulescu

Win32???

I don't understand what's happening here? The reactions aren't compiling? Are we really testing on a 32 bit system? Should still work but confusing.

ramcdougal avatar Dec 07 '21 12:12 ramcdougal

Done in #1623

alexsavulescu avatar Mar 18 '23 11:03 alexsavulescu