Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Linking broken on Linux x86-64?

Đang mở
#13 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cmake, rust
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu với CMakeLists.txt và thư mục con hello, sau đó kiểm tra hello/CMakeFiles/hello.dir/link.txt đã được tạo và tái hiện bằng make VERBOSE=1. Truy vết lý do quy tắc biên dịch Rust tạo ra một object, nhưng quy tắc link chỉ echo các biến; hoàn thành khi việc build hello tạo ra một executable đã được link thay vì chỉ hello.rs.o.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
CMake
Star
175
Fork
30
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Devolutions/CMakeRust

Tất cả issue của Devolutions/CMakeRust

Issue tương tự

Thêm issue về Build System

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.