2018-05-15 10:28
浏览 167


I am trying to use gorocksdb which is a cgo package wapping the rocksdb library on windows.

  • I built the rocksdb library with vcpkg which gave me as output rocksdb-shared.dll. I set the build path to my PATH.
  • I installed msys64 in order to have gcc
  • I have set CGO_CFLAGS="-I/path/to/rocksdb/include" and CGO_LDFLAGS="-L/path/to/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"
  • I have renammed rocksdb-shared.dll to librocksdb.dll because the linker requires the dll to start with lib
  • I do the go get ... command
  • I run my test go file and I get the error The programer can't start because rocksdb-shared.dll is missing ...
  • If I rename it back to rocksdb-shared.dll the build fails because the linker can't find librocksdb.dll
  • The only way to make it work is to have both rocksdb-shared.dll and librocksdb.dll in the PATH

Why the executable keeps loading rocksdb-shared.dll? I don't find any reference to it in the cgo package.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用 gorocksdb ,这是一个在Windows上封装了rockdb库的cgo程序包。

  • 我用vcpkg构建了rockdb库,这使我得到了输出 的 rocksdb-shared.dll 即可。 我将构建路径设置为PATH。
  • 我安装了msys64,以便安装gcc
  • 我将 CGO_CFLAGS =“-I / path / to设置为 / rocksdb / include“ CGO_LDFLAGS =”-L / path / to / rocksdb -lrocksdb -lstdc ++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd“
  • 我将 rocksdb-shared.dll 重命名为 librocksdb.dll ,因为链接器要求dll以 lib < / li>
  • 我执行 go get ... 命令
  • 我运行我的test go文件,但出现错误 Programmer 不能开始,因为rocksdb-shared.dll丢失了。
  • 如果我将其重命名为 rocksdb-shared.dll ,构建将失败,因为 链接器找不到 librocksdb.dll
  • 使其唯一起作用的方法是同时具有 rocksdb-shared.dll PATH中的> librocksdb.dll

    为什么可执行文件不断加载 rocksdb-shared.dll ? 我在cgo包中找不到任何引用。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyin7829 2018-05-15 11:29

    I think I found the answer to my question.

    I think I can't rename the compiled dll because the dll "reference" itself as this name. So it won't load properly.

    To resolve my problem I just renamed the parameter in the LDFLAG from -lrocksdb to -lrocksdb-shared in both my environement variable and in this file

    解决 无用
    打赏 举报

相关推荐 更多相似问题