Reputation: 327
When I run bitbake, it gets stuck in a package's do_configure task. Debugging by printing, I found that it got stuck in https://github.com/Kitware/CMake/blame/ae5f98a5e36da8cf3c75625ffb9a1d34aa2407cb/Modules/FindDoxygen.cmake, exactly this line:
file(GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
"$ENV{ProgramFiles}/Graphviz*/bin"
"$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
)
Then I wrote this CMakeLists.txt file:
set(_x86 "(x86)")
message(STATUS "Will run file GLOB...")
file(GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
"$ENV{ProgramFiles}/Graphviz*/bin"
"$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
)
unset(_x86)
message(STATUS "file GLOB end")
Running with an older cmake version on RedHat Linux:
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
$ cmake --version
cmake version 3.6.1
$ cmake .
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Will run file GLOB...
# stuck for several hours...
Running with a newer cmake version on Ubuntu 18.04.1 LTS:
$ cmake --version
cmake version 3.10.2
$ cmake .
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Will run file GLOB...
-- file GLOB end
...
-- Build files have been written to: xxx
# Finished in less than 1min.
So is file(GLOB)
a bug in older cmake version? I searched Google, no description about this "bug" found. But it does behave differently between older/newer versions.
Upvotes: 4
Views: 1599
Reputation: 18273
CMake execution hangs when this code is run on Linux, as the file()
command gets stuck on the parentheses in the path (x86)
. When bash
encounters parentheses, without being surrounded by single quotes, it throws the error:
bash: syntax error near unexpected token `('
Thus, on the older version of CMake, the file()
command will never return, because it uses bash
to perform specific operations.
The more recent versions of CMake have avoided the issue by surrounding this CMake code block with a check for Windows. See the latest code here:
if(WIN32)
set(_x86 "(x86)")
file(
GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
"$ENV{ProgramFiles}/Graphviz*/bin"
"$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
)
unset(_x86)
else()
set(_Doxygen_GRAPHVIZ_BIN_DIRS "")
endif()
Upvotes: 1