Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

Static compiling #2

Open
adubovikov opened this issue Feb 8, 2020 · 1 comment
Open

Static compiling #2

adubovikov opened this issue Feb 8, 2020 · 1 comment

Comments

@adubovikov
Copy link

adubovikov commented Feb 8, 2020

Hello here,

can you help me, if there is anyway to compile all static ? I just made a test application but even with musl it compiles dynamic:

ldd target/x86_64-unknown-linux-musl/debug/hello_world
linux-vdso.so.1 (0x00007ffc2b15d000)
libpcap.so.0.8 => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 (0x00007f3596cb9000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f359691a000)
/lib/ld64.so.1 => /lib64/ld-linux-x86-64.so.2 (0x00007f3596efb000)

How to tell the rustcap or what should I set in the Cargo.toml to compile it static ?

[package]
name = "hello_world"
version = "0.0.1"
authors = [ "Your name <you@example.com>" ]

[build]
target = "x86_64-unknown-linux-musl"

[dependencies.rustcap]
version = "0.1.2"
feature = "static-libpcap"

@adubovikov
Copy link
Author

s/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" -L/usr/lib/x86_64-linux-musl/libc.a -L/usr/lib/x86_64-linux-musl/libdl.a
/usr/lib/x86_64-linux-gnu/libpcap.a(scanner.o): In function `yy_fatal_error.isra.0':
(.text+0x1d): undefined reference to `__fprintf_chk'
/usr/lib/x86_64-linux-gnu/libpcap.a(pcap-linux.o): In function `init_tpacket':
(.text+0x4bc): undefined reference to `__snprintf_chk'
/usr/lib/x86_64-linux-gnu/libpcap.a(pcap-linux.o): In function `init_tpacket':
(.text+0x515): undefined reference to `__snprintf_chk'
/usr/lib/x86_64-linux-gnu/libpcap.a(pcap-linux.o): In function `pcap_read_linux':
(.text+0x8f4): undefined reference to `__snprintf_chk'
/usr/lib/x86_64-linux-gnu/libpcap.a(pcap-linux.o): In function `pcap_read_linux':
(.text+0xb1f): undefined reference to `__snprintf_chk'
/usr/lib/x86_64-linux-gnu/libpcap.a(pcap-linux.o): In function `pcap_handle_packet_mmap':
(.text+0xe0b): undefined reference to `__snprintf_chk'
/usr/lib/x86_64-linux-gnu/libpcap.a(pcap-linux.o):(.text+0x127f): more undefined references to `__snprintf_chk' follow
/usr/lib/x86_64-linux-gnu/libpcap.a(pcap-linux.o): In function `pcap_setfilter_linux_common':
(.text+0x1368): undefined reference to `__fprintf_chk'

so, in verbose I see, it tries to compile static, but some issues with musl ?
build.rs:

fn main() {
    println!("cargo:rustc-link-lib=static=pcap");
``



Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant