G ++: error: unrecognized option '-as-needed

I am using Ubuntu 12.10 with gcc version 4.6.3. I am trying to create code and get an error when using the "make" command

g++: error: unrecognized option '--as-needed' 

My makefile looks like this:

 LFLAGS = -Wl,-rpath,. -Wl,-rpath-link,../bin --as-needed LDFLAGS = $(RPATH) $(RPATHLINK) -L$(USRLIB) --as-needed 

Previously, this code was successfully built on RedHat Linux. But now I need to run this code on Ubuntu.

If anyone knows about this. Please, help

Relations Gaurav

+5
source share
2 answers

@FatalError is right

And even better late than never answering this question.

you need to use -Wl,--as-needed

+2
source

It looks like you have an extra space between the ld "-Wl" qualifier and the option that you need to pass ls "--as-required". For the linker to get an additional option from the g ++ command, it must be "-Wl, - as needed"

0
source

Source: https://habr.com/ru/post/1502916/


All Articles