linux-fscrypt.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Boccassi <luca.boccassi@gmail.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-fscrypt@vger.kernel.org
Subject: Re: [fsverity-utils PATCH v2 2/2] Allow to build and run sign/digest on Windows
Date: Thu, 17 Dec 2020 18:44:38 +0000	[thread overview]
Message-ID: <695452fd56e71621a612dcdce8d203964bb64d0f.camel@gmail.com> (raw)
In-Reply-To: <X9ukTy5iKB4FfFqc@sol.localdomain>

[-- Attachment #1: Type: text/plain, Size: 4137 bytes --]

On Thu, 2020-12-17 at 10:32 -0800, Eric Biggers wrote:
> On Thu, Dec 17, 2020 at 02:47:49PM +0000, luca.boccassi@gmail.com wrote:
> > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > 
> > Add some minimal compat type defs, and stub out the enable/measure
> > sources. Also add a way to handle the fact that mingw adds a
> > .exe extension automatically in the Makefile install rules, and
> > that there is not pkg-config and the libcrypto linker flag is
> > different.
> > 
> > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > ---
> > v2: rework the stubbing out to detect mingw in the Makefile and remove
> >     sources from compilation, instead of ifdefs.
> >     add a new common/win32_defs.h for the compat definitions.
> >     define strerror_r using strerror_s.
> > 
> >     To compile with mingw:
> >       make CC=x86_64-w64-mingw32-gcc-8.3-win32
> >     note that the openssl headers and a win32 libcrypto.dll need
> >     to be available in the default search paths, and otherwise have
> >     to be specified as expected via CPPFLAGS/LDFLAGS
> > 
> 
> I got some warnings and an error when compiling:
> 
> $ make CC=x86_64-w64-mingw32-gcc
>   CC       lib/compute_digest.o
>   CC       lib/hash_algs.o
>   CC       lib/sign_digest.o
>   CC       lib/utils.o
> lib/utils.c: In function ‘xmalloc’:
> lib/utils.c:25:25: warning: unknown conversion type character ‘l’ in format [-Wformat=]
>    25 |   libfsverity_error_msg("out of memory (tried to allocate %" SIZET_PF " bytes)",
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from lib/../common/win32_defs.h:24,
>                  from lib/../common/common_defs.h:18,
>                  from lib/lib_private.h:15,
>                  from lib/utils.c:14:
> /usr/x86_64-w64-mingw32/include/inttypes.h:36:18: note: format string is defined here
>    36 | #define PRIu64 "llu"
>       |                  ^
> lib/utils.c:25:25: warning: too many arguments for format [-Wformat-extra-args]
>    25 |   libfsverity_error_msg("out of memory (tried to allocate %" SIZET_PF " bytes)",
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   AR       libfsverity.a
>   CC       lib/compute_digest.shlib.o
>   CC       lib/hash_algs.shlib.o
>   CC       lib/sign_digest.shlib.o
>   CC       lib/utils.shlib.o
> lib/utils.c: In function ‘xmalloc’:
> lib/utils.c:25:25: warning: unknown conversion type character ‘l’ in format [-Wformat=]
>    25 |   libfsverity_error_msg("out of memory (tried to allocate %" SIZET_PF " bytes)",
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from lib/../common/win32_defs.h:24,
>                  from lib/../common/common_defs.h:18,
>                  from lib/lib_private.h:15,
>                  from lib/utils.c:14:
> /usr/x86_64-w64-mingw32/include/inttypes.h:36:18: note: format string is defined here
>    36 | #define PRIu64 "llu"
>       |                  ^
> lib/utils.c:25:25: warning: too many arguments for format [-Wformat-extra-args]
>    25 |   libfsverity_error_msg("out of memory (tried to allocate %" SIZET_PF " bytes)",
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   CCLD     libfsverity.so.0
> /usr/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -l:libcrypto.dll
> collect2: error: ld returned 1 exit status
> make: *** [Makefile:137: libfsverity.so.0] Error 1
> 
> 
> 
> This is on Arch Linux with mingw-w64-gcc and mingw-w64-openssl installed.
> 
> So there's something wrong with the SIZET_PF format string, and also
> -l:libcrypto.dll isn't correct; it should be just -lcrypto like it is on Linux.
> (MinGW knows to look for a .dll file.)
> 
> - Eric

Mmh I don't get any warnings on Debian - gcc-mingw-w64-x86-64 8.3.0-
6+21.3~deb10u1 - any idea how to fix it?

And on -lcrypto, it didn't use to work before the refactor - but now it
does. I have no clue what was happening. Will change it back in v3.

-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-12-17 18:45 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 14:47 [fsverity-utils PATCH v2 1/2] Remove unneeded includes luca.boccassi
2020-12-17 14:47 ` [fsverity-utils PATCH v2 2/2] Allow to build and run sign/digest on Windows luca.boccassi
2020-12-17 18:32   ` Eric Biggers
2020-12-17 18:44     ` Luca Boccassi [this message]
2020-12-17 19:05       ` Eric Biggers
2020-12-17 19:12         ` Luca Boccassi
2020-12-17 19:20           ` Eric Biggers
2020-12-17 19:26             ` Luca Boccassi
2020-12-17 19:16 ` [fsverity-utils PATCH v3 1/2] Remove unneeded includes luca.boccassi
2020-12-17 19:16   ` [fsverity-utils PATCH v3 2/2] Allow to build and run sign/digest on Windows luca.boccassi
2020-12-17 19:25 ` [fsverity-utils PATCH v4 1/2] Remove unneeded includes luca.boccassi
2020-12-17 19:25   ` [fsverity-utils PATCH v4 2/2] Allow to build and run sign/digest on Windows luca.boccassi
2020-12-21 21:40     ` Eric Biggers
2020-12-21 22:23       ` Luca Boccassi
2020-12-21 22:19     ` [PATCH v5] " Luca Boccassi
2020-12-21 23:03       ` Eric Biggers
2020-12-21 23:26         ` Luca Boccassi
2020-12-21 23:24       ` [PATCH v6 1/3] Move -D_GNU_SOURCE to CPPFLAGS Luca Boccassi
2020-12-21 23:24         ` [PATCH v6 2/3] Wrap ./fsverity in TEST_WRAPPER_PROG too Luca Boccassi
2020-12-21 23:24         ` [PATCH v6 3/3] Allow to build and run sign/digest on Windows Luca Boccassi
2020-12-21 23:53           ` Eric Biggers
2020-12-21 23:57             ` Luca Boccassi
2020-12-22  0:03               ` Eric Biggers
2020-12-22  0:11                 ` Luca Boccassi
2020-12-22  0:00         ` [PATCH v6 1/3] Move -D_GNU_SOURCE to CPPFLAGS Eric Biggers
2020-12-22  0:12           ` Luca Boccassi
2020-12-22  0:10         ` [PATCH v7 " Luca Boccassi
2020-12-22  0:10           ` [PATCH v7 2/3] Wrap ./fsverity in TEST_WRAPPER_PROG too Luca Boccassi
2020-12-22 18:41             ` Eric Biggers
2020-12-22  0:10           ` [PATCH v7 3/3] Allow to build and run sign/digest on Windows Luca Boccassi
2020-12-22 18:40             ` Eric Biggers
2020-12-22  8:21           ` [PATCH v7 1/3] Move -D_GNU_SOURCE to CPPFLAGS Eric Biggers
2020-12-22 18:40           ` Eric Biggers
2020-12-21 21:32   ` [fsverity-utils PATCH v4 1/2] Remove unneeded includes Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=695452fd56e71621a612dcdce8d203964bb64d0f.camel@gmail.com \
    --to=luca.boccassi@gmail.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).