Skip to content

Linking broken on Linux x86-64? #13

@sporksmith

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions