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

vulkaninfo: suppress -isystem being passed #1077

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

Conversation

stsquad
Copy link

@stsquad stsquad commented Feb 14, 2025

During the process of updating vulkan-tools in buildroot I ran into the following build failure:

[ 50%] Building CXX object vulkaninfo/CMakeFiles/vulkaninfo.dir/vulkaninfo.cpp.o
In file included from /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/include/c++/14.2.0/bits/stl_algo.h:71,
from /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/include/c++/14.2.0/algorithm:61,
from /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.4.307/vulkaninfo/./vulkaninfo.h:31,
from /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.4.307/vulkaninfo/generated/vulkaninfo.hpp:28,
from /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.4.307/vulkaninfo/vulkaninfo.cpp:34:
/home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/include/c++/14.2.0/cstdlib:79:15: fatal error: stdlib.h: No such file or directory
79 | #include_next <stdlib.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [vulkaninfo/CMakeFiles/vulkaninfo.dir/build.make:76: vulkaninfo/CMakeFiles/vulkaninfo.dir/vulkaninfo.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:116: vulkaninfo/CMakeFiles/vulkaninfo.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

The underlying reason was -isystem being passed to the build which I think resets the include path for system includes. This might be a bug in cmake but from looking at the CMake source I found some examples that set: NO_SYSTEM_FROM_IMPORTED 1 as a target property which seems to do the job.

This doesn't seem to affect the normal non-cross build although I wouldn't expect you need to pass -isystem anyway.

During the process of updating vulkan-tools in buildroot I ran into
the following build failure:

  [ 50%] Building CXX object vulkaninfo/CMakeFiles/vulkaninfo.dir/vulkaninfo.cpp.o
  In file included from /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/include/c++/14.2.0/bits/stl_algo.h:71,
                   from /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/include/c++/14.2.0/algorithm:61,
                   from /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.4.307/vulkaninfo/./vulkaninfo.h:31,
                   from /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.4.307/vulkaninfo/generated/vulkaninfo.hpp:28,
                   from /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.4.307/vulkaninfo/vulkaninfo.cpp:34:
  /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/include/c++/14.2.0/cstdlib:79:15: fatal error: stdlib.h: No such file or directory
     79 | #include_next <stdlib.h>
        |               ^~~~~~~~~~
  compilation terminated.
  make[2]: *** [vulkaninfo/CMakeFiles/vulkaninfo.dir/build.make:76: vulkaninfo/CMakeFiles/vulkaninfo.dir/vulkaninfo.cpp.o] Error 1
  make[1]: *** [CMakeFiles/Makefile2:116: vulkaninfo/CMakeFiles/vulkaninfo.dir/all] Error 2
  make: *** [Makefile:136: all] Error 2

The underlying reason was -isystem being passed to the build which I
think resets the include path for system includes. This might be a bug
in cmake but from looking at the CMake source I found some examples
that set: NO_SYSTEM_FROM_IMPORTED 1 as a target property which seems
to do the job.

This doesn't seem to affect the normal non-cross build although I
wouldn't expect you need to pass -isystem anyway.

Signed-off-by: Alex Bennée <[email protected]>
@ci-tester-lunarg
Copy link

Author stsquad not on autobuild list. Waiting for curator authorization before starting CI build.

1 similar comment
@ci-tester-lunarg
Copy link

Author stsquad not on autobuild list. Waiting for curator authorization before starting CI build.

@CLAassistant
Copy link

CLAassistant commented Feb 14, 2025

CLA assistant check
All committers have signed the CLA.

@ci-tester-lunarg
Copy link

CI Vulkan-Tools build queued with queue ID 372256.

@ci-tester-lunarg
Copy link

CI Vulkan-Tools build # 1620 running.

@ci-tester-lunarg
Copy link

CI Vulkan-Tools build # 1620 passed.

@charles-lunarg
Copy link
Contributor

Usually cross platform builds do not need such a change. Can you post your toolchain file, or at least the main bits of it? Not being able to find the standard library makes me think the C compiler is being used instead of the C++.

@stsquad
Copy link
Author

