xmake-io / xmake-repo

📦 An official xmake package repository
https://xrepo.xmake.io
Apache License 2.0
616 stars 369 forks source link

[boost] boost 1.85.0 使用clang-cl工具链开启asan,在测试时显示找不到头文件"string.hpp" #4503

Open Arteiimis opened 1 week ago

Arteiimis commented 1 week ago

Xmake 版本

2.9.3

操作系统版本和架构

win10

描述问题

当使用clang-cl作为boost的构建工具时,不开启asan可以正常编译测试通过,开启asan会提示找不到"string.hpp"

期待的结果

开启asan,正常使用clang-cl构建

工程配置

add_rules("mode.debug", "mode.release")

set_policy("build.sanitizer.address", true)
set_languages("c++23")
set_toolchains("clang-cl")
set_runtimes("MD")

add_requires("boost")

target("test")
    add_files("src/*.cpp")

    add_packages("boost")
    set_toolchains("clang-cl")
target_end()

附加信息和错误日志

> checking for c++ snippet(test)
checkinfo: ...amdir\core\sandbox\modules\import\core\tool\compiler.lua:84: @programdir\modules\core\tools\clang_cl.lua:199: C:\Users\LEGION\AppData\Local\Temp\.xmake\240628\_30B5E98FD1734C4383CE607874386DE7.cpp(4,22): fatal error: 'boost/algorithm/string.hpp' file not found
    4 |             #include <boost/algorithm/string.hpp>
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [@programdir\modules\core\tools\clang_cl.lua:199]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [@programdir\modules\core\tools\clang_cl.lua:152]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]:
    [@programdir\core\tool\compiler.lua:278]: in function 'compile'
    [...amdir\core\sandbox\modules\import\core\tool\compiler.lua:82]: in function 'compile'
    [@programdir\modules\lib\detect\check_cxsnippets.lua:244]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [@programdir\modules\lib\detect\check_cxsnippets.lua:236]:
    [...al\.xmake\repositories\github\packages\b\boost\xmake.lua:408]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...dir\modules\private\action\require\impl\actions\test.lua:41]:
    [...\modules\private\action\require\impl\actions\install.lua:444]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:370]:
    [...modules\private\action\require\impl\install_packages.lua:491]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:241]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [@programdir\modules\async\runjobs.lua:223]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:406]:

error: ...al\.xmake\repositories\github\packages\b\boost\xmake.lua:408: ...amdir\core\sandbox\modules\import\core\tool\compiler.lua:84: @programdir\modules\core\tools\clang_cl.lua:199: C:\Users\LEGION\AppData\Local\Temp\.xmake\240628\_30B5E98FD1734C4383CE607874386DE7.cpp(4,22): fatal error: 'boost/algorithm/string.hpp' file not found
    4 |             #include <boost/algorithm/string.hpp>
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [@programdir\modules\core\tools\clang_cl.lua:199]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [@programdir\modules\core\tools\clang_cl.lua:152]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]:
    [@programdir\core\tool\compiler.lua:278]: in function 'compile'
    [...amdir\core\sandbox\modules\import\core\tool\compiler.lua:82]: in function 'compile'
    [@programdir\modules\lib\detect\check_cxsnippets.lua:244]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [@programdir\modules\lib\detect\check_cxsnippets.lua:236]:
    [...al\.xmake\repositories\github\packages\b\boost\xmake.lua:408]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...dir\modules\private\action\require\impl\actions\test.lua:41]:
    [...\modules\private\action\require\impl\actions\install.lua:444]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:370]:
    [...modules\private\action\require\impl\install_packages.lua:491]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:241]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:275]: in function 'trycall'
    [@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
    [@programdir\modules\async\runjobs.lua:223]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:406]:

  => install boost 1.85.0 .. failed
error: @programdir\core\main.lua:329: @programdir\core\sandbox\modules\import\core\base\task.lua:65: @programdir\modules\async\runjobs.lua:325: ...\modules\private\action\require\impl\actions\install.lua:506: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [...\modules\private\action\require\impl\actions\install.lua:506]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:370]:
    [...modules\private\action\require\impl\install_packages.lua:491]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:241]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:973: in function 'os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:329: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:406: in function <@programdir\core\base\scheduler.lua:399>   
Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically.


Title: [boost] boost 1.85.0 uses the clang-cl tool chain to open asan, and during testing it shows that the header file "string.hpp" cannot be found.

star-hengxing commented 1 week ago

When I remove this configs, it work. Maybe we need to disable clang toolchain When debug on. Any idea? @SirLynix

https://github.com/xmake-io/xmake-repo/blob/68a51878cda8346a0bd54694bf5394b45ca90412/packages/b/boost/xmake.lua#L298-L299

SirLynix commented 1 week ago

I suppose it's just a matter of folders, better check where the header and libs are installed when using clang-cl

star-hengxing commented 1 week ago

Nothing

$ eza -a -R -T bin.v2
bin.v2
├── config.log
├── libs
│  ├── config
│  │  └── checks
│  │     ├── 53fbd48eb61920ae4a542b5dfe4e2925
│  │     └── architecture
│  │        ├── 9a84ceb2f523f2fc5565f4d00c523123
│  │        ├── 53fbd48eb61920ae4a542b5dfe4e2925
│  │        └── msvc-14.3
│  │           └── debug
│  │              └── threading-multi
│  │                 ├── 64.obj
│  │                 └── x86.obj
│  └── filesystem
│     └── config
│        ├── 0d7ef2339ba85b289af1d517e6dda136
│        └── 53fbd48eb61920ae4a542b5dfe4e2925
├── project-cache.jam
├── standalone
│  └── msvc
│     └── msvc-14.3
│        └── msvc-setup.bat
└── tools
   └── boost_install
      └── d41d8cd98f00b204e9800998ecf8427e
         └── BoostConfigVersion.cmake
$ eza -a -R -T installdir.failed
installdir.failed
├── lib
│  ├── cmake
│  │  ├── Boost-1.85.0
│  │  │  ├── BoostConfig.cmake
│  │  │  └── BoostConfigVersion.cmake
│  │  └── BoostDetectToolset-1.85.0.cmake
│  └── pkgconfig
│     └── boost.pc
├── logs
├── manifest.txt
└── references.txt