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

With set_toolchains("@cosmocc") : fatal error: string: No such file or directory #5263

Open
raphael10-collab opened this issue Jun 27, 2024 · 1 comment
Labels

Comments

@raphael10-collab
Copy link

Xmake Version

v2.9.3+20240626

Operating System Version and Architecture

Ubuntu 23.10

Describe Bug

With this xmake.lua file :

set_languages("c99", "c++20")
add_rules("mode.debug", "mode.release")

add_requires("cosmocc")

target("isdigits")
    set_kind("binary")
    add_files("/home/raphy/isdigits/src/*.cpp")
    --set_toolchains("@cosmocc")

It works fine :

raphy@raohy:~$ xmake f -o /home/raphy/isdigits/builddir

raphy@raohy:~$ xmake
[ 50%]: cache compiling.release isdigits/src/isdigits.cpp
[ 75%]: linking.release isdigits
[100%]: build ok, spent 0,482s

raphy@raohy:~$ ./isdigits/builddir/linux/x86_64/release/isdigits 
Only digits

Alpha Numerical

If I activate this line : set_toolchains("@cosmocc") :

set_languages("c99", "c++20")
add_rules("mode.debug", "mode.release")

add_requires("cosmocc")

target("isdigits")
    set_kind("binary")
    add_files("/home/raphy/isdigits/src/*.cpp")
    set_toolchains("@cosmocc")

I get that error :

raphy@raohy:~$ xmake
[ 50%]: cache compiling.release isdigits/src/isdigits.cpp
error: isdigits/src/isdigits.cpp:3:10: fatal error: string: No such file or directory
    3 | #include <string>
      |          ^~~~~~~~
compilation terminated.
  > in isdigits/src/isdigits.cpp

Output of xmake -v :

raphy@raohy:~$ xmake -v
[ 50%]: cache compiling.release isdigits/src/isdigits.cpp
/home/raphy/.xmake/packages/c/cosmocc/3.4.0/7e5513266cda47b5b64419a0b92403ee/bin/cosmocc -c -fvisibility=hidden -DNDEBUG -o isdigits/builddir/.objs/isdigits/linux/x86_64/release/isdigits/src/isdigits.cpp.o isdigits/src/isdigits.cpp
error: isdigits/src/isdigits.cpp:3:10: fatal error: string: No such file or directory
    3 | #include <string>
      |          ^~~~~~~~
compilation terminated.

Expected Behavior

No errors

Project Configuration

raphy@raohy:~$ nano xmake.lua : 

set_languages("c99", "c++20")
add_rules("mode.debug", "mode.release")

add_requires("cosmocc")

target("isdigits")
    set_kind("binary")
    add_files("/home/raphy/isdigits/src/*.cpp")
    set_toolchains("@cosmocc")

Minimal Reproducible Example Project :

https://github.com/raphael10-collab/isdigits.git

Additional Information and Error Logs

raphy@raohy:~$ xmake -vD
[ 50%]: cache compiling.release isdigits/src/isdigits.cpp
/home/raphy/.xmake/packages/c/cosmocc/3.4.0/7e5513266cda47b5b64419a0b92403ee/bin/cosmocc -c -fvisibility=hidden -DNDEBUG -o isdigits/builddir/.objs/isdigits/linux/x86_64/release/isdigits/src/isdigits.cpp.o isdigits/src/isdigits.cpp
error: ./.local/share/xmake/core/main.lua:329: ./.local/share/xmake/actions/build/main.lua:148: ./.local/share/xmake/modules/async/runjobs.lua:325: ...ocal/share/xmake/modules/private/action/build/object.lua:91: ./.local/share/xmake/modules/core/tools/gcc.lua:916: isdigits/src/isdigits.cpp:3:10: fatal error: string: No such file or directory
    3 | #include <string>
      |          ^~~~~~~~
compilation terminated.
stack traceback:
    [C]: in function 'error'
    [./.local/share/xmake/core/base/os.lua:973]:
    [./.local/share/xmake/modules/core/tools/gcc.lua:916]: in function 'catch'
    [./.local/share/xmake/core/sandbox/modules/try.lua:123]: in function 'try'
    [./.local/share/xmake/modules/core/tools/gcc.lua:857]:
    [C]: in function 'xpcall'
    [./.local/share/xmake/core/base/utils.lua:275]:
    [./.local/share/xmake/core/tool/compiler.lua:278]: in function 'compile'
    [...ocal/share/xmake/modules/private/action/build/object.lua:91]: in function 'script'
    [...ocal/share/xmake/modules/private/action/build/object.lua:122]: in function 'build_object'
    [...ocal/share/xmake/modules/private/action/build/object.lua:147]: in function 'jobfunc'
    [./.local/share/xmake/modules/async/runjobs.lua:241]:
    [C]: in function 'xpcall'
    [./.local/share/xmake/core/base/utils.lua:275]: in function 'trycall'
    [./.local/share/xmake/core/sandbox/modules/try.lua:117]: in function 'try'
    [./.local/share/xmake/modules/async/runjobs.lua:223]: in function 'cotask'
    [./.local/share/xmake/core/base/scheduler.lua:406]:

stack traceback:
    [C]: in function 'error'
    ./.local/share/xmake/core/base/os.lua:973: in function 'os.raiselevel'
    (...tail calls...)
    ./.local/share/xmake/core/main.lua:329: in upvalue 'cotask'
    ./.local/share/xmake/core/base/scheduler.lua:406: in function <./.local/share/xmake/core/base/scheduler.lua:399>
raphy@raohy:~$ 
@waruqi
Copy link
Member

waruqi commented Jun 27, 2024

duplicate #5262 (comment)

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

No branches or pull requests

2 participants