facebook / facebook/rocksdb

[MSVC] RocksDB failed to build with msvc due to warning C4189 on Windows

Open
#10,691 0 comments 0 reactions 0 assignees View on GitHub
Build up-for-grabs windows
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

Hi,
Recently, we updated the commit of RocksDB (commit is: 76de3c8), it failed to build with msvc due to the warning C4189 like below, could you help look this issue? Thanks.
```
F:\gitP\facebook\rocksdb\db\c_test.c(281,10): warning C4189: 'cf_size': local variable is initialized but not referenced [F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj]
F:\gitP\facebook\rocksdb\db\c_test.c(283,10): warning C4189: 'cf_file_count': local variable is initialized but not referenced [F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj]
```

### Expected behavior
build successfully.
### Actual behavior
```
"F:\gitP\facebook\rocksdb\build_amd64\rocksdb.sln" (Rebuild target) (1) ->
"F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj.metaproj" (Rebuild target) (5) ->
"F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj" (Rebuild target) (46) ->
(ClCompile target) ->
F:\gitP\facebook\rocksdb\db\c_test.c(281,10): warning C4189: 'cf_size': local variable is initialized but not referenced [F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj]
F:\gitP\facebook\rocksdb\db\c_test.c(283,10): warning C4189: 'cf_file_count': local variable is initialized but not referenced [F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj]

"F:\gitP\facebook\rocksdb\build_amd64\rocksdb.sln" (Rebuild target) (1) ->
"F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj.metaproj" (Rebuild target) (5) ->
"F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj" (Rebuild target) (46) ->
(ClCompile target) ->
F:\gitP\facebook\rocksdb\db\c_test.c(281,10): error C2220: the following warning is treated as an error [F:\gitP\facebook\rocksdb\build_amd64\c_test.vcxproj]

2 Warning(s)
1 Error(s)
```
### Steps to reproduce the behavior
1. git clone https://github.com/facebook/rocksdb F:\gitP\facebook\rocksdb
2. Open VS2019 x64 Native tools command prompt
3. mkdir F:\gitP\facebook\rocksdb\build_amd64 && cd F:\gitP\facebook\rocksdb\build_amd64
4. cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 .. 2>&1
5. msbuild /m /p:Platform=x64 /p:Configuration=Release rocksdb.sln /t:Rebuild /p:BuildInParallel=true 2>&1

**More info:**
VS version: VS16.11.18
OS: Windows server 2019

**detailed log:**
[build (4).log](https://github.com/facebook/rocksdb/files/9581724/build.4.log)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the MSVC build from db/c_test.c using the listed VS2019, CMake, and msbuild commands. Inspect lines 281 and 283, then rebuild rocksdb.sln and verify that the C4189 warnings and resulting C2220 error no longer prevent a successful build.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.