Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Fix value of CMAKE_C{,XX}_ARG when CC_ARG doesn't have args #56920

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

giordano
Copy link
Contributor

The problem was that cut by default prints the entire line if the delimiter doesn't appear, unless the option -s is used, which means that if CC_ARG contains only gcc then CMAKE_CC_ARG also contains gcc instead of being empty.

Before the PR:

$ make -C deps/ print-CC_ARG print-CMAKE_CC_ARG print-CMAKE_COMMON USECCACHE=1
make: Entering directory '/home/mose/repo/julia/deps'
CC_ARG=gcc
CMAKE_CC_ARG=gcc
CMAKE_COMMON=-DCMAKE_INSTALL_PREFIX:PATH=/home/mose/repo/julia/usr -DCMAKE_PREFIX_PATH=/home/mose/repo/julia/usr -DLIB_INSTALL_DIR=/home/mose/repo/julia/usr/lib -DCMAKE_INSTALL_LIBDIR=/home/mose/repo/julia/usr/lib -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER="$(which gcc)" -DCMAKE_C_COMPILER_ARG1="gcc " -DCMAKE_CXX_COMPILER="$(which g++)" -DCMAKE_CXX_COMPILER_ARG1="g++ " -DCMAKE_LINKER="$(which ld)" -DCMAKE_AR="$(which ar)" -DCMAKE_RANLIB="$(which ranlib)"
make: Leaving directory '/home/mose/repo/julia/deps'

After the PR

$ make -C deps/ print-CC_ARG print-CMAKE_CC_ARG print-CMAKE_COMMON USECCACHE=1
make: Entering directory '/home/mose/repo/julia/deps'
CC_ARG=gcc
CMAKE_CC_ARG=
CMAKE_COMMON=-DCMAKE_INSTALL_PREFIX:PATH=/home/mose/repo/julia/usr -DCMAKE_PREFIX_PATH=/home/mose/repo/julia/usr -DLIB_INSTALL_DIR=/home/mose/repo/julia/usr/lib -DCMAKE_INSTALL_LIBDIR=/home/mose/repo/julia/usr/lib -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER="$(which gcc)" -DCMAKE_CXX_COMPILER="$(which g++)" -DCMAKE_LINKER="$(which ld)" -DCMAKE_AR="$(which ar)" -DCMAKE_RANLIB="$(which ranlib)"
make: Leaving directory '/home/mose/repo/julia/deps'

as intended.

What I don't understand is why we use CMAKE_C_COMPILER_ARG1 in the first place, which is an undocumented hack.

The problem was that `cut` by default prints the entire line if the delimiter
doesn't appear, unless the option `-s` is used, which means that if `CC_ARG`
contains only `gcc` then `CMAKE_CC_ARG` also contains `gcc` instead of being empty.
@giordano giordano added the building Build system, or building Julia or its dependencies label Dec 30, 2024
@giordano
Copy link
Contributor Author

What I don't understand is why we use CMAKE_C_COMPILER_ARG1 in the first place, which is an undocumented hack.

It was introduced in #8906, funnily enough to make USECCACHE=1 work, which is what was breaking for me here, because we ended up passing the wrong -DCMAKE_C_COMPILER_ARG1="gcc ".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant