mtrojnar / osslsigncode

OpenSSL based Authenticode signing for PE/MSI/Java CAB files
Other
801 stars 131 forks source link

CMakeTest fails on linux #321

Closed git-lul closed 1 year ago

git-lul commented 1 year ago

I get the following error while configuring project on Ubuntu:

-- HTTP server failed: 1
/home/.../osslsigncode-2.7/Testing/certs/cert.der: No such file or directory
CMake Error at cmake/CMakeTest.cmake:119 (string):
  string sub-command SUBSTRING requires four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:86 (include)

-- Configuring incomplete, errors occurred!

I am guessing certs folder should also be copied here https://github.com/mtrojnar/osslsigncode/blob/f9ad19d4a2e1786bd4fccb17240483683769c1b1/cmake/CMakeTest.cmake#L10-L15

olszomal commented 1 year ago

@git-lul Could you please help me to replicate this issue.

$ uname -a
Linux Ubunt22 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 18:01:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

BUILDING

$ sudo apt update && sudo apt install cmake libssl-dev libcurl4-openssl-dev zlib1g-dev python3 faketime
$ tar xzf osslsigncode-2.7.tar.gz 
$ cd osslsigncode-2.7/
$ mkdir build && cd build && cmake -S ..
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.2")  
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.81.0")  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Using bash completions dir /usr/share/bash-completion/completions
-- Looking for getpass
-- Looking for getpass - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for mmap
-- Looking for mmap - found
-- cURL support enabled
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
-- HTTP server started, URL http://127.0.0.1:34917
-- Keys & certificates successfully generated
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mo/Downloads/osslsigncode-2.7/build

Please check if you have all the required packages installed and attach the entire cmake logs.

git-lul commented 1 year ago

I hope this helps in any way

$ uname -a
Linux loboda-devlin 4.15.0-142-generic #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

I am running custom build on my side, with specific openssl and zlib path

/home/loboda/.islcc/cmake-3.25.2-1/bin/cmake -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/home/loboda/.islcc/openssl-3.0.12-2-2848888071450c4fa4a01b54370ae7f6/usr/local/ssl -DZLIB_ROOT=/home/loboda/.islcc/zlib-1.2.8-3-2848888071450c4fa4a01b54370ae7f6 -DCMAKE_INSTALL_PREFIX=/home/loboda/.islcc/osslsigncode-2.7-27f80c2fc39de4598a7b51045c7f2203 .

The output I get with this command is

- The C compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/loboda/Documents/isl/b.ISLConferenceProxyWithModules_linux64.0.main/compiler/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found OpenSSL: /home/loboda/.islcc/openssl-3.0.12-2-2848888071450c4fa4a01b54370ae7f6/usr/local/ssl/lib/libcrypto.a (found version "3.0.12")  
-- Could NOT find CURL (missing: CURL_LIBRARY) (found version "7.47.0")
-- Found ZLIB: /home/loboda/.islcc/zlib-1.2.8-3-2848888071450c4fa4a01b54370ae7f6/lib/libz.a (found version "1.2.8") 
-- Using bash completions dir /home/loboda/.islcc/osslsigncode-2.7-27f80c2fc39de4598a7b51045c7f2203/share/bash-completion/completions
-- Looking for getpass
-- Looking for getpass - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for mmap
-- Looking for mmap - found
-- cURL support disabled (library not found)
-- Found Python3: /usr/bin/python3.5 (found version "3.5.2") found components: Interpreter 
-- HTTP server failed: 1
/home/loboda/.islcc/osslsigncode-2.7-27f80c2fc39de4598a7b51045c7f2203/osslsigncode-2.7/Testing/certs/cert.der: No such file or directory
CMake Error at cmake/CMakeTest.cmake:119 (string):
  string sub-command SUBSTRING requires four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:86 (include)

-- Configuring incomplete, errors occurred!

If I add "${CMAKE_CURRENT_SOURCE_DIR}/tests/certs" to CMakeTest.cmake build is successful.

olszomal commented 1 year ago

This is helpful. Can you show your Testing/server.log file?

git-lul commented 1 year ago

My content of Testing/logs/server.log

  File "/home/loboda/.islcc/osslsigncode-2.7-27f80c2fc39de4598a7b51045c7f2203/osslsigncode-2.7/Testing/server_http.py", line 55
    print(f"HTTP GET request error: {err}")
                                         ^
SyntaxError: invalid syntax