Skip to content

Linking with gcc failed every time I use foreign function interface #15274

@tprodanov

Description

@tprodanov

I cannot run any code containing foreign function interfaces, every time getting linking with gcc failed error.
For example I tried to compile example from the tutorial, but it fails with error:

error: linking with `gcc` failed: exit code: 1
note: gcc '-m32' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\l
ib' '-o' 'sn' 'sn.o' '-Wl,--whole-archive' '-lmorestack' '-Wl,--no-whole-archive
' '-Wl,--gc-sections' '-shared-libgcc' '-Wl,--enable-long-section-names' 'C:\Pro
gram Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\libnative-1fb5e2c0-0.11.0-
pre.rlib' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\libstd-59
beb4f7-0.11.0-pre.rlib' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32
\lib\libsync-305341d2-0.11.0-pre.rlib' 'C:\Program Files (x86)\Rust\bin\rustlib\
i686-pc-mingw32\lib\librustrt-d8560cb2-0.11.0-pre.rlib' 'C:\Program Files (x86)\
Rust\bin\rustlib\i686-pc-mingw32\lib\librand-2ea8f361-0.11.0-pre.rlib' 'C:\Progr
am Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\libcollections-d412c0c4-0.11
.0-pre.rlib' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\liball
oc-1085c790-0.11.0-pre.rlib' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mi
ngw32\lib\libcore-c5ed6fb4-0.11.0-pre.rlib' 'C:\Program Files (x86)\Rust\bin\rus
tlib\i686-pc-mingw32\lib\liblibc-4f9a876d-0.11.0-pre.rlib' '-L' 'C:\P\Rust\snapp
y\snappy-master\.rust' '-L' 'C:\P\Rust\snappy\snappy-master' '-Wl,-Bdynamic' '-l
snappy' '-Wl,-Bdynamic' '-lws2_32' '-lgcc_s' '-lcompiler-rt'
note: c:/mingw/481/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.1/../../../../i68
6-w64-mingw32/bin/ld.exe: cannot find -lsnappy
collect2.exe: error: ld returned 1 exit status

error: aborting due to previous error

Just now I reinstalled mingw and rust, following this instruction, but it didn't help.
I am running in Windows 7, Mingw 4.8.1, and rustc -v gives this:

rustc 0.11.0-pre-nightly (bb5695b95c288c442dbe528f7e1c1b08f79f033d 2014-06-29 23
:36:43 +0000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions