Linking broken on Linux x86-64?
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- cmake, rust
- 领域
- build-system
调研方向
从 CMakeLists.txt 和 hello 子目录开始,然后检查生成的 hello/CMakeFiles/hello.dir/link.txt,并使用 make VERBOSE=1 重现。追踪 Rust 编译规则为何会生成对象文件,而链接规则却只回显变量;完成的标准是构建 hello 时会生成已链接的可执行文件,而不只是 hello.rs.o。
由索引模型根据 Issue 内容生成。
描述
The included example hello binary seems to be disabled. After enabling it...:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52419eb..d033346 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
enable_language(Rust)
include(CMakeCargo)
+add_subdirectory(hello)
add_subdirectory(hello_world)
add_subdirectory(crates)
an object file is generated but no linked executable:
$ find build/hello
build/hello
build/hello/Makefile
build/hello/CMakeFiles
build/hello/CMakeFiles/hello.dir
build/hello/CMakeFiles/hello.dir/link.txt
build/hello/CMakeFiles/hello.dir/flags.make
build/hello/CMakeFiles/hello.dir/hello.rs.o
build/hello/CMakeFiles/hello.dir/depend.internal
build/hello/CMakeFiles/hello.dir/cmake_clean.cmake
build/hello/CMakeFiles/hello.dir/build.make
build/hello/CMakeFiles/hello.dir/DependInfo.cmake
build/hello/CMakeFiles/hello.dir/progress.make
build/hello/CMakeFiles/hello.dir/depend.make
build/hello/CMakeFiles/CMakeDirectoryInformation.cmake
build/hello/CMakeFiles/progress.marks
build/hello/cmake_install.cmake
It looks like the link step is just echoing some commands. Am I missing something?
CMakeRust/build/hello$ make VERBOSE=1
cd /home/jnewsome/src/CMakeRust/build && /usr/bin/cmake -H/home/jnewsome/src/CMakeRust -B/home/jnewsome/src/CMakeRust/build --check-build-system CMakeFiles/Makefile.cmake 0
cd /home/jnewsome/src/CMakeRust/build && /usr/bin/cmake -E cmake_progress_start /home/jnewsome/src/CMakeRust/build/CMakeFiles /home/jnewsome/src/CMakeRust/build/hello/CMakeFiles/progress.marks
cd /home/jnewsome/src/CMakeRust/build && make -f CMakeFiles/Makefile2 hello/all
make[1]: Entering directory '/home/jnewsome/src/CMakeRust/build'
make -f hello/CMakeFiles/hello.dir/build.make hello/CMakeFiles/hello.dir/depend
make[2]: Entering directory '/home/jnewsome/src/CMakeRust/build'
cd /home/jnewsome/src/CMakeRust/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jnewsome/src/CMakeRust /home/jnewsome/src/CMakeRust/hello /home/jnewsome/src/CMakeRust/build /home/jnewsome/src/CMakeRust/build/hello /home/jnewsome/src/CMakeRust/build/hello/CMakeFiles/hello.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/jnewsome/src/CMakeRust/build'
make -f hello/CMakeFiles/hello.dir/build.make hello/CMakeFiles/hello.dir/build
make[2]: Entering directory '/home/jnewsome/src/CMakeRust/build'
[ 50%] Building Rust object hello/CMakeFiles/hello.dir/hello.rs.o
cd /home/jnewsome/src/CMakeRust/build/hello && echo "CMAKE_Rust_COMPILE_OBJECT"
CMAKE_Rust_COMPILE_OBJECT
cd /home/jnewsome/src/CMakeRust/build/hello && echo "TARGET: hello TARGET_BASE: hello OBJECT: CMakeFiles/hello.dir/hello.rs.o OBJECTS: OBJECTS OBJECT_DIR: CMakeFiles/hello.dir SOURCE: /home/jnewsome/src/CMakeRust/hello/hello.rs SOURCES: SOURCES LINK_LIBRARIES: LINK_LIBRARIES FLAGS: LINK_FLAGS: LINK_FLAGS "
TARGET: hello TARGET_BASE: hello OBJECT: CMakeFiles/hello.dir/hello.rs.o OBJECTS: OBJECTS OBJECT_DIR: CMakeFiles/hello.dir SOURCE: /home/jnewsome/src/CMakeRust/hello/hello.rs SOURCES: SOURCES LINK_LIBRARIES: LINK_LIBRARIES FLAGS: LINK_FLAGS: LINK_FLAGS
cd /home/jnewsome/src/CMakeRust/build/hello && /home/jnewsome/.cargo/bin/rustc --emit obj /home/jnewsome/src/CMakeRust/hello/hello.rs -o CMakeFiles/hello.dir/hello.rs.o
[100%] Linking Rust executable hello
cd /home/jnewsome/src/CMakeRust/build/hello && /usr/bin/cmake -E cmake_link_script CMakeFiles/hello.dir/link.txt --verbose=1
echo "CMAKE_Rust_LINK_EXECUTABLE"
CMAKE_Rust_LINK_EXECUTABLE
echo "TARGET: hello TARGET_BASE: hello OBJECT: OBJECT OBJECTS: CMakeFiles/hello.dir/hello.rs.o OBJECT_DIR: CMakeFiles/hello.dir SOURCE: SOURCE SOURCES: SOURCES LINK_LIBRARIES: FLAGS: LINK_FLAGS: "
TARGET: hello TARGET_BASE: hello OBJECT: OBJECT OBJECTS: CMakeFiles/hello.dir/hello.rs.o OBJECT_DIR: CMakeFiles/hello.dir SOURCE: SOURCE SOURCES: SOURCES LINK_LIBRARIES: FLAGS: LINK_FLAGS:
make[2]: Leaving directory '/home/jnewsome/src/CMakeRust/build'
[100%] Built target hello
make[1]: Leaving directory '/home/jnewsome/src/CMakeRust/build'
/usr/bin/cmake -E cmake_progress_start /home/jnewsome/src/CMakeRust/build/CMakeFiles 0
- 主要语言
- CMake
- 星标
- 175
- 派生
- 30
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Devolutions/CMakeRust 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
Devolutions/CMakeRust#14 ·
-
难度 4/5 3-5 天 新手友好度 42/100
Devolutions/CMakeRust#12 ·
-
难度 4/5 3-5 天 新手友好度 30/100
Devolutions/CMakeRust#11 · 3 条评论 ·
查看 Devolutions/CMakeRust 的全部 Issue
相似的 Issue
-
Name consistency 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eellak/triplestore#65 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
area-Bzlmod team-ExternalDeps type: bug untriaged
难度 2/5 1-3 小时 新手友好度 65/100
bazelbuild/bazel#31291 · 2 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
bradcypert/plum#53 ·