Skip to content

[BUG] The dynamic link library generated by libhook cannot be loaded correctly #20

@loongs-zhang

Description

@loongs-zhang

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

run failed

Expected Behavior

run successfully

Steps To Reproduce

[dependencies]
libc = "0.2.119"
base-coroutine = "0.0.1"
open-coroutine = "0.0.1"
use base_coroutine::OpenYielder;
use open_coroutine::co;
use std::os::raw::c_void;

fn main() {
    extern "C" fn f1(
        _yielder: &OpenYielder<Option<&'static mut c_void>>,
        _input: Option<&'static mut c_void>,
    ) -> Option<&'static mut c_void> {
        println!("hello1 from coroutine");
        None
    }
    co(f1, None, 2048);
    extern "C" fn f2(
        _yielder: &OpenYielder<Option<&'static mut c_void>>,
        _input: Option<&'static mut c_void>,
    ) -> Option<&'static mut c_void> {
        println!("hello2 from coroutine");
        None
    }
    co(f2, None, 2048);
    unsafe {
        libc::sleep(1);
    }
}

Environment

open-coroutine version(s):

Debug logs

error: linking with cc failed: exit status: 1
|
= note: "cc" "-arch" "arm64" "/var/folders/yv/k8yn4gt95zbgqvmv4pkx0zfw0000gn/T/rustcxSewLr/symbols.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.2m6f053bv5v2znn9.rcgu.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.3pk1jj45xptudnpg.rcgu.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.3swcxoaurcdh28pl.rcgu.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.4gwpj4tr63m7ppnt.rcgu.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.4z1itdfg8o4xapbj.rcgu.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.5ef6y44j888sl2j3.rcgu.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.wnngfpdgapu04xv.rcgu.o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d.2iiyqsgczzjoa0dq.rcgu.o" "-L" "/Users/admin/Downloads/study/rust-study/target/debug/deps" "-L" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libopen_coroutine-a8f3e2d950a92730.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libbase_coroutine-12832087162b6da7.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libonce_cell-0f1302befc59200f.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libtimer_utils-8138146dbd419fc4.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libobject_collection-9509479e2f448b54.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libcorosensei-95c540b47f02f612.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/liblibc-3f493df9e27c93d1.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libscopeguard-d7dce28efe117e2a.rlib" "/Users/admin/Downloads/study/rust-study/target/debug/deps/libcfg_if-a08cfa42db5d7bec.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-f6811f31090e0239.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-585aa2ea4819ce90.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-1b4ea1dc4a3823f8.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-f653b27121920f5c.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-ef1f6d7964edf865.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-8d0a95997d48da47.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-68d9470ea5ba2fa3.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-d4ed7f63db7e9953.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-d2ad324cf0492211.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libminiz_oxide-a00c8eba7ff52d83.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libadler-92e25d254b309fb5.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-9cf27ed549592a86.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-ebee0ebd9a510319.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-718033b8fe200c22.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-5ec3532fb120beec.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-80ef5ce8d4cd7e19.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-b5600cb14c277fae.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-760870d297bc6b81.rlib" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-931e7dc6a4f959e6.rlib" "-lhook" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/admin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/admin/Downloads/study/rust-study/target/debug/deps/43test_hook-1094d3b3ce98550d" "-Wl,-dead_strip" "-nodefaultlibs"
= note: ld: library not found for -lhook
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions