RedisInsight / RedisDesktopManager

https://resp.app
Other
22.95k stars 3.27k forks source link

build from source on win10 but failed #5194

Closed ly269nva closed 2 years ago

ly269nva commented 2 years ago

http://docs.redisdesktop.com/en/latest/install/#build-from-source

我按照上述官网说明,在win10上基于源码2022编译失败 执行cmake时 :Performing Test CFLAG_Wextra - Failed,有多个failed 然后执行make时:make: *** No targets specified and no makefile found. Stop. 然后在QT中编译:D:\tmp\RedisDesktopManager-2022.0-full\3rdparty\snappy\snappy.h:47: error: C1083: 无法打开包括文件: “snappy-stubs-public.h”: No such file or directory cmake snappy之后再次从QT中build: :-1: error: LNK1181: 无法打开输入文件“D:\tmp\RedisDesktopManager-2022.0-full\3rdparty\lz4\build\cmake\Release\lz4.lib” 请问要怎么编译出可安装运行的exe程序?

According to the above official website instructions, I failed to compile based on source version 2022 code on win10 When executing cmake: Performing Test CFLAG_Wextra - Failed and more Failed Then when executing make: make: *** No targets specified and no makefile found. Stop. Then compile in QT: D:\tmp\RedisDesktopManager-2022.0-full\3rdparty\snappy\snappy.h:47: error: C1083: cannot open include file: "snappy-stubs-public.h": No such file or directory After cmake snappy build again from QT: :-1: error: LNK1181: cannot open file “D:\tmp\RedisDesktopManager-2022.0-full\3rdparty\lz4\build\cmake\Release\lz4.lib” (not exist) How can I compile an exe program that can be installed and run?

uglide commented 2 years ago

Most likely you haven't built all dependencies correctly, that's why linking is throwing the error about absent lz4.lib

liudonghua123 commented 2 years ago

I have the same issue.

I followed the instructions on https://docs.resp.app/en/latest/install/#build-on-windows

git clone --recursive https://github.com/uglide/RedisDesktopManager.git -b 2022 rdm && cd ./rdm
cd 3rdparty/qredisclient/3rdparty/hiredis && git apply ../hiredis-win.patch
cd 3rdparty && nuget install zlib-msvc14-x64 -Version 1.2.11.7795
# build lz4 
cd 3rdparty/lz4/build/cmake
cmake -DLZ4_BUNDLED_MODE=ON  .
make
# update the python path in `3rdparty\pyotherside.pri` 
pip3 install -r src/py/requirements.txt
# ./src/rdm.pro does not exists, use ./src/resp.pro instead.
Open ./src/rdm.pro in Qt Creator. Choose the Desktop Qt 5.15.x MSVC2019 64bit > Release build profile.

But the last command when building in Qt Creator failed with the following errors.

  1. include snappy-stubs-public.h not found, then I have to build 3rdparty\snappy manually and add 3rdparty\snappy\build to the INCLUDE.
  2. zstd_static.lib not found, I have to build 3rdparty\zstd manually.
  3. brotlicommon-static not found, I have to build 3rdparty\brotli manually.

Then finally I built without errors. It seemed the dependences not build automatically. I do not know why, I use the latest Qt Creator 7.

Some commands I used.

# build lz4
cd 3rdparty/lz4/build/cmake
cmake -DLZ4_BUNDLED_MODE=ON  -G"Visual Studio 16 2019" -A x64 .
cmake  -G"Visual Studio 16 2019" -A x64 .

# build snappy
cd 3rdparty\snappy
cmake  -G"Visual Studio 16 2019" -A x64 .
msbuild /t:build Snappy.sln /p:Configuration="Release"

# build zstd
cd 3rdparty\zstd\build\cmake
cmake  -G"Visual Studio 16 2019" -A x64 .
msbuild /t:build zstd.sln

# build brotli
cd 3rdparty\brotli
cmake  -G"Visual Studio 16 2019" -A x64 .
msbuild /t:build brotli.sln /p:Configuration="Release"
liudonghua123 commented 2 years ago

I tried to build without the qt creator, So I tried the instructions on https://stackoverflow.com/questions/19206462/compile-a-qt-project-from-command-line and https://stackoverflow.com/questions/6127357/building-qt-creator-projects-from-command-line. But when I execute make I always got Makefile.Release:640: *** missing separator. Stop. error.

Here is another workaround.

mkdir dist && cd dist
# optional, just for clean task
# D:\apps\qt\Tools\QtCreator\bin\jom.exe /S -f Makefile.Release clean
# generate makefile
qmake.exe ..\src\resp.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
# fix `..\3rdparty\snappy\snappy.h(47): fatal error C1083: Cannot open include file: 'snappy-stubs-public.h': No such file or directory`
set INCLUDE=%INCLUDE%;..\3rdparty\snappy\build
# build using jom insteadof make
D:\apps\qt\Tools\QtCreator\bin\jom.exe /S /X Build.log -f Makefile.Release

If you try to use windeployqt to make a deployment. DO NOT FORGET to add --qmldir \path\to\src\qml arguments.

kishanhathiwalaCS commented 2 years ago

Thanks @liudonghua123 I was able to generate the executable file using the following commands.

# build lz4
cd 3rdparty/lz4/build/cmake
cmake -DLZ4_BUNDLED_MODE=ON  -G"Visual Studio 16 2019" -A x64 .
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build LZ4.sln /p:Configuration="Release"

# build snappy
cd 3rdparty\snappy
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build Snappy.sln /p:Configuration="Release"

# build zstd
cd 3rdparty\zstd\build\cmake
cmake  -G"Visual Studio 16 2019" -A x64 .
msbuild /t:build zstd.sln

# build brotli
cd 3rdparty\brotli
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build brotli.sln /p:Configuration="Release"

# build zstd
cd 3rdparty\zstd\build\cmake
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build zstd.sln /p:Configuration="Release"

But when I try to execute the file, it gives error about dependencies dlls. Is there anyway to include all the dependencies in the release folder after build?

Thanks

liudonghua123 commented 2 years ago

Thanks @liudonghua123 I was able to generate the executable file using the following commands.

# build lz4
cd 3rdparty/lz4/build/cmake
cmake -DLZ4_BUNDLED_MODE=ON  -G"Visual Studio 16 2019" -A x64 .
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build LZ4.sln /p:Configuration="Release"

# build snappy
cd 3rdparty\snappy
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build Snappy.sln /p:Configuration="Release"

# build zstd
cd 3rdparty\zstd\build\cmake
cmake  -G"Visual Studio 16 2019" -A x64 .
msbuild /t:build zstd.sln

# build brotli
cd 3rdparty\brotli
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build brotli.sln /p:Configuration="Release"

# build zstd
cd 3rdparty\zstd\build\cmake
cmake  -G"Visual Studio 17 2022" -A x64 .
msbuild /t:build zstd.sln /p:Configuration="Release"

But when I try to execute the file, it gives error about dependencies dlls. Is there anyway to include all the dependencies in the release folder after build?

Thanks

Did you forget to add --qmldir \path\to\src\qml arguments when running windeployqt. see https://github.com/uglide/RedisDesktopManager/issues/5085#issuecomment-1085379230

liudonghua123 commented 2 years ago

@kishanhathiwalaCS Hi, I write a github action (https://github.com/liudonghua123/RedisDesktopManager/blob/main/.github/workflows/build.yml) which build a windows binary and push to the release. You can take a look at it.