September 2nd, 2012, 01:31 PM
-
Compiling iniParser C-library on Mac OSX Mountain Lion.
Hi,
My goal is to compile and edit the source of the ownCloud client source on my Mac OS X Mountain Lion.
The problem I am facing right now is that it does not seem that I am able to compile and install the iniParser library on my OS.
The problem I was first facing was that the in the Makefile it was stated that to compile this library ld should use the flag "-Bsymbolic" and the flag "-soname=".
I've been searching around for any hints on this. I've searched for Mac OS X patches for this Makefile and I've been searching for equivalents for the "-Bsymbolic" and the "-soname" in Mac OS X's ld command.
I found out that I could use the "-dylib_install_name" flag as an equivalent to "-soname". I can't seem to find anything on the "-Bsymbolic" flag though.
I've tried to just remove the "-Bsymbolic" flag and change "-soname" to "-dylib_install_name" in the Makefile, but it just gives me the error:
Code:
$ make
compiling src/iniparser.c ...
compiling src/dictionary.c ...
a - src/iniparser.o
a - src/dictionary.o
i686-apple-darwin11-llvm-gcc-4.2: libiniparser.so.0: No such file or directory
make: *** [libiniparser.so] Error 1
My Makefile looks like this:
Code:
#
# iniparser Makefile
#
# Compiler settings
CC = gcc
CFLAGS = -O2 -fPIC -Wall -ansi -pedantic
# Ar settings to build the library
AR = ar
ARFLAGS = rcv
SHLD = ${CC} ${CFLAGS}
LDSHFLAGS = -shared -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
LDFLAGS = -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
# Set RANLIB to ranlib on systems that require it (Sun OS < 4, Mac OSX)
RANLIB = ranlib
#RANLIB = true
RM = rm -f
# Implicit rules
SUFFIXES = .o .c .h .a .so .sl
COMPILE.c=$(CC) $(CFLAGS) -c
.c.o:
@(echo "compiling $< ...")
@($(COMPILE.c) -o $@ $<)
SRCS = src/iniparser.c \
src/dictionary.c
OBJS = $(SRCS:.c=.o)
default: libiniparser.a libiniparser.so
libiniparser.a: $(OBJS)
@($(AR) $(ARFLAGS) libiniparser.a $(OBJS))
@($(RANLIB) libiniparser.a)
libiniparser.so: $(OBJS)
@$(SHLD) $(LDSHFLAGS) -o $@.0 $(OBJS) $(LDFLAGS) \
-Wl,-dylib_install_name `basename $@`.0
clean:
$(RM) $(OBJS)
veryclean:
$(RM) $(OBJS) libiniparser.a libiniparser.so*
rm -rf ./html ; mkdir html
cd test ; $(MAKE) veryclean
docs:
@(cd doc ; $(MAKE))
check:
@(cd test ; $(MAKE))
Could anyone please help me figuring this out?
iniParser lib link : http://ndevilla.free.fr/iniparser/index.html
Thanks,
Artheus
September 3rd, 2012, 04:36 AM
-
Well...
There was a very simple solution for this. I feel kinda stupid.
cmake was the magical command
This solved everything.
Cheers,
Artheus