Skip to content

-fPIC #3

@ismaelxyz

Description

@ismaelxyz

Helo, When I use your library (my so is Deepin is Debian based,
brother of Ubuntu) I get this terrible message:

Compiling hello_rust_gem v0.1.0 (/home/user/Programming/hello_rust_gem)
error: linking with cc failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.1fgxsbz5b6p7gn0.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.1m4lcqaazjnp3xa7.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.1q53enijd4zo86x9.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.1r26wgj2mj13yl9p.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.1t8u81bbsaqao7du.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.1ulhuy9ea8udtqeb.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.2j1yd16msuhp97sy.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.2kzt863m5zdpzee4.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.2xqwfoxk3cnt2fxz.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.3ecbaubrxingb9up.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.3edlldrydatngh6c.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.3jti29ycsmebcmeq.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.3pvl6osko3f4opu4.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.43qp16sbz3kflg73.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.4de1sbx2b0ehwwvs.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.4jonjd5mjfkk3rfq.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.col5q73428vcpat.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.vrfgts5t9iy3oh5.rcgu.o" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.xi82hs0z3av8oy6.rcgu.o" "-o" "/home/user/Programming/hello_rust_gem/target/debug/deps/libhello_rust_gem.so" "-Wl,--version-script=/tmp/rustcAozNEW/list" "/home/user/Programming/hello_rust_gem/target/debug/deps/hello_rust_gem.1olnbriic9i8mo30.rcgu.o" "-Wl,--gc-sections" "-shared" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/user/Programming/hello_rust_gem/target/debug/deps" "-L" "/usr/local/lib" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lruby-static" "-Wl,--start-group" "-Wl,-Bstatic" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e12de7683a34c500.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-446a53c2e468675f.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-86fef9fb252a2d33.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-3bed9bfd30304751.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-0e38eeb474a7b386.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-a846ed547b824740.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-c9540f0a4fb9265d.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-7d2ca66c92c356eb.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-147e2c808f949493.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-bd2a4369506670e9.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-74bfdd0ce7d0ed48.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-6777f47f1c491841.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-b104f1790174f2be.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-db37898996f45c13.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-25b7435131fc4938.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-9d4b6f3c097e876e.rlib" "-Wl,--end-group" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-3f953ad652ab829a.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
= note: /usr/bin/ld: /usr/local/lib/libruby-static.a(error.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(eval.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(file.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(gc.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(hash.o): relocation R_X86_64_PC32 against symbol environ@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(io.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(iseq.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(load.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(marshal.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(mjit.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(mjit_compile.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(numeric.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(object.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(pack.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(parse.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(process.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(ractor.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(random.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(rational.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(re.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(ruby.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(sprintf.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(string.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(struct.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(symbol.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(thread.o): relocation R_X86_64_TPOFF32 against ruby_native_thread' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(time.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(transcode.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(transient_heap.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(variable.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(version.o): relocation R_X86_64_PC32 against symbol stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(vm.o): relocation R_X86_64_TPOFF32 against symbol ruby_current_ec' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(vm_backtrace.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(vm_dump.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(setproctitle.o): relocation R_X86_64_PC32 against symbol environ@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(addr2line.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(ast.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(bignum.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(compile.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(complex.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(debug.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(dir.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(encoding.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libruby-static.a(enum.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libruby-static.a(strftime.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: could not compile hello_rust_gem

To learn more, run the command again with --verbose.

A very long and terrible message, isn't it? But I didn't write
this issue to ask you for a solution, but rather to help you
correct the error.

I happen to have used Deebian, Ubuntu, Manjaro and Kali before using
Deepin. Which lets me tell you that this solution applies to all of
them equally. If you want your library to be usable by GNU/Linux based
operating systems just remove the line (no need to remove it just
don't run it) 14 from the build.rs file.

The problem is and says the message in using a static library to
create a dynamic one, GNU/Linux does not allow it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions