チケット #39757

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

登録: 2019-11-13 23:00 最終更新: 2019-11-15 22:26

報告者:
担当者:
チケットの種類:
状況:
完了
コンポーネント:
マイルストーン:
(未割り当て)
優先度:
7
重要度:
8
解決法:
修正済み
ファイル:
1
投票
点数: 0
No votes
0.0% (0/0)
0.0% (0/0)

詳細

As reported in this pair of e-mail threads:

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. void debug_log(const char *fmt, ...) {
  4. va_list args;
  5. va_start(args, fmt);
  6. char buf[1+vsnprintf(NULL, 0, fmt, args)];
  7. vsnprintf(buf, sizeof buf, fmt, args);
  8. va_end(args);
  9. }
  10. main() {
  11. printf("mingw-link\n");
  12. }
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

チケットの履歴 (6 件中 3 件表示)

2019-11-13 23:00 更新者: keith
  • 新しいチケット "Compilation with GNU-C++ creates multiple definitions of vsnprintf()" が作成されました
2019-11-13 23:20 更新者: keith
  • 担当者(未割り当て) から keith に更新されました
  • 重要度5 - 中 から 8 に更新されました
  • 優先度5 - 中 から 7 に更新されました
コメント

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.

(編集済, 2019-11-13 23:40 更新者: keith)
2019-11-13 23:32 更新者: keith
  • 添付ファイル vsnprintf-definition.patch (File ID: 5588) が付加されました
2019-11-14 00:46 更新者: keith
  • 添付ファイル vsnprintf-definition.patch (File ID: 5588) が削除されました
2019-11-15 22:26 更新者: keith
  • 状況オープン から 完了 に更新されました
  • 解決法なし から 修正済み に更新されました
コメント

I applied the proposed patch, and committed it as changeset id.3c7767e. This will be included in the next WSL release.

添付ファイルリスト

編集

このチケットにコメントを追加するには、ログインが必要です » ログインする