Skip to content

Some warnings on compile #1090

Closed
Closed

Description

@Keitagit-kun

I'm compile static libssh2 with mingw-w64 x86_64-7.2.0 but I get some strange warnings:

[  4%] Building C object src/CMakeFiles/libssh2_static.dir/agent.c.obj
[  8%] Building C object src/CMakeFiles/libssh2_static.dir/bcrypt_pbkdf.c.obj
[ 12%] Building C object src/CMakeFiles/libssh2_static.dir/channel.c.obj
[ 16%] Building C object src/CMakeFiles/libssh2_static.dir/comp.c.obj
[ 20%] Building C object src/CMakeFiles/libssh2_static.dir/crypt.c.obj
[ 25%] Building C object src/CMakeFiles/libssh2_static.dir/crypto.c.obj
[ 29%] Building C object src/CMakeFiles/libssh2_static.dir/global.c.obj
[ 33%] Building C object src/CMakeFiles/libssh2_static.dir/hostkey.c.obj
[ 37%] Building C object src/CMakeFiles/libssh2_static.dir/keepalive.c.obj
[ 41%] Building C object src/CMakeFiles/libssh2_static.dir/kex.c.obj
[ 45%] Building C object src/CMakeFiles/libssh2_static.dir/knownhost.c.obj
[ 50%] Building C object src/CMakeFiles/libssh2_static.dir/mac.c.obj
[ 54%] Building C object src/CMakeFiles/libssh2_static.dir/misc.c.obj
[ 58%] Building C object src/CMakeFiles/libssh2_static.dir/packet.c.obj
[ 62%] Building C object src/CMakeFiles/libssh2_static.dir/pem.c.obj
[ 66%] Building C object src/CMakeFiles/libssh2_static.dir/publickey.c.obj
[ 70%] Building C object src/CMakeFiles/libssh2_static.dir/scp.c.obj
C:\Temp\libssh2-1.11.0\src\scp.c: In function 'scp_send':
C:\Temp\libssh2-1.11.0\src\scp.c:1053:51: warning: unknown conversion type character 'l' in format [-Wformat=]
                      LIBSSH2_SCP_RESPONSE_BUFLEN, "C0%o %"
                                                   ^~~~~~~~
In file included from C:\Temp\libssh2-1.11.0\src\scp.c:39:0:
C:\Temp\libssh2-1.11.0\src\libssh2_priv.h:1197:34: note: format string is defined here
 #define LIBSSH2_INT64_T_FORMAT "lld"
                                  ^
C:\Temp\libssh2-1.11.0\src\scp.c:1053:51: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'libssh2_int64_t {aka long long int}' [-Wformat=]
                      LIBSSH2_SCP_RESPONSE_BUFLEN, "C0%o %"
                                                   ^~~~~~~~
C:\Temp\libssh2-1.11.0\src\scp.c:1054:48: note: format string is defined here
                      LIBSSH2_INT64_T_FORMAT " %s\n", mode,
                                               ~^
                                               %I64d
C:\Temp\libssh2-1.11.0\src\scp.c:1053:51: warning: too many arguments for format [-Wformat-extra-args]
                      LIBSSH2_SCP_RESPONSE_BUFLEN, "C0%o %"
                                                   ^~~~~~~~
[ 75%] Building C object src/CMakeFiles/libssh2_static.dir/session.c.obj
[ 79%] Building C object src/CMakeFiles/libssh2_static.dir/sftp.c.obj
[ 83%] Building C object src/CMakeFiles/libssh2_static.dir/transport.c.obj
[ 87%] Building C object src/CMakeFiles/libssh2_static.dir/userauth.c.obj
[ 91%] Building C object src/CMakeFiles/libssh2_static.dir/userauth_kbd_packet.c.obj
[ 95%] Building C object src/CMakeFiles/libssh2_static.dir/version.c.obj
[100%] Linking C static library libssh2.a
[100%] Built target libssh2_static```

should I ignore it and use resulted libssh2 or those warnings better be fixed?

Activity

  1. vszakats commented on Jun 10, 2023

    @vszakats
    Member

    It'd definitely be better to fix it.

    It's also a tricky one. I have deleted a __MINGW32__ condition earlier (02f2700) to fix this for MinGW + gcc 12, which complains about the opposite:

    2023-03-11T19:55:44.1541596Z scp.c: In function 'scp_send':
    2023-03-11T19:55:44.1542668Z scp.c:1019:51: warning: ISO C does not support the 'I' printf flag [-Wformat=]
    2023-03-11T19:55:44.1543208Z  1019 |                      LIBSSH2_SCP_RESPONSE_BUFLEN, "C0%o %"
    2023-03-11T19:55:44.1543582Z       |                                                   ^~~~~~~~
    2023-03-11T19:55:44.1544193Z scp.c:1019:51: warning: format '%d' expects argument of type 'int', but argument 5 has type 'libssh2_int64_t' {aka 'long long int'} [-Wformat=]
    2023-03-11T19:55:44.1544687Z  1019 |                      LIBSSH2_SCP_RESPONSE_BUFLEN, "C0%o %"
    2023-03-11T19:55:44.1545026Z       |                                                   ^~~~~~~~
    2023-03-11T19:55:44.1545355Z  1020 |                      LIBSSH2_INT64_T_FORMAT " %s\n", mode,
    2023-03-11T19:55:44.1545670Z  1021 |                      size, base);
    2023-03-11T19:55:44.1545952Z       |                      ~~~~..........................
    2023-03-11T19:55:44.1546233Z       |                      |
    2023-03-11T19:55:44.1546547Z       |                      libssh2_int64_t {aka long long int}
    

    Does someone know the magic formula to make all MinGW versions happy?

  2. added a commit that references this issue on Jun 13, 2023
    8d09bbb
  3. vszakats commented on Jun 13, 2023

    @vszakats
    Member

    @Keitagit-kun Does this patch fix it for you?: #1091

  4. Keitagit-kun commented on Jun 13, 2023

    @Keitagit-kun
    Author

    Yes! Thanks!

  5. vszakats commented on Jun 13, 2023

    @vszakats
    Member

    Thanks for confirming! The fix is merged now.

  6. added a commit that references this issue on Jul 16, 2023
    600c1c8
  7. added a commit that references this issue on Mar 28, 2024
    36c1e1d
  8. added a commit that references this issue on Jul 14, 2024
    851e443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions