Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Link error with gcc 11.2.1

オープン
#175 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
c, cmake
領域
build-system

調査の方向性

まず、issue に記載されているコマンドを使って、報告されたビルドを GCC 11.2.1 で再現し、次に CMakeLists.txt と libuv 依存関係の設定を調べます。プロジェクトで位置独立コードを有効にすると共有ライブラリのリンクエラーが解決するか確認し、通常の CMake ビルドが relocation エラーなしで完了することを検証します。

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

説明

I'm seeing the following link error when building locally using the following commands:

$ mkdir build                                                                   
$ cd build                                                                      
$ cmake ..                                                                      
$ make                                                                          
[ 59%] Linking C shared library libuvwasi.so                                    
/usr/bin/ld: _deps/libuv-build/libuv_a.a(random.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
...                                                                             
collect2: error: ld returned 1 exit status                                      
make[2]: *** [CMakeFiles/uvwasi.dir/build.make:210: libuvwasi.so] Error 1          
make[1]: *** [CMakeFiles/Makefile2:196: CMakeFiles/uvwasi.dir/all] Error 2         
make: *** [Makefile:146: all] Error 2

This can be avoided around by setting CMAKE_POSITION_INDEPENDENT_CODE to True:

$ cmake -DCMAKE_POSITION_INDEPENDENT_CODE=True ..

This could also be set in CMakeLists.txt:

set(CMAKE_POSITION_INDEPENDENT_CODE ON)                                         

GCC version:

$ gcc --version
gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)

I'm not sure if this is an issue with my local environment, as the CI servers are obviously working as expected. But I wanted to create this issue just in case anyone else runs into it.

主要言語
C
スター
272
フォーク
60
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nodejs/uvwasi のほかの issue

nodejs/uvwasi の issue をすべて見る

似ている issue

C の issue をもっと見る

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

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