[MinGW-Notify] [mingw] #39757: Compilation with GNU-C++ creates multiple definitions of vsnprintf()

Back to archive index
MinGW Notification List mingw****@lists*****
Wed Nov 13 23:20:10 JST 2019


#39757: Compilation with GNU-C++ creates multiple definitions of vsnprintf()



  Open Date: 2019-11-13 14:00
Last Update: 2019-11-13 14:20

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/39757
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39757

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2019-11-13 14:20 Updated by: keith
 * Owner Update from (None) to keith

 * Severity Update from 5 - Medium to 8

 * Priority Update from 5 - Medium to 7


Comment:

This is a critical regression, introduced in mingwrt-5.2.2; it arises from
changes in <stdio.h>, to resolve issue #39224, which cause g++ to emit multiple
publicly visible instances of vsnprintf(), each of which refers to an extern
implementation of __mingw_vsnprintf(), and conflicts with its publicly visible
vsprintf() alias, within the translation unit in which __mingw_vsnprintf()
itself is implemented.



---------------------------------------------------------------------
Ticket Status:

      Reporter: keith
         Owner: keith
          Type: Issues
        Status: Open [Owner assigned]
      Priority: 7
     MileStone: (None)
     Component: WSL
      Severity: 8
    Resolution: None
---------------------------------------------------------------------

Ticket details:

As reported in this pair of e-mail threads:

  • https://osdn.net/projects/mingw/lists/archive/users/2019-August/000333.htmlhttps://osdn.net/projects/mingw/lists/archive/users/2019-August/000335.html

compilation of any C++ translation unit which refers, either directly or
indirectly, to vsnprintf(), will result in link failure, due to multiple public
definitions of this symbol. The issue is clearly illustrated by the following
code, (abstracted from the latter e-mail report):

 1.  #include <stdio.h>
 2.  #include <stdarg.h>
 3.  
 4.  void debug_log(const char *fmt, ...) {
 5.      va_list args;
 6.      va_start(args, fmt);
 7.      char buf[1+vsnprintf(NULL, 0, fmt, args)];
 8.      vsnprintf(buf, sizeof buf, fmt, args);
 9.      va_end(args);
10.  }
11.  
12.  main() {
13.      printf("mingw-link\n");
14.  }

compilation of which yields:

$ g++ -o mingw-link.exe main.cpp
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe:
  c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../libmingwex.a(vsnprintf.o):(.text+0x0): multiple definition of `vsnprintf';
main.cpp:(.text$vsnprintf[_vsnprintf]+0x0): first defined here
collect2.exe: error: ld returned 1 exit status



-- 
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN

Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/mingw/ticket/39757
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39757



More information about the MinGW-Notify mailing list
Back to archive index