Closed guysoft closed 2 years ago
Out of the top of my head:
@maxnet
\lib
and \include
.
I tried also adding DOPENSSL_ROOT_DIR
, DOPENSSL_CRYPTO_LIBRARY
, DOPENSSL_INCLUDE_DIR
and DOPENSSL_VERSION
:
cmake -DOPENSSL_ROOT_DIR="C:\msys2\msys64\mingw32" -DOPENSSL_CRYPTO_LIBRARY="C:\msys2\msys64\mingw32\lib\libssl.a" -DOPENSSL_INCLUDE_DIR=C:\msys2\msys64\mingw32\include -DOPENSSL_VERSION=1.1.1m ..
Perhaps I need to set the paths to be windows or unix? It should find those.
Ok, one more clue - it looks like it is finding the settings, because if I only run cmake ..
it says its finding OpenSSL version 1.1.1i
, but if I do set it it find version 1.1.1m
, which is the one provided by mingw-w64-i686-toolchain
Building can be done manually using the command-line, using "cmake", "make", etc., but if you are not that familar with setting up a proper Windows build environment (setting paths, etc.), it is easiest to use the Qt creator GUI instead.
Is in the README for a reason. There are more paths you need to worry about than just OpenSSL if you are not using Qt Creator which comes with nice defaults.
I understand and would have preferred to build openssl (no idea how to automate manual signing), but I also got stuck building openssl, there was some compile error command (perhaps it might help to show this?):
gcc -I. -Iinclude -m32 -Wall -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DRMD160_ASM -DAESNI_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"C:/Program Files (x86)/Common Files/SSL\"" -DENGINESDIR="\"/d/a/pi-imager/pi-imager/openssl/openssl-1.1.1m/dist/lib/engines-1_1\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_USE_APPLINK -DNDEBUG -MMD -MF crypto/dso/dso_vms.d.tmp -MT crypto/dso/dso_vms.o -c -o crypto/dso/dso_vms.o crypto/dso/dso_vms.c
gcc -I. -Iinclude -m32 -Wall -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DRMD160_ASM -DAESNI_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"C:/Program Files (x86)/Common Files/SSL\"" -DENGINESDIR="\"/d/a/pi-imager/pi-imager/openssl/openssl-1.1.1m/dist/lib/engines-1_1\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_USE_APPLINK -DNDEBUG -MMD -MF crypto/dso/dso_win32.d.tmp -MT crypto/dso/dso_win32.o -c -o crypto/dso/dso_win32.o crypto/dso/dso_win32.c
crypto/dso/dso_win32.c: In function 'win32_load':
crypto/dso/dso_win32.c:98:5: error: unknown type name 'HINSTANCE'
98 | HINSTANCE h = NULL, *p = NULL;
| ^~~~~~~~~
crypto/dso/dso_win32.c:98:19: warning: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
98 | HINSTANCE h = NULL, *p = NULL;
| ^~~~
crypto/dso/dso_win32.c:106:9: warning: implicit declaration of function 'LoadLibraryA' [-Wimplicit-function-declaration]
106 | h = LoadLibraryA(filename);
| ^~~~~~~~~~~~
crypto/dso/dso_win32.c:107:11: warning: comparison between pointer and integer
107 | if (h == NULL) {
| ^~
crypto/dso/dso_win32.c:129:11: warning: comparison between pointer and integer
129 | if (h != NULL)
| ^~
crypto/dso/dso_win32.c:130:9: warning: implicit declaration of function 'FreeLibrary' [-Wimplicit-function-declaration]
130 | FreeLibrary(h);
| ^~~~~~~~~~~
crypto/dso/dso_win32.c: In function 'win32_unload':
crypto/dso/dso_win32.c:136:5: error: unknown type name 'HINSTANCE'
136 | HINSTANCE *p;
| ^~~~~~~~~
crypto/dso/dso_win32.c: In function 'win32_bind_func':
crypto/dso/dso_win32.c:163:5: error: unknown type name 'HINSTANCE'
163 | HINSTANCE *ptr;
| ^~~~~~~~~
crypto/dso/dso_win32.c:166:9: error: unknown type name 'FARPROC'
166 | FARPROC f;
| ^~~~~~~
crypto/dso/dso_win32.c:182:13: warning: implicit declaration of function 'GetProcAddress' [-Wimplicit-function-declaration]
182 | sym.f = GetProcAddress(*ptr, symname);
| ^~~~~~~~~~~~~~
In file included from crypto/dso/dso_win32.c:490:
/usr/include/w32api/tlhelp32.h: At top level:
/usr/include/w32api/tlhelp32.h:15:3: error: unknown type name 'HANDLE'
15 | HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags,DWORD th32ProcessID);
| ^~~~~~
/usr/include/w32api/tlhelp32.h:15:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CreateToolhelp32Snapshot'
15 | HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags,DWORD th32ProcessID);
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/w32api/tlhelp32.h:26:5: error: unknown type name 'SIZE_T'
26 | SIZE_T dwSize;
| ^~~~~~
I also have windows vm with qt creator installed and open to the rpi-imager project, but I am getting the exact same openssl error there too.
I understand and would have preferred to build openssl (no idea how to automate manual signing)
I am personally not a big fan of building applications automated in the cloud either. By signing it you are pretty much saying that you are vouching for the integrity of the build. And I trust the integrity of my local build virtual machine -that is not used for anything else than compiling stuff- more than a virtual machine at some cloud provider. I have no way of knowing how many of their staff members have access too...
Anyway, to answer your question.
but I also got stuck building openssl, there was some compile error command (perhaps it might help to show this?):
I am afraid I do not have time to provide detailed assistance on how to setup a Qt build environment with OpenSSL. But the general idea is:
export PATH=/c/qt/5.14.1/mingw73_32/bin:/c/qt/tools/mingw7320_32/bin:$PATH
pacman -S perl
?)./configure --prefix=$PWD/some-temporary-folder no-idea no-mdc2 no-rc5 shared mingw
mingw32-make.exe
mingw32-make.exe install
I managed manually to get it to build with those ssl libs by
# find_package(OpenSSL REQUIRED)
set(OPENSSL_INCLUDE_DIR "C:/msys64/mingw32/include")
set(OPENSSL_LIBRARIES "C:/msys64/mingw32/lib/libssl.a" "C:/msys64/mingw32/lib/libcrypto.a")
NOTE THE SLASHES ARE REVERSED
I also had to remove signtool.exe (I have it at C:\Program Files (x86)\Windows Kits\10\bin\x64
):
# Code signing
# find_program(SIGNTOOL "signtool.exe" PATHS "c:/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool")
# if (NOT SIGNTOOL)
# message(FATAL_ERROR "Unable to locate signtool.exe used for code signing")
# endif()
Then it builds and runs
I could not get it to detect OpenSSL otherwise
Just saw your other message: Thanks for giving me direction so far. ATM I want some form of ci/cd for the fork, so I am going to hopefully make it build without any signature and have something people can play with. Afterwards I can look in to signing and other stuff assuming this matures to be a fork by its own right.
Steps to reproduce:
Install QT with minw81_32
Install git bash and checkout this repo
install Msys2 (64bit default)
install cmake for windows from cmake.org
Open Msys2 MingMW and run the following to get the 32bit dlls:
Extract from the path
C:\msys64\mingw32\bin
:libssl-1_1.dll
,libcrypto-1_1.dll
andopenssl.exe
and copy them to:C:\Qt\5.15.2\mingw81_32\
create a build folder in rpi-imager source folder, cd in to it and run
cmake ..
The error is:
I also get the same error in this github action: https://github.com/guysoft/pi-imager/blob/windows-ci/.github/workflows/build-windows.yml
How do I get OpenSSL to be recognized?