vanetza icon indicating copy to clipboard operation
vanetza copied to clipboard

Building Vanetza on Windows

Open HpLightcorner opened this issue 4 years ago • 5 comments

Hi @riebl, Linked to our discussion: https://github.com/riebl/artery/issues/184

I am currently building Vanetza on Windows, I finally got everything to build except ASN1: https://github.com/riebl/vanetza/blob/15de29825e6e8c3f6a1a88c06e1a755e127ef657/vanetza/asn1/support/INTEGER.c#L114

It fails with:

[build] C:/_work/repos/artery/extern/vanetza/vanetza/asn1/support/INTEGER.c: In function 'INTEGER__dump':
[build] C:/_work/repos/artery/extern/vanetza/vanetza/asn1/support/INTEGER.c:156:9: error: expected ')' before 'PRIdMAX'
[build]   156 |      "%" ASN_PRIdMAX " (%s)", value, el->enum_name);
[build]       |         ^
[build]       |         )

It seems like a preprocessor error? If I got it right, this should somehow be replaced to the correct formatting-string: "%" ASN_PRIdMAX " (%s)" - for this example this should be: %i (%s) - right?

HpLightcorner avatar May 11 '21 07:05 HpLightcorner

Found the issue... An include-statement was missing... I had to add #include <inttypes.h> to asn_system.h. However, I fail to link with errors coming from GeneralizedTime.c.

There are a lot of preprocessor-defines present to distinguish between platforms, so I got the following questions now:

  • When defining for CYGWIN, I guess we can add MINGW32 here as well?
  • The code is using setenv and unsetenv, both seem to be missing on MSYS2/OMneT++ Windows environment. Any suggestions?

Quite hard to find the missing link without fully understanding the code. Also, I assume that I can Ingnore all those warnings like localtime_r is implemented via localtime(), which may be not thread-safe?

HpLightcorner avatar May 11 '21 08:05 HpLightcorner

I also think it is "safe" to ignore the warnings about thread safety. The ASN.1 code is either generated by asn1c or skeleton code provided by asn1c, i.e. manual changes are likely to get overwritten at some point. If changes are necessary, I have to incorporate them into CMake to always get properly patched generated code. Honestly speaking, I don't know if there are differences between CYGWIN and MINGW32. Regarding the setenv and unsetenv issue: This code is not actively used by Vanetza. Any stub implementation doing nothing would be an acceptable workaround from my point of view.

riebl avatar May 11 '21 11:05 riebl

Hmm, fixing hat in CMake is then for sure necessary. I will focus a few days on getting the CMake Package down before patching Vanzeta for Windows Builds adding stub implementation, but that should be an easy fix.

HpLightcorner avatar May 12 '21 08:05 HpLightcorner

Hi @HpLightcorner,

I have some other issues building Vanetza on Windows. I am using MSVC, so you probably do not know, but as you also attempted this, did you by any chance come across similar issue? I have problems with CryptoPP library. https://github.com/riebl/vanetza/issues/169

Thanks, Karel

khevessy avatar Oct 12 '22 10:10 khevessy

For Windows builds, I would try to use Conan for the build process. Handling all the library dependencies manually on Windows is no fun at all.

riebl avatar Oct 18 '22 18:10 riebl