I am trying to install a project which was developed on Ubuntu, but now I am trying to make it run on Max OSX - version: 10.10.5 (Yosemite).
My current ld version that comes by default with OSX:
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 contents:
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 here is
LDFLAGS = -shared -L. -Wl,--no-as-needed $(CLIBS)
The OSX linker doesn't support this option and I checked the man page to see what possible replacements I could use instead of --no-as-needed, but couldn't find any.
Removing that option also doesn't help - throws other errors.
I tried installing the GNU Command line tools on OSX from an online resource here. But I believe the GNU linker is not included in that.
Additionally I have also installed gcc47, doesn't help either.
Can someone please suggest some workarounds to this option and confirm that the GNU linker cannot be installed on OSX?
Thanks!