michaelrsweet/mxml

Build Fail on MacOS

thahgr opened this issue · 2 comments

After running configure, the linking fails as below.
MacOS 10.15.4

$ make
Compiling mxml-attr.c
Compiling mxml-entity.c
Compiling mxml-file.c
Compiling mxml-get.c
Compiling mxml-index.c
Compiling mxml-node.c
Compiling mxml-search.c
Compiling mxml-set.c
Compiling mxml-private.c
Compiling mxml-string.c
Creating libmxml.1.dylib...
Creating libmxml.a...
a - mxml-attr.o
a - mxml-entity.o
a - mxml-file.o
a - mxml-get.o
a - mxml-index.o
a - mxml-node.o
a - mxml-search.o
a - mxml-set.o
a - mxml-private.o
a - mxml-string.o
Compiling testmxml.c
Linking testmxml...
ld: warning: ignoring file libmxml.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture x86_64:
"_mxmlDelete", referenced from:
_main in testmxml.o
"_mxmlElementGetAttr", referenced from:
_type_cb in testmxml.o
"_mxmlFindElement", referenced from:
_main in testmxml.o
"_mxmlFindPath", referenced from:
_main in testmxml.o
"_mxmlGetText", referenced from:
_main in testmxml.o
"_mxmlIndexDelete", referenced from:
_main in testmxml.o
"_mxmlIndexEnum", referenced from:
_main in testmxml.o
"_mxmlIndexFind", referenced from:
_main in testmxml.o
"_mxmlIndexNew", referenced from:
_main in testmxml.o
"_mxmlIndexReset", referenced from:
_main in testmxml.o
"_mxmlLoadFd", referenced from:
_main in testmxml.o
"_mxmlLoadFile", referenced from:
_main in testmxml.o
"_mxmlLoadString", referenced from:
_main in testmxml.o
"_mxmlNewCDATA", referenced from:
_main in testmxml.o
"_mxmlNewElement", referenced from:
_main in testmxml.o
"_mxmlNewInteger", referenced from:
_main in testmxml.o
"_mxmlNewOpaque", referenced from:
_main in testmxml.o
"_mxmlNewReal", referenced from:
_main in testmxml.o
"_mxmlNewText", referenced from:
_main in testmxml.o
"_mxmlNewXML", referenced from:
_main in testmxml.o
"_mxmlSAXLoadFile", referenced from:
_main in testmxml.o
"_mxmlSAXLoadString", referenced from:
_main in testmxml.o
"_mxmlSaveFd", referenced from:
_main in testmxml.o
"_mxmlSaveFile", referenced from:
_main in testmxml.o
"_mxmlSaveString", referenced from:
_main in testmxml.o
"_mxml_integer_cb", referenced from:
_main in testmxml.o
"_mxml_opaque_cb", referenced from:
_main in testmxml.o
"_mxml_real_cb", referenced from:
_main in testmxml.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [testmxml] Error 1

@thahgr What version of Mini-XML are you using?

Can you attach the generated Makefile from your system, along with the configure options you used?

This looks like the library got built for one architecture but the unit test program is getting built for another.

Its latest 3.2, i attach all relative files,
I managed to build via cmake on our project, so no need for further investigation from our side, but feel free to continue

./configure --prefix=/Users/ca000000/Jira/OSCMOB-2466/miniInst
checking build system type... x86_64-apple-darwin19.4.0
checking host system type... x86_64-apple-darwin19.4.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for ar... ar
checking for cp... /bin/cp
checking for ldconfig... no
checking for false... /usr/bin/false
checking for ln... /bin/ln
checking for mkdir... /bin/mkdir
checking for rm... /bin/rm
checking for inline... inline
checking for strdup... yes
checking for strlcat... yes
checking for strlcpy... yes
checking for snprintf... yes
checking for vasprintf... yes
checking for vsnprintf... yes
checking for long long int... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create using -lpthreads... no
checking for pthread_create using -lpthread... yes
checking for shared library support... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mxml.pc
config.status: creating config.h
config.status: config.h is unchanged

Archive.zip