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

fix parse json_output #38

Merged
merged 3 commits into from
Dec 26, 2024
Merged

fix parse json_output #38

merged 3 commits into from
Dec 26, 2024

Conversation

iGwkang
Copy link
Contributor

@iGwkang iGwkang commented Dec 25, 2024

xrepo.cmake Outdated
@@ -355,7 +355,7 @@ function(xrepo_package package)
endif()

message(STATUS "xrepo: ${_xrepo_cmdargs_${package_name}}")
execute_process(COMMAND ${CMAKE_COMMAND} -E env --unset=CC --unset=CXX --unset=LD ${XREPO_CMD} install --yes ${verbose} ${XREPO_BUILD_PARALLEL_JOBS_STR} ${_xrepo_cmdargs}
execute_process(COMMAND ${XREPO_CMD} install --yes ${verbose} ${XREPO_BUILD_PARALLEL_JOBS_STR} ${_xrepo_cmdargs}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? $CC $LD will affect xrepo install

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果去掉CC/CXX,会使用系统默认的编译器,在交叉编译环境会有问题。
在我的cmake_toolchain中指定了编译器

set (CROSS_COMPILE /opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-)
set (CMAKE_C_COMPILER  ${CROSS_COMPILE}gcc)
set (CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++)

如果带上 --unset=CC --unset=CXX,在xrepo install package的时候,不会使用我指定的编译器,它会使用系统中的/usr/bin/gcc
去掉 --unset=CC --unset=CXX,不管是native编译还是cross编译,都不会有问题。
--unset=CC --unset=CXX 只有在安装xmake的时候才应该使用,因为xmake是在本地运行的

Copy link
Member

@waruqi waruqi Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果去掉CC/CXX,会使用系统默认的编译器,在交叉编译环境会有问题。
在我的cmake_toolchain中指定了编译器

目前不考虑对 cmake 中 cmake_toolchain 进行支持,这种分散指定 cc ld 在 xrepo install 支持是不可靠的,一些特定工具链的 flags 也没法指定 和安全切换。

要切工具链,按 xrepo-cmake 官方的方式整个切工具链。。

https://github.com/xmake-io/xrepo-cmake?tab=readme-ov-file#switching-compiler-and-cross-compilation

定义自定义工具链,在 XREPO_XMAKEFILE 里面,走 xmake 的 toolchain() 配置

--unset=CC --unset=CXX

这个是必须要,不要删,会 break 很多东西

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外,工具链问题,跟当前 json parse 问题 也是独立的,不应该混在一起提交

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK,工具链的问题,我还是用xmake的方式解决吧,我撤回这个提交

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waruqi 我看到这个pr #18 如果设置了CMAKE_C_COMPILER / CMAKE_CXX_COMPILER ,应该会自动设置toolchain,为什么它还是会使用系统的gcc

Copy link
Contributor Author

@iGwkang iGwkang Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是没匹配上,这个pr 匹配的是gcc开头的工具,我这个是aarch 开头的。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

匹配问题 回头可以单独改进。

@waruqi waruqi merged commit 0ada08b into xmake-io:main Dec 26, 2024
12 checks passed
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.

无法使用conan包
2 participants