php / php/php-src

Windows should distinguish between CFLAGS and CXXFLAGS

Aperta
#17,612 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Category: Build System Feature OS: Windows Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

Description

So far this is not a big problem: .c and .cpp files are passed to cl.exe (or clang-cl.exe), and the compiler figures our whether to compile as C or C++ according to the file extension. Always passing the same flags is also not an issue.

Enter newer C/C++ standards: recent versions of ICU require C++17, so ext/intl passes /std:c++17. cl.exe is still fine with this, but clang-cl.exe (18.1.8) complains about an unused argument when compiling .c files of ext/intl. Not a big deal. Now php-src requires C11, so I tried passing /std:c11. Besides hitting #17107, that generally works fine (get a warning in xxhash.h). However, when trying to build ext/intl, MSVC errors, reporting incompatible /std flags.

Thus I think we need at least a minimum support for CXXFLAGS. Full fledged support might be overkill, and likely raises issues with some external extensions. I'm not really sure how to support this, though. Ideas welcome!

Note that such support would be an issue for /MP enabled builds. Currently, these pass all source files added via a single ADD_SOURCES() call to the compiler in one go. Passing individual files basically circumvents /MP. If we split the sets (C files vs. C++ files), that would reduce the usefulness of /MP. Not a big deal for php-src, but might be some problem for external extensions.

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Non è indicato alcun file o test. Inizia tracciando la gestione dei flag del compilatore Windows e l’entry point ADD_SOURCES(); determina come i gruppi di sorgenti C e C++ vengono passati a cl.exe o clang-cl.exe. Il lavoro è completato quando CFLAGS e CXXFLAGS possono differire senza flag /std incompatibili e viene affrontato il compromesso documentato di /MP.

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

Valutazione

Stack tecnologico
c, cpp
Ambito
build-system
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.