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

develop branch build failed on Win10 using VS2022 #1804

Open
meetviolet opened this issue Oct 17, 2024 · 3 comments
Open

develop branch build failed on Win10 using VS2022 #1804

meetviolet opened this issue Oct 17, 2024 · 3 comments

Comments

@meetviolet
Copy link

Build failed by following cmd script:

@echo on
chcp 65001

set SRC=C:/msys64/home/uname/src/zlib-ng
set BUILD=%SRC%/build/vc17-x86_64
set LIB=zlib-ng
set PREFIX=C:/msys64/home/uname/tmp/%LIB%

set CFLAGS="/source-charset:utf-8"
set CXXFLAGS="/source-charset:utf-8"

set COMPILE_FLAGS="                                                    ^
-DZLIB_COMPAT=ON                                                       ^
-DWITH_GTEST=OFF                                                       ^
-DZLIB_ENABLE_TESTS=OFF                                                ^
-DWITH_NATIVE_INSTRUCTIONS=ON                                          ^
"

@REM @REM Debug static
set TYPE=Debug
set DIR=%TYPE%/%LIB%/static
cmake -S %SRC% -B %BUILD%/%DIR%                                        ^
-DCMAKE_INSTALL_PREFIX=%PREFIX%/%DIR%                                  ^
-DCMAKE_BUILD_TYPE=%TYPE%                                              ^
-DBUILD_SHARED_LIBS=OFF                                                ^
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL                     ^
%COMPILE_FLAGS%

cmake --build %BUILD%/%DIR% --config %TYPE% --target install -j 16
@if errorlevel 1 pause && exit
pause

The error is caused by empty SIZEOF_DATA_PTR:

sizeof(void *) is  bytes
"sizeof(void *) is neither 32 nor 64 bit"

But my machine is 64bit for void*. So how can I fix this?

@meetviolet
Copy link
Author

meetviolet commented Oct 17, 2024

Besides, /utf-8 flag should be removed. Actually, execution-charset may not be utf-8 ondifferent machines. Thus, keep /source-charset:utf-8 and remove /utf-8 is a better choice in general. On utf-8 windows system, the MSVC will use execution-charset=utf-8, on other legacy windows system, MSVC will choose their best execution-charset encoding by default.

@meetviolet
Copy link
Author

Hi, I just found use x64 Native Tools Command Prompt for VS 2022 works, not the naive cmd.

Could you please add this to doc so that others can skip this error?

@mtl1979
Copy link
Collaborator

mtl1979 commented Nov 24, 2024

We don't list every possible unsupported configuration as the list would grow very fast. This kind of issue belongs to FAQ section of the Visual Studio documentation.

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