I am using Ubuntu 12.10 with a gcc version 4.6.3. I am trying to build my code and getting an error when using 'make' command
g++: error: unrecognized option ‘--as-needed’
My Makefile looks as follows:
LFLAGS = -Wl,-rpath,. -Wl,-rpath-link,../bin --as-needed
LDFLAGS = $(RPATH) $(RPATHLINK) -L$(USRLIB) --as-needed
Previously this code was successfully building on RedHat Linux. But now I need to run this code on Ubuntu.
If anyone knows about this. Please help
Regards Gaurav
@FatalError is right
And also better late than never answering this question.
you need to use -Wl,--as-needed
Seems like you had an extra space between the ld specifier "-Wl" and the option to be passed to ls "--as-needed". For the linker to get the extra option from g++ command, it should be "-Wl,--as-needed"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With