oqs-provider icon indicating copy to clipboard operation
oqs-provider copied to clipboard

Too many agruments to function 'mkdir' on Windows

Open HarryLee02 opened this issue 1 year ago • 2 comments

Recreate the bug Got this error after cmake --build .

[24/28] Building C object test/CMakeFiles/oqs_test_tlssig.dir/oqs_test_tlssig.c.obj
FAILED: test/CMakeFiles/oqs_test_tlssig.dir/oqs_test_tlssig.c.obj
C:\msys64\mingw64\bin\cc.exe -DNDEBUG -ID:/Project/openssl-3.2.1/include -ID:/Project/liboqs-compiled/include -ID:/Project/liboqs-compiled/include/oqs -std=gnu11 -Wunused-function -MD -MT test/CMakeFiles/oqs_test_tlssig.dir/oqs_test_tlssig.c.obj -MF test\CMakeFiles\oqs_test_tlssig.dir\oqs_test_tlssig.c.obj.d -o test/CMakeFiles/oqs_test_tlssig.dir/oqs_test_tlssig.c.obj -c D:/Me/Study_Uni/HK4_Nam_2/slide_mmh/Labs/Project/oqs-provider/test/oqs_test_tlssig.c
D:/Project/oqs-provider/test/oqs_test_tlssig.c: In function 'test_oqs_tlssig':
D:/oqs-provider/test/oqs_test_tlssig.c:43:9: error: too many arguments to function 'mkdir'
   43 |     if (mkdir(certsdir, 0700)) {
      |         ^~~~~
In file included from C:/msys64/mingw64/include/sys/stat.h:14,
                 from D:/Project/oqs-provider/test/oqs_test_tlssig.c:13:
C:/msys64/mingw64/include/io.h:282:15: note: declared here
  282 |   int __cdecl mkdir (const char *) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
      |               ^~~~~
[26/28] Building C object test/CMakeFiles/oqs_test_tlssig.dir/tlstest_helpers.c.obj
ninja: build stopped: subcommand failed.

To Reproduce Using Windows MSYS2 MINGW64 as administrator. liboqs is built like this:

# mkdir build && cd build
# cmake -GNinja -DCMAKE_INSTALL_PREFIX=/d/Project/liboqs-compiled -DBUILD_SHARED_LIBS=ON -DOQS_USE_OPENSSL=OFF -DCMAKE_BUILD_TYPE=Release -DOQS_BUILD_ONLY_LIB=ON -DOQS_DIST_BUILD=ON ..
# ninja
# ninja install

oqs-provider is built like this:

 mkdir build && cd build
 cmake -GNinja -DCMAKE_PREFIX_PATH="D:\Project\install" -DOPENSSL_ROOT_DIR="D:\Project\openssl-3.2.1" -Dliboqs_DIR="D:\Project\liboqs-compiled\lib\cmake\liboqs" -S ..
cmake --build .

Environment (please complete the following information):

  • OS: Windows 11
  • OpenSSL version: OpenSSL 3.2.1 30 Jan 2024 (Library: OpenSSL 3.2.1 30 Jan 2024)
  • oqsprovider version: git checkout d540c28

HarryLee02 avatar Jun 11 '24 14:06 HarryLee02

I figured it out that mkdir() function that is specified in io.h just takes one argument, so simply change to if(mkdir(certsdir)) as mention in this stackoverflow.

This will successfully build the oqsprovider, but the size of .dll file is significantly small (625kb) and openssl doesn't recognize it even when I have edit the openssl.cnf file

HarryLee02 avatar Jun 11 '24 15:06 HarryLee02

Thanks @HarryLee02 for the report. Unfortunately, I'm not exactly a "Windows connoisseur" -- would you be willing to do a PR? Or is there another (looks unrelated) problem with

but the size of .dll file is significantly small (625kb)

So are there symbols un-resolved in the resultant .dll?

baentsch avatar Jun 11 '24 16:06 baentsch

Closing after receiving no feedback. Please re-open with more details if still a problem @HarryLee02 .

baentsch avatar Sep 09 '25 09:09 baentsch