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

Build: x86-64 needs an explicit -msse4.1 for clang/GCC, since the generated code uses SSE4.1 intrinsics

オープン 初心者向け
#261 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cmake, cpp
領域
build-system

調査の方向性

ルートのCMakeLists.txtを開き、if(PS2X_IS_ARM_TARGET)ブロックを見つけてください。ClangまたはGNUの場合に、issueのとおりadd_compile_options(-msse4.1)を呼び出すelseを追加してください(CMAKE_CXX_FLAGSは置き換えないでください)。x86-64上でclangまたはGCCを使って再ビルドしてください。SSE4.1 intrinsicのエラーがなくなり、プロジェクトが引き続きリンクできれば完了です。

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

説明

What happens

The generated runner code emits SSE4.1 intrinsics -- _mm_blendv_ps (442 occurrences in our output), _mm_mullo_epi32, _mm_extract_epi32. The root CMakeLists.txt only sets an architecture flag for ARM targets (the if(PS2X_IS_ARM_TARGET) block); there is no else branch for x86, and no SSE4.1 handling anywhere in the tree at 75d729ce or on main.

MSVC has no notion of target features and accepts these intrinsics unconditionally on x64, so the defect is invisible when building with cl.exe. clang and GCC keep clang's semantics and refuse:

error: always_inline function '_mm_mullo_epi32' requires target feature 'sse4.1',
       but would be inlined into function 'main' that is compiled without
       support for 'sse4.1'

Measured on this host with clang-cl 22.1.3, flag by flag on a neutral file: without -msse4.1 the intrinsic is rejected; with -msse4.1, /clang:-msse4.1 or /arch:AVX it compiles, links and runs. cl.exe accepts it with no flag at all. On Linux with clang the build broke at unity_85_cxx.cxx.o.

Issue #166 shows another user's configure log containing -- x86 target detected, enabling SSE4.1 and -- SSE4.1 compiler flag enabled. Those strings appear nowhere in this repository's history, on any branch, so that was a local fix on their side rather than an upstream one.

Suggested fix

Give the if(PS2X_IS_ARM_TARGET) block an else branch, so the flag is added rather than left to the caller:

else()
    if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
        message(STATUS "x86-64 Clang/GCC detected - adding -msse4.1")
        add_compile_options(-msse4.1)
    endif()
endif()

add_compile_options adds to the flag set. Worth preferring over telling users to pass -DCMAKE_CXX_FLAGS=-msse4.1, because that form replaces CMake's defaults (/DWIN32 /D_WINDOWS /EHsc) and silently disables exceptions -- which then fails ps2xRecomp with "cannot use 'throw' with exceptions disabled". That cost us a build cycle to diagnose.


Found while statically recompiling Ridge Racer V (NTSC-U, SLUS_200.02) with PS2Recomp.
Tested on commit 75d729ce; main was c5a9d02 at the time of writing, one README-only commit ahead.
Host: Windows 11 x64, clang-cl 22.1.3 + Ninja, MSVC toolset 14.51.36231, Windows SDK 10.0.26100.0, CMake 4.2.3.
None of these are specific to this game.

主要言語
C++
スター
3.3k
フォーク
149
平均マージ
5日 10時間
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

ran-j/PS2Recomp のほかの issue

ran-j/PS2Recomp の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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