Bug 189357 - lang/rust: rustc chokes on linking a trivial program (__morestack symbol)
Summary: lang/rust: rustc chokes on linking a trivial program (__morestack symbol)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: John Marino
URL:
Keywords:
Depends on: 191927
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-04 17:50 UTC by Bertrand Augereau
Modified: 2014-07-28 23:07 UTC (History)
3 users (show)

See Also:


Attachments
rust-0.10_1.patch (719 bytes, patch)
2014-05-06 16:53 UTC, Jyun-Yan You
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Augereau 2014-05-04 17:50:01 UTC
Hello,
I'm trying to compile a very simple test.rs file from the tutorial
fn main() {
   println!("hello?");
}
with rustc test.rs
and I get these errors:
error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64' '-L/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib' '-o' 'test' 'test.o' '-lmorestack' '-nodefaultlibs' '/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libnative-72349f30-0.10.rlib' '/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libstd-8b97b62e-0.10.rlib' '-L/usr/home/tramb/devel/rust/.rust' '-L/usr/home/tramb/devel/rust' '-lexecinfo' '-lpthread' '-lm' '-lgcc_s' '-L/usr/local/lib' '-L/usr/local/lib/gcc46' '-L/usr/local/lib/gcc44' '-Wl,-rpath,/usr/local/lib/gcc46' '-Wl,-rpath,/usr/local/lib/gcc44' '-Wl,-z,origin' '-Wl,-rpath,$ORIGIN/../../../../local/lib/rustlib/x86_64-unknown-freebsd/lib' '-Wl,-rpath,/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib' '-lcompiler-rt'
note: test.o: In function `main::hc710cccadd7cba59eaa::v0.0':
test.rs:(.text+0x20): undefined reference to `__morestack'
test.o: In function `main':
test.rs:(.text+0xb0): undefined reference to `__morestack'
test.o: In function `fmt::Arguments$LT$$x27a$GT$::new::h1c4e875dc8287f179aa::v0.0':
test.rs:(.text+0x110): undefined reference to `__morestack'
test.o: In function `cast::transmute::he083e941a8234f90Bba::v0.0':
test.rs:(.text+0x1a0): undefined reference to `__morestack'
/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libnative-72349f30-0.10.rlib(native.o): In function `io::addrinfo::GetAddrInfoRequest::run::hce03eca6bb2325f70aa::v0.10':
native.rs:(.text+0x28): undefined reference to `__morestack'
/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libnative-72349f30-0.10.rlib(native.o):native.rs:(.text+0x960): more undefined references to `__morestack' follow
cc: error: linker command failed with exit code 1 (use -v to see invocation)

This is with a up-to-date lang/rust (0.10 on 05 April 2014) from pkg.
I didn't try to build the port myself.
No mention in ports/UDATING of course :)
And I don't have any funny environment (I think).

Cheers,
Bertrand
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-05-04 17:50:06 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2014-05-04 17:50:06 UTC
Maintainer of lang/rust,

Please note that PR ports/189357 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/189357

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Bertrand Augereau 2014-05-07 09:30:59 UTC
I built the port with the patch and it works perfectly.
Thanks a lot!
Comment 4 bp 2014-06-12 14:34:48 UTC
I got the exact same thing on a FreeBSD 9.2-RELEASE-p6 amd64 box.  The patch fixed the problem.
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-17 18:44:45 UTC
I tried the patch against rust 0.11.0 on 9.3-REL amd64, did not build:

llvm[2]: Compiling APFloat.cpp for Release+Asserts build
In file included from /usr/home/pi/myp/lang/rust/work/rust-0.11.0/src/llvm/lib/Support/APFloat.cpp:15:
In file included from /usr/home/pi/myp/lang/rust/work/rust-0.11.0/src/llvm/include/llvm/ADT/APFloat.h:20:
In file included from /usr/home/pi/myp/lang/rust/work/rust-0.11.0/src/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/home/pi/myp/lang/rust/work/rust-0.11.0/src/llvm/include/llvm/ADT/ArrayRef.h:14:
In file included from /usr/home/pi/myp/lang/rust/work/rust-0.11.0/src/llvm/include/llvm/ADT/SmallVector.h:17:
/usr/home/pi/myp/lang/rust/work/rust-0.11.0/src/llvm/include/llvm/ADT/iterator_range.h:22:10: fatal error: 
      'utility' file not found
#include <utility>
         ^
1 error generated.
Comment 6 John Marino freebsd_committer freebsd_triage 2014-07-28 20:25:07 UTC
(In reply to Kurt Jaeger from comment #5)
> I tried the patch against rust 0.11.0 on 9.3-REL amd64, did not build:

How did you even get it to build?  it is maked for FreeBSD 9 and lower.
Comment 7 John Marino freebsd_committer freebsd_triage 2014-07-28 23:07:27 UTC
Author: marino
Date: Mon Jul 28 22:58:33 2014
New Revision: 363270
URL: http://svnweb.freebsd.org/changeset/ports/363270
QAT: https://qat.redports.org/buildarchive/r363270/

Log:
  lang/rust: Fix link issue and build failure
  
  [1] Linking fails with missing reference to __morestack symbol
  [2] gpy fails with error about missing sem implementation
  
  PR:		189357 [1]
  PR:		191927 [2]
  Submitted by:	bertrand.augereau (gmail) [1]
  Submitted by:	maintainer: mitsuruike (gmail) [2]

Added:
  head/lang/rust/files/patch-src__libuv__gyp_uv.py   (contents, props changed)
Modified:
  head/lang/rust/Makefile