Skip to content

add support for non-standard name of stdc++ library #28495

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
Sep 19, 2015

Conversation

semarie
Copy link
Contributor

@semarie semarie commented Sep 18, 2015

it makes rustc compatible with gcc installation that are using
`--program-transform-name' configure flag (on OpenBSD for example).

  • detects at configure the name of stdc++ library on the system
  • use the detected name in llvm makefile (with enable-static-stdcpp),
    and pass it to mklldeps.py
  • generate mklldeps.rs using this detected name

note that CFG_STDCPP_NAME is about stdc++ name, not about libc++. If
using libc++, the default name will be `stdc++', but it won't be used
when linking.

r? @alexcrichton

I added this support globally instead of just for OpenBSD as it isn't specially related to OpenBSD (except OpenBSD use it for gcc-4.9). And as I would had to change llvm.mk', having just a default value inconfigure' for others platforms won't be very useful.

@semarie semarie force-pushed the stdcpp-name branch 2 times, most recently from fbaacfd to 2fb999c Compare September 18, 2015 15:22
@@ -1095,6 +1095,11 @@ envopt CPP
envopt CFLAGS
envopt CXXFLAGS

# stdc++ name in use
# used to manage non-standard name (on OpenBSD for example)
CFG_STDCPP_NAME=$(echo "stdc++" | sed "$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name='\([^']*\)'.*/\1/p")")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

program-transform-name is a sed regex (under OpenBSD for gcc-4.9 it is s,^,e,).

basically, it search for the configure flag program-transform-name in gcc -v, and use that with sed on the "stdc++" name. If the flag isn't found, the transformation applied is sed "" which means "no transformation".

it makes rustc compatible with gcc installation that are using
`--program-transform-name' configure flag (on OpenBSD for example).

- detects at configure the name of stdc++ library on the system

- use the detected name in llvm makefile (with enable-static-stdcpp),
  and pass it to mklldeps.py

- generate mklldeps.rs using this detected name

note that CFG_STDCPP_NAME is about stdc++ name, not about libc++. If
using libc++, the default name will be `stdc++', but it won't be used
when linking.
@alexcrichton
Copy link
Member

@bors: r+ 913fe6d

Thanks!

bors added a commit that referenced this pull request Sep 19, 2015
it makes rustc compatible with gcc installation that are using
`--program-transform-name' configure flag (on OpenBSD for example).

- detects at configure the name of stdc++ library on the system

- use the detected name in llvm makefile (with enable-static-stdcpp),
  and pass it to mklldeps.py

- generate mklldeps.rs using this detected name

note that CFG_STDCPP_NAME is about stdc++ name, not about libc++. If
using libc++, the default name will be `stdc++', but it won't be used
when linking.

r? @alexcrichton 

I added this support globally instead of just for OpenBSD as it isn't specially related to OpenBSD (except OpenBSD use it for gcc-4.9). And as I would had to change `llvm.mk', having just a default value in `configure' for others platforms won't be very useful.
@bors
Copy link
Collaborator

bors commented Sep 19, 2015

⌛ Testing commit 913fe6d with merge 655b2ef...

@bors bors merged commit 913fe6d into rust-lang:master Sep 19, 2015
@semarie semarie deleted the stdcpp-name branch September 19, 2015 16:26
bors added a commit that referenced this pull request Sep 20, 2015
By default, the linker in use under OpenBSD is the linker of base, which
don't include /usr/local/lib where libstdc++ of gcc-4.9 lives. We need
to add this directory to linker-path-search (using -L).

Search the path of libstdc++.a, which is a known name (libstdc++.so has
SO_VERSION) in the same directory.

r? @alexcrichton 

this commit needs #28495 to be commited first. It should be the last piece for building rustc under OpenBSD from scratch.
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