Skip to content

undefined reference to 'log2f' on android #31119

Closed
@not-fl3

Description

@not-fl3

I tried this code:

fn main() {
    let _ = 10.0f32.log2();
}

Everithing was fine without cross compilation, but with

rustc aaa.rs --target=arm-linux-androideabi -C linker="arm-linux-androideabi-gcc-4.8"

i got followed result:

error: linking with arm-linux-androideabi-gcc-4.8 failed: exit code: 1
note: "arm-linux-androideabi-gcc-4.8" "-Wl,--as-needed" "-Wl,--allow-multiple-definition" "-L" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib" "aaa.0.o" "-o" "aaa" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/libstd-db5a760f.rlib" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/libcollections-db5a760f.rlib" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/librustc_unicode-db5a760f.rlib" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/librand-db5a760f.rlib" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/liballoc-db5a760f.rlib" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/liballoc_jemalloc-db5a760f.rlib" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/liblibc-db5a760f.rlib" "/usr/local/lib64/rustlib/arm-linux-androideabi/lib/libcore-db5a760f.rlib" "-l" "dl" "-l" "log" "-l" "gcc" "-l" "gcc" "-l" "c" "-l" "m" "-pie" "-l" "compiler-rt"
note: aaa.0.o:aaa.0.rs:function f32::f32::log2::h94a06ad56bda381bXwa: error: undefined reference to 'log2f'
collect2: error: ld returned 1 exit status

error: aborting due to previous error

While with log(), not log2() everithing works fine.

Meta

rustc --version --verbose:

rustc 1.8.0-dev (cd1b845 2016-01-22)
binary: rustc
commit-hash: cd1b845
commit-date: 2016-01-22
host: x86_64-unknown-linux-gnu
release: 1.8.0-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-androidOperating system: Android

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions