Skip to content
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

Makefile.base $(BIN) target assumes $(CC) as linker #27

Open
eugpermar opened this issue May 7, 2018 · 2 comments
Open

Makefile.base $(BIN) target assumes $(CC) as linker #27

eugpermar opened this issue May 7, 2018 · 2 comments

Comments

@eugpermar
Copy link
Contributor

Only *.cpp object files are building using $(CXX). Should Makefile.base add a $(BIN_CPP) target? Maybe do the final phase with $(LD)?

@edenhill
Copy link
Owner

Hey Eugenio, been a while!

Is the problem that it is using the C compiler to link C++ code or that it is using a compiler rather than a linker to link the code?
I believe $(LD) would be the proper solution, but there are situations where $(CC) (or $(CXX)) and $(LD) are not from the same build toolchain, in which case it is safer to use the compiler to link, but I guess we could check for what linker to use in configure: LD_C and LD_CXX

@eugpermar
Copy link
Contributor Author

Hi, Magnus! Don't worry, I keep using all your projects, but they need less and less feedback every time!

My main problem is to use LTO over g++. I need to use g++ to link (or configure properly gold, but it's easier for me to use g++ directly). It's not a big deal for me since I've overridden project's Makefile.base and I just have to be careful when updating mklove, but I think a proper option at mklove installation or an automatic procedure in Makefile.base like some of the purposed would be OK. (I think that) it's impossible to build c++ "$(BIN)" project out of the box with mklove.

I believe $(LD) would be the proper solution, but there are situations where $(CC) (or $(CXX)) and $(LD) are not from the same build toolchain, in which case it is safer to use the compiler to link, but I guess we could check for what linker to use in configure: LD_C and LD_CXX

In that case, my project could use LD=$(CXX), and it's the easier solution to apply IMHO. mklove could even use LD=$(CC) by default, so modules update would be painless in the case that the project needs that requirement and the ones that do not need it will keep working, but it's just an idea, the call is yours :)

Regards!

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

No branches or pull requests

2 participants