msys2-runtime icon indicating copy to clipboard operation
msys2-runtime copied to clipboard

Using msys2/mingw32 to cross-compile open62541 with conan and MSYS2_ARG_CONV_EXCL

Open ErikTempelaarVO opened this issue 2 years ago • 5 comments

I'm trying to cross-compile open62541 with conan/cmake/msys2/mingw32 and this fails with a particular error relating to paths. I've narrowed it down to this command, invoked by cmake/make as part of a custom_command to generate some files.

/C/.conan/1fbf05/1/bin/msys64/mingw32/bin/python3.10.exe C:/.conan/bd88a7/1/src/tools/generate_datatypes.py --selected-types=C:/.conan/bd88a7/1/src/tools/schema/datatypes_transport.txt --type-bsd=C:/.conan/bd88a7/1/src/tools/schema/Custom.Opc.Ua.Transport.bsd --import=TYPES#C:.conan/bd88a7/1/src/deps/ua-nodeset/Schema/Opc.Ua.Types.bsd --type-csv=C:/.conan/bd88a7/1/src/deps/ua-nodeset/Schema/NodeIds.csv --no-builtin --internal C:/.conan/bd88a7/1/build/Release/src_generated/open62541/transport Traceback (most recent call last): File "C:.conan\bd88a7\1\src\tools\generate_datatypes.py", line 95, in parser.create_types() File "C:/.conan\bd88a7\1\src\tools/nodeset_compiler/type_parser.py", line 384, in create_types self.parse_types() File "C:/.conan\bd88a7\1\src\tools/nodeset_compiler/type_parser.py", line 411, in parse_types self.parseTypeDefinitions(outname_import, file_import) File "C:/.conan\bd88a7\1\src\tools/nodeset_compiler/type_parser.py", line 304, in parseTypeDefinitions xmlDoc = etree.iterparse( File "C:/.conan/1fbf05/1/bin/msys64/mingw32/lib/python3.10/xml/etree/ElementTree.py", line 1272, in iterparse next(it) File "C:/.conan/1fbf05/1/bin/msys64/mingw32/lib/python3.10/xml/etree/ElementTree.py", line 1249, in iterator source = open(source, "rb") FileNotFoundError: [Errno 2] No such file or directory: 'C;.conan\bd88a7\1\src\deps\ua-nodeset\Schema\Opc.Ua.Types.bsd'

Disabling the path conversion altogether works:

MSYS2_ARG_CONV_EXCL=- /C/.conan/1fbf05/1/bin/msys64/mingw32/bin/python3.10.exe C:/.conan/bd88a7/1/src/tools/generate_datatypes.py --selected-types=C:/.conan/bd88a7/1/src/tools/schema/datatypes_transport.txt --type-bsd=C:/.conan/bd88a7/1/src/tools/schema/Custom.Opc.Ua.Transport.bsd --import=TYPES#C:/.conan/bd88a7/1/src/deps/ua-nodeset/Schema/Opc.Ua.Types.bsd --type-csv=C:/.conan/bd88a7/1/src/deps/ua-nodeset/Schema/NodeIds.csv --no-builtin --internal C:/.conan/bd88a7/1/build/Release/src_generated/open62541/transport <No errors>

I updated the python-script with some additional logging to print the arguments.

['C:/.conan/bd88a7/1/src/tools/generate_datatypes.py', '--selected-types=C:/.conan/bd88a7/1/src/tools/schema/datatypes_transport.txt', '--type-bsd=C:/.conan/bd88a7/1/src/tools/schema/Custom.Opc.Ua.Transport.bsd', '--import=TYPES#C;.conan\bd88a7\1\src\deps\ua-nodeset\Schema\Opc.Ua.Types.bsd', '--type-csv=C:/.conan/bd88a7/1/src/deps/ua-nodeset/Schema/NodeIds.csv', '--no-builtin', '--internal', 'C:/.conan/bd88a7/1/build/Release/src_generated/open62541/transport']

The reason I'm asking here is that the issue is specifically with the path that is prefixed with TYPES#, the others are unaffected. Can you help me understand why? Hopefully that'll point me in the right direction to solve this. Thanks!

ErikTempelaarVO avatar Mar 29 '23 13:03 ErikTempelaarVO

If this is not the right place to ask, please tell me where to go.

The docs (here: https://www.msys2.org/wiki/Porting/) point to https://github.com/msys2/path_convert, but that repo is archived since the end of last year.

ErikTempelaarVO avatar Apr 01 '23 07:04 ErikTempelaarVO

Is it possible to reproduce the issue without conan and with msys2 only? It would help to reproduce the issue for those who are not familiar with conan.

Biswa96 avatar Apr 01 '23 08:04 Biswa96

By the way, here is the build recipe for mingw openh264 package https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-open62541/PKGBUILD provided by MSYS2.

Biswa96 avatar Apr 01 '23 08:04 Biswa96

Very nice! I had no idea that there was an open source OPC UA library! Last time I had to deal with OPC UA, everything was closed sourced and paid.

@Biswa96 @ErikTempelaarVO . Just in case, I've updated it to 1.3.5 here https://github.com/msys2/MINGW-packages/pull/16580

hmartinez82 avatar Apr 01 '23 09:04 hmartinez82

@Biswa96 Thanks for the reply.

Here's a minimal example that reproduces the problem with the paths:

$ C:/.conan/1fbf05/1/bin/msys64/mingw32/bin/python.exe -c "import sys; print(sys.argv)" --import=TYPES#C:/.conan/bd88a7/1/src/deps/ua-nodeset/Schema/Opc.Ua.Types.bsd
['-c', '--import=TYPES#C;C:\\.conan\\1fbf05\\1\\bin\\msys64\\.conan\\bd88a7\\1\\src\\deps\\ua-nodeset\\Schema\\Opc.Ua.Types.bsd']

Or this one, even shorter:

/C/Python38/python.exe -c "import sys; print(sys.argv)" --import=TYPES#C:/src/deps/ua-nodeset/Schema/Opc.Ua.Types.bsd

It seems the # is not the problem in itself, only if its preceded by another string. --import=RANDOM@ gives a similar result if followed by a path.

ErikTempelaarVO avatar Apr 02 '23 14:04 ErikTempelaarVO