Ld: unknown parameter: --no-as-needed. Any workaround?

I am trying to install a project that was developed on Ubuntu, but now I am trying to run it on Max OSX - version: 10.10.5 (Yosemite).

My current version of ld, which comes with OSX by default:

ld -v @(#)PROGRAM:ld PROJECT:ld64-253.3 configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS) LTO support using: LLVM version 3.7.0 

Makefile file content:

 PYLIB = -I/usr/include/python2.7 CLIBS = CC = gcc CFLAGS = $(PYLIB) $(CLIBS) -fPIC -O3 -std=c++11 LD = g++ LDFLAGS = -shared -L. -Wl,--no-as-needed $(CLIBS) SWIG = swig SWIGFLAGS = -c++ -python -extranative MODULE = iPlaneImporter CMODULE = $(MODULE).cpp CMODULE_H = $(MODULE).h CMODULE_OBJ = $(MODULE).o INTERFACE = $(MODULE).i CWRAPPER = $(MODULE)_wrap.cpp CWRAPPER_OBJ = $(MODULE)_wrap.o PYMODULE = $(MODULE).py SOLIB = _$(MODULE).so SRCS = $(CMODULE) $(CWRAPPER) OBJS = $(CMODULE_OBJ) $(CWRAPPER_OBJ) all: $(SOLIB) $(PYMODULE) .PHONY: clean clean: rm -f $(CWRAPPER) $(PYMODULE) $(OBJS) $(SOLIB) *.pyc $(CWRAPPER) $(PYMODULE): $(INTERFACE) $(CMODULE_H) $(SWIG) $(SWIGFLAGS) -o $(CWRAPPER) $(INTERFACE) $(OBJS): $(SRCS) $(CC) -c $(SRCS) $(CFLAGS) $(SOLIB): $(OBJS) $(LD) $(LDFLAGS) $(OBJS) -o $(SOLIB) 

Error:

 ld: unknown option: --no-as-needed collect2: error: ld returned 1 exit status make[1]: *** [_iPlaneImporter.so] Error 1 

I believe the problem is here

LDFLAGS = -shared -L. -Wl, - no $ (CLIBS) required

The OSX component does not support this option, and I checked the manual page to find out what possible replacements I could use instead of --no-as-needed, but could not find.

Removing this option also does not help - it causes other errors.

I tried installing the GNU command line tools on OSX from an online resource here . But I believe that the GNU linker is not included in this.

In addition, I also installed gcc47, also does not help.

Can someone suggest some workarounds for this option and confirm that the GNU linker cannot be installed on OSX?

Thanks!

+5
source share

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


All Articles