Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#261 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cmake, cpp
Ambito
build-system

Direzione di ricerca

Apri il CMakeLists.txt nella directory principale e individua il blocco if(PS2X_IS_ARM_TARGET). Aggiungi un else che, per Clang o GNU, chiami add_compile_options(-msse4.1) come nell’issue (non sostituire CMAKE_CXX_FLAGS). Ricompila con clang o GCC su x86-64; il lavoro è completato quando gli errori degli intrinsic SSE4.1 sono scomparsi e il progetto continua a collegarsi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C++
Stelle
3.3k
Fork
149
Merge medio
4g 10h
PR unite (30g)
5

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ran-j/PS2Recomp

Tutte le issue di ran-j/PS2Recomp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.