stsquad commented Feb 18, 2025

The build configure steps are:

vulkan-tools-1.3.262.tar.gz: OK (sha256: 8c77d02694d0516ae2ba3f3718745647e87e788ef93faabb2e3674ff32608010)
>>> vulkan-tools 1.3.262 Extracting
gzip -d -c /home/alex/lsrc/tests/buildroot.git/dl/vulkan-tools/vulkan-tools-1.3.262.tar.gz | /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/bin/tar --strip-components=1 -C /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.3.262   -xf -
>>> vulkan-tools 1.3.262 Patching
>>> vulkan-tools 1.3.262 Configuring
(mkdir -p /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.3.262/ && cd /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.3.262/ && rm -f CMakeCache.txt && PATH="/home/alex/lsrc/tests/buildroot.git/builds/arm64/host/bin:/home/alex/lsrc/tests/buildroot.git/builds/arm64/host/sbin:/home/alex/src/emacs/install/bin:/usr/lib/ccache:/home/alex/.cargo/bin:/home/alex/.local/bin:/home/alex/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"  /usr/bin/cmake /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.3.262/ -G"Unix Makefiles" -DCMAKE_MAKE_PROGRAM="/usr/bin/make" -DCMAKE_TOOLCHAIN_FILE="/home/alex/lsrc/tests/buildroot.git/builds/arm64/host/share/buildroot/toolchainfile.cmake" -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_INSTALL_RUNSTATEDIR="/run" -DCMAKE_COLOR_MAKEFILE=OFF -DBUILD_DOC=OFF -DBUILD_DOCS=OFF -DBUILD_EXAMPLE=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TEST=OFF -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON  -DBUILD_CUBE=OFF -DBUILD_ICD=OFF -DBUILD_VULKANINFO=ON -DINSTALL_ICD=OFF -DBUILD_WSI_DIRECTFB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=ON -DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_WAYLAND_SUPPORT=ON )
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/bin/aarch64-buildroot-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/bin/aarch64-buildroot-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/bin/pkg-config (found version "2.3.0") 
-- Found WAYLAND_CLIENT: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-client.so  
-- Found WAYLAND_SERVER: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-server.so  
-- Found WAYLAND_EGL: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-egl.so  
-- Found WAYLAND_CURSOR: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-cursor.so  
-- Found WAYLAND: /home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-client.so;/home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-server.so;/home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-egl.so;/home/alex/lsrc/tests/buildroot.git/builds/arm64/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libwayland-cursor.so  
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_DOC
    BUILD_DOCS
    BUILD_EXAMPLE
    BUILD_EXAMPLES
    BUILD_TEST
    BUILD_TESTING


-- Build files have been written to: /home/alex/lsrc/tests/buildroot.git/builds/arm64/build/vulkan-tools-1.3.262

The toolchain.cmake contains:

#
# Automatically generated file; DO NOT EDIT.
# CMake toolchain file for Buildroot
#

# In order to allow the toolchain to be relocated, we calculate the
# HOST_DIR based on this file's location: $(HOST_DIR)/share/buildroot
# and store it in RELOCATED_HOST_DIR.
# All the other variables that need to refer to HOST_DIR will use the
# RELOCATED_HOST_DIR variable.
string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR})

# Point cmake to the location where we have our custom modules,
# so that it can find our custom platform description.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})

if(NOT DEFINED CMAKE_SYSTEM_NAME)
  set(CMAKE_SYSTEM_NAME Buildroot)
endif()
if(NOT DEFINED CMAKE_SYSTEM_VERSION)
  set(CMAKE_SYSTEM_VERSION 1)
endif()
if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
  set(CMAKE_SYSTEM_PROCESSOR aarch64)
endif()

# Set the {C,CXX}FLAGS appended by CMake depending on the build type
# defined by Buildroot. CMake defaults these variables with -g and/or
# -O options, and they are appended at the end of the argument list,
# so the Buildroot options are overridden. Therefore these variables
# have to be cleared, so that the options passed in CMAKE_C_FLAGS do
# apply.
#
# Note:
#   if the project forces some of these flag variables, Buildroot is
#   screwed up and there is nothing Buildroot can do about that :(
if(NOT DEFINED CMAKE_C_FLAGS_DEBUG)
  set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS")
