Vcpkg: rocksdb link error in VS2017

Created on 20 Dec 2017  路  11Comments  路  Source: microsoft/vcpkg

port-bug

All 11 comments

Additionally, the latest release of RocksDB is 5.9.2 and the port should probably be updated.

Attempting to use rocksdb on x64-windows and VS2017
I get the following unresolved externals:

1>------ Build started: Project: ShaderDatabaseManager, Configuration: Debug x64 ------
1>ShaderDatabaseManager.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl rocksdb::Status::ToString(void)const " (?ToString@Status@rocksdb@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function main
1>ShaderDatabaseManager.obj : error LNK2019: unresolved external symbol "public: __cdecl rocksdb::ColumnFamilyOptions::ColumnFamilyOptions(void)" (??0ColumnFamilyOptions@rocksdb@@QEAA@XZ) referenced in function "public: __cdecl rocksdb::Options::Options(void)" (??0Options@rocksdb@@QEAA@XZ)
1>ShaderDatabaseManager.obj : error LNK2019: unresolved external symbol "public: __cdecl rocksdb::DBOptions::DBOptions(void)" (??0DBOptions@rocksdb@@QEAA@XZ) referenced in function "public: __cdecl rocksdb::Options::Options(void)" (??0Options@rocksdb@@QEAA@XZ)
1>ShaderDatabaseManager.obj : error LNK2019: unresolved external symbol "public: __cdecl rocksdb::ReadOptions::ReadOptions(void)" (??0ReadOptions@rocksdb@@QEAA@XZ) referenced in function main
1>ShaderDatabaseManager.obj : error LNK2019: unresolved external symbol "public: static class rocksdb::Status __cdecl rocksdb::DB::Open(struct rocksdb::Options const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class rocksdb::DB * *)" (?Open@DB@rocksdb@@SA?AVStatus@2@AEBUOptions@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAPEAV12@@Z) referenced in function main
1>F:\Projects\ShaderDatabaseManager\x64\Debug\ShaderDatabaseManager.exe : fatal error LNK1120: 5 unresolved externals
1>Done building project "ShaderDatabaseManager.vcxproj" -- FAILED.

Same here:

image

Only the rocksdb c interface is in the symbol file of the lib. The rocksdb.dll file in the bin directory also only has the c interface.

The C++ interface for rocksdb does not include export declspecs at all, so rocksdb would need to be built as a static library, not a shared library, in order for the C++ interfaces to be available.

I vote for rocksdb to be static not shared, as I too am using the C++ interaces.

@ras0219-msft I think we all need it to be static.... (ref https://github.com/Microsoft/vcpkg/issues/1918)

i am still a little confused about the solution, since i installed rocksdb using vcpkg. The question is how to build rocksdb as a statis library using vcpkg? It seems that just running command vcpkg install rocksdb:x64-windows-static does not work. Can anyone help me?@gencer @meshula

In the end, I didn't fix the vcpkg recipe, I built rocksdb myself from the sources, sorry I don't have a better solution.

@meshula Thanks anyway, i will have a try.
@ras0219-msft I vote for rocksdb to be static not shared as well since it seems more reasonable.

Sorry to bother you, Could you give me a link of how to build rocksdb from the source codes in windows for Visual Studio 2017 or other Visual Studio version? I tried but my solution didn't work. @meshula

I used a procedure like this: https://github.com/facebook/rocksdb/wiki/Building-on-Windows

I don't recall, and don't have my build script available at the moment, but I think that by default rocks builds static? If not, check the Cmake options in the script for the name of the variable.

Thx a lot! I have solved this problem!

Hi @Adam74211, thanks for reporting this issue.
I've fixed this issue, please update vcpkg and rebuild rocksdb.

Thanks.

Was this page helpful?
0 / 5 - 0 ratings