boostorg / boostorg/program_options

symbol visibility problem on macOS

オープン
#98 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
136
フォーク
117
PR マージ指標
30日以内にマージされた PR はありません

説明

When I compile with gcc-9, gcc-10, clang-9, clang-10 or the Xcode clang I have this problem. I do not see it under Linux (Ubuntu 18 LTS):
[BUG-REPORT.txt](https://github.com/boostorg/program_options/files/4944925/BUG-REPORT.txt)

I get linkage warnings that suggest possible runtime failure

ld: warning: direct access in function '__ZN5boost10wrapexceptINS_15program_options14unknown_optionEEC1ERKS3_' from file lib/libboost_program_options.a(options_description.o)' to global weak symbol '__ZTVN5boost15program_options5errorE' from file XXX means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

What's weird is that visibility should only apply to dynamic linkage, and I have built the libraries entirely statically.

I was able to get around this by building all of boost by supplying `cxxflags="-fvisibility=default"` to b2. Probably not the right fix but make the problem go away.

Probably incomplete list of symbols causing this problem. I do not have this issue with any other Boost library I use.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

BUG-REPORT.txtから始め、記載されているGCC、Clang、またはXcode Clangのバージョンを使ってmacOS上でstatic buildを再現します。b2's cxxflags="-fvisibility=default"を付けた場合と付けない場合でbuildを比較し、program_optionsシンボルに関するlinker警告を確認します。このworkaroundに依存せずにvisibility警告が解消されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
build-system, compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。