Skip to content

openbsd: pass stdc++ library path after LVVM library path #29794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2015

Conversation

semarie
Copy link
Contributor

@semarie semarie commented Nov 12, 2015

under openbsd, the library path of libstdc++ need to be explicit (due
to the fact the default linker cc is gcc-4.2, and not gcc-4.9).

but when a recent LLVM is installed, rustc compilation pikes the bad
LLVM version (which live in /usr/local/lib, which is same directory of
libestdc++.so for gcc-4.9).

this patch move the libstdc++ path from RUST_FLAGS_ to special
variable, and use it after LLVM_LIBDIR_RUSTFLAGS_ in
arguments.

r? @alexcrichton

under openbsd, the library path of libstdc++ need to be explicit (due
to the fact the default linker `cc` is gcc-4.2, and not gcc-4.9).

but when a recent LLVM is installed, rustc compilation pikes the bad
LLVM version (which live in /usr/local/lib, which is same directory of
libestdc++.so for gcc-4.9).

this patch move the libstdc++ path from RUST_FLAGS_<target> to special
variable, and use it *after* LLVM_LIBDIR_RUSTFLAGS_<target> in
arguments.
@@ -128,7 +129,9 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
| $$(TBIN$(1)_T_$(2)_H_$(3))/
@$$(call E, rustc: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --cfg $(4)
$$(STAGE$(1)_T_$(2)_H_$(3)) \
$$(STDCPP_LIBDIR_RUSTFLAGS_$(2)) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this necessary to compile correctly? No other extra flags are passed in here so I'm a little wary this should be needed for correctness.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. In this target, we do the final linking of a tool binary. So the path for libstdc++ has to be know.

Before, the value came from RUST_FLAGS_<target>. Now we need to explicitly add it.

The error without it is:

note: /usr/bin/ld: cannot find -lestdc++
collect2: ld returned 1 exit status

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm right, I guess maybe this'll all be nice to look at one day...

@alexcrichton
Copy link
Member

@bors: r+ 646b0b6

bors added a commit that referenced this pull request Nov 17, 2015
under openbsd, the library path of libstdc++ need to be explicit (due
to the fact the default linker `cc` is gcc-4.2, and not gcc-4.9).

but when a recent LLVM is installed, rustc compilation pikes the bad
LLVM version (which live in /usr/local/lib, which is same directory of
libestdc++.so for gcc-4.9).

this patch move the libstdc++ path from RUST_FLAGS_<target> to special
variable, and use it *after* LLVM_LIBDIR_RUSTFLAGS_<target> in
arguments.

r? @alexcrichton
@bors
Copy link
Collaborator

bors commented Nov 17, 2015

⌛ Testing commit 646b0b6 with merge 4bd302e...

@bors bors merged commit 646b0b6 into rust-lang:master Nov 17, 2015
@semarie semarie deleted the openbsd-stdcpp-path branch November 17, 2015 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants