Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libressl-3.9.2 generates lots of warnings on windows using ClangCL #1088

Open
d3x0r opened this issue Aug 23, 2024 · 2 comments
Open

Libressl-3.9.2 generates lots of warnings on windows using ClangCL #1088

d3x0r opened this issue Aug 23, 2024 · 2 comments

Comments

@d3x0r
Copy link
Contributor

d3x0r commented Aug 23, 2024

Visual studio has an option to use Clang-CL as a backend - it's supposed to behave like 'cl.exe' but is clang and llvm.

with libressl source in a directory, from that directory... In order to enable it - using the visual studio installer, under Modify 'Individual components` search for 'clang' and select all options...

image

mkdir build
cd build
cmake -T ClangCL ..

and build resulting libressl.sln ( can either use cmake --build . or load the project in visual studio)
and then a ton of error in the test projects are generated... for example:

lld-link : error : duplicate symbol: posix_perror [M:\javascript\vfs\native\src\sack\libressl\3.9.2\build\tests\aeadtest.vcxproj]
  >>> defined at M:\javascript\vfs\native\src\sack\libressl\3.9.2\crypto\compat\posix_win.c:25
  >>>            M:\javascript\vfs\native\src\sack\libressl\3.9.2\build\crypto\compat_obj.dir\Debug\posix_win.obj
  >>> defined at crypto.lib(posix_win.obj)

Also get a bunch of warnings... the clang-cl compiler is using clang warnings instead of the C4496 sort of warning... for example:

			"C4996" # The POSIX name for this item is deprecated.
			        # Instead, use the ISO C and C++ conformant name

This fixes additional warnings... (for building the library anyway)

	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-deprecated-declarations -Wno-microsoft-enum-forward-reference")

(disregard below...)

The above is a 32 bit build... enabling -A x64 so assembly builds fails for a different reason... (Pretty sure this is a MS issue, since the /W3 that's getting added is from 'masm.target' build rule.) cmake -T ClangCL -A x64 ..

MASM : fatal error A1013: invalid numerical command-line argument : /W [...\crypto_obj.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\masm.targets(70,5): error MSB3721: The command "ml64.exe  ... (defs and includes)  /W3 /errorReport:prompt (warning disables)

(This last one I was just trying to figure out exactly what was causing a compile error; if I disable assembly I guess I can get past this, CMake also has code in it to add /W3 erroneously to the C,C++ compiler flags... though I'm not sure if that IS an issue of if it's just this ml64.exe that's puking )

Edit: This last one is apparently caused by me.... I had a warning disable from 3.8.0

   	set_target_properties( crypto_obj PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-missing-field-initializers")

with that, then the assembly fails with /W3 (so disregard after horizontal bar above)

@d3x0r d3x0r changed the title Libressl-3.9.2 fails to build on windows using ClangCL Libressl-3.9.2 generates lots of warnings on windows using ClangCL Aug 23, 2024
@AmyrAhmady
Copy link

Have you ever found a way for this problem of MSVS randomly adding /W3 and then failing to build?

@d3x0r
Copy link
Contributor Author

d3x0r commented Dec 9, 2024

I forgot I had filed this - I think this ended up being an error in other options I was passing... clang-cl does take slash options; and the options I added there -Wno-sign-compare but I applied them as COMPILE_FLAGS, instead of definitions...

works

   add_definitions( -Wno-parentheses )

vs, for example fails

set_target_properties( crypto_obj PROPERTIES COMPILE_FLAGS "-Wno-sign-compare" )

in the project properties, none of the -Wno- options I specified are shown in Visual Studio, but they are on the Project's C++ /All Options / Additional Options with -W... ; or Command Line there's a box at the bottom with additional options that does list them, but not as part of the command line... so I guess its more a matter how it gets added?


Clang-cl does still generate a lot of warnings though... and they're clang flavored not CL flavored...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants