Bug 199098 - Mk/Uses/compiler.mk: Some ports may use COMPILER_TYPE instead of CHOSEN_COMPILER_TYPE
Summary: Mk/Uses/compiler.mk: Some ports may use COMPILER_TYPE instead of CHOSEN_COMPI...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Port Management Team
URL:
Keywords: needs-qa, patch
Depends on: 216561
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-01 18:14 UTC by David Naylor
Modified: 2022-08-26 07:39 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback? (portmgr)
antoine: merge-quarterly-
koobs: exp-run?


Attachments
Add CHOSEN_COMPILER_VERSION (to complement (ALT_)COMPILER_VERSION) (4.65 KB, patch)
2016-03-06 19:21 UTC, David Naylor
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Naylor freebsd_committer freebsd_triage 2015-04-01 18:14:29 UTC
Some ports use COMPILER_TYPE but have some variation of USES=compiler:c11 (instead of USES=compiler or USES=compiler:feature) thinking COMPILER_TYPE refers to the chosen compiler type instead of actually the base compiler available.  

To find a list of ports that could potentially suffer from this:
# find . -name Makefile | xargs grep COMPILER_TYPE | grep -v CHOSEN_COMPILER_TYPE | cut -f 1 -d : | sort -u | xargs -n1 -I % sh -c "if ! grep -q '\(compiler[^:]\|compiler:feature\)' % ; then echo % ; fi"
./audio/xmms-sapplug/Makefile
./databases/gosqlite3/Makefile
./devel/binutils/Makefile
./devel/dotconf++/Makefile
./devel/godot/Makefile
./devel/llvm35/Makefile
./devel/llvm36/Makefile
./devel/powerpc64-xtoolchain-gcc/Makefile
./devel/sdl2pp/Makefile
./emulators/cpmemu/Makefile
./emulators/gnuboy/Makefile
./emulators/wine-devel/Makefile
./games/cataclysm-dda/Makefile
./games/fgrun/Makefile
./games/flare-engine/Makefile
./games/quantumminigolf/Makefile
./graphics/aaphoto/Makefile
./graphics/openimageio/Makefile
./java/java-subversion/Makefile
./lang/gcc/Makefile
./lang/gcc49/Makefile
./lang/gcc5/Makefile
./math/fftw3/Makefile
./net-mgmt/sendip/Makefile
./net-p2p/libtorrent/Makefile
./net/xorp/Makefile
./security/libscrypt/Makefile
./sysutils/consul/Makefile
./www/tokyopromenade/Makefile
./x11-fm/walcommander/Makefile
./x11-toolkits/wxgtk30/Makefile
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-04-01 18:38:21 UTC
A commit references this bug:

Author: dbn
Date: Wed Apr  1 18:37:30 UTC 2015
New revision: 382937
URL: https://svnweb.freebsd.org/changeset/ports/382937

Log:
  emulators/wine-devel: unbreak build.

  Changes:
   * Add CPPBIN="${CPP}" to CONFIGURE_ENV as Wine uses $CPPBIN, instead of
     $CPP, in ./configure
   * Use CHOSEN_COMPILER_TYPE instead of COMPILER_TYPE.  The later is what
     the base compiler is whereas the former to what is chosen to satisfy
     USES=compiler:c11

  PR:		199098
  Reported by:	pkg-fallout, gerald@

Changes:
  head/emulators/wine-devel/Makefile
Comment 2 David Naylor freebsd_committer freebsd_triage 2016-03-06 19:21:09 UTC
Created attachment 167773 [details]
Add CHOSEN_COMPILER_VERSION (to complement (ALT_)COMPILER_VERSION)
Comment 3 VK freebsd_triage 2016-10-16 19:01:24 UTC
This looks like a framework issue, reassigning, but it's over a year old. Is this issue still relevant?
Comment 4 David Naylor freebsd_committer freebsd_triage 2016-10-18 05:28:41 UTC
It is still an issue (see below for a list of ports that use COMPILER_TYPE.  

COMPILER_TYPE should be removed, and ports should only depend on CHOSEN_COMPILER_TYPE (or a few renames to make things sensible).  

# find . -name Makefile | xargs grep COMPILER_TYPE | grep -v CHOSEN_COMPILER_TYPE | cut -f 1 -d : | sort -u | xargs -n1 -I % sh -c "if ! grep -q '\(compiler[^:]\|compiler:feature\)' % ; then echo % ; fi"
./audio/clementine-player/Makefile
./audio/murmur/Makefile
./audio/xmms-sapplug/Makefile
./cad/kicad-devel/Makefile
./cad/opencascade/Makefile
./devel/binutils/Makefile
./devel/dotconf++/Makefile
./devel/ds2/Makefile
./devel/lldb37/Makefile
./devel/lldb38/Makefile
./devel/llvm-cheri/Makefile
./devel/llvm35/Makefile
./devel/llvm36/Makefile
./devel/powerpc64-xtoolchain-gcc/Makefile
./devel/py-cffi/Makefile
./devel/sdl2pp/Makefile
./devel/thrift-cpp/Makefile
./editors/libreoffice/Makefile
./editors/openoffice-4/Makefile
./editors/openoffice-devel/Makefile
./emulators/cpmemu/Makefile
./emulators/dolphin-emu/Makefile
./emulators/gnuboy/Makefile
./games/flare-engine/Makefile
./games/libretro-cores/Makefile
./games/quantumminigolf/Makefile
./games/rubix/Makefile
./games/stonesoup/Makefile
./games/wyrmgus/Makefile
./graphics/aaphoto/Makefile
./graphics/darktable/Makefile
./graphics/mapnik/Makefile
./java/java-subversion/Makefile
./math/fftw3/Makefile
./multimedia/assimp/Makefile
./net-mgmt/sendip/Makefile
./net-p2p/libtorrent/Makefile
./security/libscrypt/Makefile                                                                                                      
./sysutils/consul-alerts/Makefile                                                                                                  
./sysutils/consul/Makefile                                                                                                         
./sysutils/nomad/Makefile                                                                                                          
./www/grafana2/Makefile                                                                                                            
./www/grafana3/Makefile                                                                                                            
./www/squid-devel/Makefile                                                                                                         
./www/tokyopromenade/Makefile                                                                                                      
./x11-fm/wcmcommander/Makefile                                                                                                     
./x11-toolkits/wxgtk30/Makefile
Comment 5 Antoine Brodin freebsd_committer freebsd_triage 2016-10-18 05:59:52 UTC
I believe CHOSEN_COMPILER_VERSION=${CC:S/gcc//} will not work, bsd.gcc.mk is loaded late and ports check this value
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2016-10-18 09:07:01 UTC
CC lang/{gcc,clang} maintainers for possible feedback
Comment 7 David Naylor freebsd_committer freebsd_triage 2016-10-18 15:01:05 UTC
(In reply to Antoine Brodin from comment #5)
I don't see any .*COMPILER.* flags used or set in bsd.gcc.mk and I believe the use of USE_GCC is mutually exclusive to USES=compiler.  Am I missing something here?
Comment 8 Antoine Brodin freebsd_committer freebsd_triage 2016-10-18 15:14:11 UTC
(In reply to David Naylor from comment #7)
Mk/Uses/compiler.mk has some USE_GCC=yes inside it,  and bsd.gcc.mk is loaded in bsd.port.post.mk phase where it sets CC
Comment 9 David Naylor freebsd_committer freebsd_triage 2016-10-28 16:54:35 UTC
I see, yes, CHOSEN_COMPILER_VERSION=${CC:S/gcc//} will not work.
Comment 10 Antoine Brodin freebsd_committer freebsd_triage 2016-11-11 21:50:43 UTC
(In reply to David Naylor from comment #4)
Half of the ports in this list look false positives.

audio/xmms-sapplug is correct (USES=compiler)
devel/binutils is correct (USES=compiler:env)
devel/dotconf++ is correct (USES=compiler:env)
devel/ds2 is correct (USES=compiler)
devel/py-cffi is correct (USES=compiler)
emulators/gnuboy is correct (USES=compiler)
games/flare-engine  is correct (USES=compiler:env)
net-mgmt/sendip is correct (USES=compiler)
www/grafana2 is correct (USES=compiler)
www/grafana3 is correct (USES=compiler)

audio/murmur is wrong, uses COMPILER_TYPE when it should use CHOSEN_COMPILER_TYPE
cad/kicad-devel is wrong, uses COMPILER_TYPE when it should use CHOSEN_COMPILER_TYPE
cad/opencascade is wrong, uses COMPILER_TYPE when it should use CHOSEN_COMPILER_TYPE
devel/sdl2pp is wrong, uses COMPILER_TYPE when it should use CHOSEN_COMPILER_TYPE
Comment 11 commit-hook freebsd_committer freebsd_triage 2016-11-12 17:38:32 UTC
A commit references this bug:

Author: antoine
Date: Sat Nov 12 17:38:27 UTC 2016
New revision: 425968
URL: https://svnweb.freebsd.org/changeset/ports/425968

Log:
  Spell CHOSEN_COMPILER_TYPE correctly

  PR:		199098

Changes:
  head/audio/murmur/Makefile
  head/cad/kicad-devel/Makefile
  head/cad/opencascade/Makefile
  head/devel/sdl2pp/Makefile
  head/games/libretro-cores/Makefile
  head/games/stonesoup/Makefile
  head/games/wyrmgus/Makefile
  head/graphics/mapnik/Makefile
  head/multimedia/assimp/Makefile
  head/net-p2p/libtorrent/Makefile
  head/x11-fm/wcmcommander/Makefile
  head/x11-toolkits/wxgtk30/Makefile
Comment 12 commit-hook freebsd_committer freebsd_triage 2016-11-12 19:24:49 UTC
A commit references this bug:

Author: antoine
Date: Sat Nov 12 19:24:16 UTC 2016
New revision: 425986
URL: https://svnweb.freebsd.org/changeset/ports/425986

Log:
  Spell CHOSEN_COMPILER_TYPE correctly

  PR:		199098

Changes:
  head/www/squid-devel/Makefile
Comment 13 commit-hook freebsd_committer freebsd_triage 2016-11-12 23:20:17 UTC
A commit references this bug:

Author: antoine
Date: Sat Nov 12 23:20:07 UTC 2016
New revision: 426000
URL: https://svnweb.freebsd.org/changeset/ports/426000

Log:
  Spell CHOSEN_COMPILER_TYPE correctly

  PR:		199098

Changes:
  head/audio/clementine-player/Makefile
  head/devel/llvm35/Makefile
  head/devel/llvm36/Makefile
Comment 14 David Naylor freebsd_committer freebsd_triage 2018-12-11 07:49:34 UTC
(In reply to Antoine Brodin from comment #10)
I only half see why there is a false positive use of COMPILER_TYPE.  The way I understand it a port should always use CHOSEN_COMPILER_TYPE as this may differ to COMPILER_TYPE that simply represents the system compiler.  A port should be using $CC (i.e. CHOSEN_COMPILER_TYPE) instead of /usr/bin/cc (i.e. COMPILER_TYPE).  

However, if a port just has USES=compiler then CHOSEN_COMPILER_TYPE=$COMPILER_TYPE and thus there is no actual problem.  But, I do think COMPILER_TYPE should not be exposed by USES=compiler to avoid confusion.  

I fixed the false positives detection and the list of bad ports is now: 
# find . -name Makefile | xargs grep COMPILER_TYPE | grep -v CHOSEN_COMPILER_TYPE | cut -f 1 -d : | sort -u | xargs -n1 -I % sh -c "if ! grep -qE '(compiler([^:]|\$)|compiler:(env|feature))' % ; then echo % ; fi" | cut -f 2-3 -d /
audio/mumble
chinese/gcin-qt5
databases/ldb12
databases/p5-Tie-LevelDB
databases/rocksdb
devel/astyle
devel/gdb
devel/libastylej
devel/llvm-cheri
devel/powerpc64-xtoolchain-gcc
devel/rapidjson
devel/thrift-cpp
devel/xtoolchain-llvm-devel
editors/libreoffice
editors/openoffice-4
editors/openoffice-devel
games/rubix
games/stockfish
graphics/aaphoto
www/node
www/node10
www/node6
www/node8
x11-toolkits/fox17
Comment 15 commit-hook freebsd_committer freebsd_triage 2018-12-11 10:11:07 UTC
A commit references this bug:

Author: antoine
Date: Tue Dec 11 10:10:07 UTC 2018
New revision: 487230
URL: https://svnweb.freebsd.org/changeset/ports/487230

Log:
  Spell CHOSEN_COMPILER_TYPE correctly

  PR:		199098
  With hat:	portmgr

Changes:
  head/audio/mumble/Makefile
  head/chinese/gcin-qt5/Makefile
  head/databases/ldb12/Makefile
  head/databases/p5-Tie-LevelDB/Makefile
  head/databases/rocksdb/Makefile
  head/devel/astyle/Makefile
  head/devel/gdb/Makefile
  head/devel/libastylej/Makefile
  head/devel/llvm-cheri/Makefile
  head/devel/rapidjson/Makefile
  head/devel/thrift-cpp/Makefile
  head/editors/libreoffice/Makefile
  head/editors/openoffice-4/Makefile
  head/editors/openoffice-devel/Makefile
  head/games/rubix/Makefile
  head/games/stockfish/Makefile
  head/graphics/aaphoto/Makefile
  head/www/node/Makefile
  head/www/node10/Makefile
  head/www/node6/Makefile
  head/www/node8/Makefile
  head/x11-toolkits/fox17/Makefile
Comment 16 commit-hook freebsd_committer freebsd_triage 2022-08-26 07:39:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a60b5f495b51aaaf674ac9fbcd1ee83434544979

commit a60b5f495b51aaaf674ac9fbcd1ee83434544979
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2022-08-26 07:36:08 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2022-08-26 07:39:03 +0000

    compiler: use CHOSEN_COMPILER_TYPE instead of COMPILER_TYPE

    CHOSEN_COMPILER_TYPE is the only safe variable to let a port know which
    typer of compiler has been elected to be used by the framework

    PR:     199098

 audio/funktrackergold/Makefile  | 2 +-
 devel/freebsd-gcc12/Makefile    | 2 +-
 devel/freebsd-gcc6/Makefile     | 4 ++--
 devel/freebsd-gcc9/Makefile     | 2 +-
 devel/fuzzylite/Makefile        | 2 +-
 devel/google-perftools/Makefile | 2 +-
 devel/llvm-cheri/Makefile       | 2 +-
 security/botan2/Makefile        | 2 +-
 x11-toolkits/wxgtk28/Makefile   | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)