endif()
if(NOT DEFINED CMAKE_C_FLAGS_RELEASE)
  set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS")
endif()

# Build type from the Buildroot configuration
if(NOT DEFINED CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release CACHE STRING "Buildroot build configuration")
endif()

# Buildroot defaults flags.
# If you are using this toolchainfile.cmake file outside of Buildroot and
# want to customize the compiler/linker flags, then:
# * set them all on the cmake command line, e.g.:
#     cmake -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Og -g3 -D_FORTIFY_SOURCE=1 -Dsome_custom_flag" ...
# * and make sure the project's CMake code extends them like this if needed:
#     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dsome_definitions")
if(NOT DEFINED CMAKE_C_FLAGS)
  set(CMAKE_C_FLAGS "-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Og -g3 -D_FORTIFY_SOURCE=1" CACHE STRING "Buildroot CFLAGS")
endif()
if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS)
  set(CMAKE_EXE_LINKER_FLAGS "" CACHE STRING "Buildroot LDFLAGS for executables")
endif()
if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS)
  set(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "Buildroot LDFLAGS for shared libraries")
endif()
if(NOT DEFINED CMAKE_MODULE_LINKER_FLAGS)
  set(CMAKE_MODULE_LINKER_FLAGS "" CACHE STRING "Buildroot LDFLAGS for module libraries")
endif()

if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
  set(CMAKE_INSTALL_SO_NO_EXE 0)
endif()

if(NOT DEFINED CMAKE_PROGRAM_PATH)
  set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
endif()
if(NOT DEFINED CMAKE_SYSROOT)
  set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/aarch64-buildroot-linux-gnu/sysroot")
endif()
if(NOT DEFINED CMAKE_FIND_ROOT_PATH)
  set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/aarch64-buildroot-linux-gnu/sysroot")
endif()
if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()
if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()
if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/aarch64-buildroot-linux-gnu/sysroot")

# This toolchain file can be used both inside and outside Buildroot.
if(NOT DEFINED CMAKE_C_COMPILER)
  set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/bin/aarch64-buildroot-linux-gnu-gcc")
endif()
if(1)
  if(NOT DEFINED CMAKE_CXX_FLAGS_DEBUG)
    set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS")
  endif()
  if(NOT DEFINED CMAKE_CXX_FLAGS_RELEASE)
    set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS")
  endif()
  if(NOT DEFINED CMAKE_CXX_FLAGS)
    set(CMAKE_CXX_FLAGS "-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Og -g3 -D_FORTIFY_SOURCE=1" CACHE STRING "Buildroot CXXFLAGS")
  endif()
  if(NOT DEFINED CMAKE_CXX_COMPILER)
    set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/bin/aarch64-buildroot-linux-gnu-g++")
  endif()
endif()
if(0)
  if(NOT DEFINED CMAKE_Fortran_FLAGS_DEBUG)
    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
  endif()
  if(NOT DEFINED CMAKE_Fortran_FLAGS_RELEASE)
    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
  endif()
  if(NOT DEFINED CMAKE_Fortran_FLAGS)
    set(CMAKE_Fortran_FLAGS "-Og -g3" CACHE STRING "Buildroot FCFLAGS")
  endif()
  if(NOT DEFINED CMAKE_Fortran_COMPILER)
    set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/bin/aarch64-buildroot-linux-gnu-gfortran")
  endif()
endif()

# For Qt6
if(NOT DEFINED QT_HOST_PATH)
  set(QT_HOST_PATH "${RELOCATED_HOST_DIR}")
endif()

if(NOT DEFINED QT_HOST_PATH_CMAKE_DIR)
  set(QT_HOST_PATH_CMAKE_DIR "${RELOCATED_HOST_DIR}/lib/cmake")
endif()

@stsquad
Copy link
Author

stsquad commented Feb 27, 2025

@charles-lunarg was the toolchain as you expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants