zlib build failure on OS X 10.9.2 (Xcode 5.1) - osx-mavericks

Upgrading to Xcode 5.1 (and the most recent command line tools) has resulted in my no longer being able to build zlib. I now get the following:
gcc -dynamiclib -install_name /Users/fonnescj/Code/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.5 -arch x86_64 -I/Users/fonnescj/Code/include -I/Users/fonnescj/Code/include/freetype2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fPIC -o libz.1.2.5.dylib adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo -lc -arch x86_64 -L/Users/fonnescj/Code/lib -lbz2 -syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L. libz.a
clang: error: unknown argument: '-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make[1]: *** [libz.1.2.5.dylib] Error 1
make: *** [zlib] Error 2
It was suggested that adding the following flag would fix the issue:
export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
but it has not.

Related

#libext# #LDFLAGS# #LIBCURL_LIBS# variables not being substituted in clang command when installing pycurl2

I'm trying to install pycurl2 with pip (pip install 'pycurl2==7.20.0'), but it's failing on this clang command:
clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl#1.1/lib -L/Users/ed/.pyenv/versions/2.7.17/lib -L/usr/local/opt/openssl/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sasl build/temp.macosx-10.15-x86_64-2.7/src/pycurl.o -lcurl -o build/lib.macosx-10.15-x86_64-2.7/pycurl2.so /usr/lib/libcurl.#libext# #LDFLAGS# #LIBCURL_LIBS#
clang: error: no such file or directory: '/usr/lib/libcurl.#libext#'
clang: error: no such file or directory: '#LDFLAGS#'
clang: error: no such file or directory: '#LIBCURL_LIBS#'
error: command 'clang' failed with exit status 1
If you look at the last part of the clang command (/usr/lib/libcurl.#libext# #LDFLAGS# #LIBCURL_LIBS#) it looks like for some reason the installer is not substituting the actual values of LDFLAGS, etc. when generating the command and leaving in the placeholders (marked with #).
Does anyone know what's wrong, or how to fix the clang command?

clang: error: linker command failed with exit code 1 while installing sumo-planetsumo

I am trying to install sumo-planetsumo in order to run my scenarios on my macOS High Sierra, however after make -f Makefile.cvs and ./configure "make" produces the following error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[3]: *** [netgenerate] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
I do have other sumo versions installed on my pc and have been able to change paths in order to use them. I wonder if this has anything to do with the older versions, or xcode itself. Please help.
I have managed to solve this issue, at least on my system. I solved this problem by simply specifying the architecture during configuration. Like so:
./configure CC="gcc -arch x86_64"
You can specify for multiple architectures, for example, like so:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
I am still surprised because I expected auto-reconfigure to sort that out automatically and hence didn't think much of this specification until the build completed. Good luck.

math library and POSIX realtime extensions for Mac

Although more a novice I try to explain my problem.
I am on a Mac and use command line to build the executable. The compiling command works successfully on Ubuntu.
cc program.o file1.o file2.o file3.o file4.o -lm -lrt -o program
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [program] Error 1
If I run with -v command I get the following:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o program program.o file1.o file2.o file3.o file4.o -lm -lrt -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib/darwin/libclang_rt.osx.a
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any hint?
I found in this post what -lm -lrt mean but still could not figure out a solution.
Update 1: According to this link -lrt is not available for Mac.
Update 2: I have found two possible solutions: (a) either to remove completely the flag or (b) use the -lSystem.B instead. The real-time extensions seems to be in libSystem.B.dylib as explained here.

Building GCC-4.9.2 on OS X Yosemite

Ok, I'm having trouble building gcc-4.9.2 on Apple's new OS X Yosemite. I'm not sure if I need to be building a gnu-gcc compiler on OS X, as most other software has compiled fine, apart from tesseract-3.0.1 and some of my own wxWidgets applications. Are there certain programs/code features that clang can't compile?
My build steps are as follows:
cd build-gcc
../gcc-4.9.1/configure --program-prefix="gnu-" --prefix="/usr/local/gcc-4.9.1" --with-gmp="/usr/local" --with-mpfr="/usr/local" --with-mpc="/usr/local" CC=clang CXX=clang++
make
My build path and gcc source paths do not contain any whitespace, and I have installed GMP, MPFR and MPC in /usr/local.
My build outputs are:
clang++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -Wl,-no_pie -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o i386-c.o darwin-c.o \
cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp -L../zlib -lz
ld: warning: ld: warning: ld: warning: ignoring file libbackend.a, file was built for archive which is not the architecture being linked (x86_64): libbackend.aignoring file libcommon-target.a, file was built for archive which is not the architecture being linked (x86_64): libcommon-target.aignoring file ../libdecnumber/libdecnumber.a, file was built for archive which is not the architecture being linked (x86_64): ../libdecnumber/libdecnumber.a
ld: warning: ignoring file ../zlib/libz.a, file was built for archive which is not the architecture being linked (x86_64): ../zlib/libz.a
Undefined symbols for architecture x86_64:
... (Lots of symbols)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [cc1] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
Configure outputs the build type as: x86_64-apple-darwin14.0.0, so I don't understand why this is happening.
Thank You in advance for any help.
Turns out that I had a broken ranlib in /usr/local/bin - maybe GNU Binutils don't work on OS X? All I needed to do to fix the problem was to:
sudo mv /usr/local/bin/ranlib /usr/local/ranlib_old
and then make, and now I have a working GCC!

How to get invocation for Xcode "clang" compile-time error?

I get a compile-time error in Xcode that includes this message
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This -v is evidently a command-line option. I've run into this message before and have always been at a loss as to what I can do about it and why it's included if I can't do anything about it.
How can I employ the option in Xcode to see the invocation?
You can add the -v to the "Other Linker Flags" field in the project settings. Doing so in a test project here yields the complete linker invocation:
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
-demangle
-dynamic
-arch x86_64
-macosx_version_min 10.8.0
-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
-o /Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Products/Debug/example
-L/Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Products/Debug
-filelist /Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Intermediates/example.build/Debug/example.build/Objects-normal/x86_64/example.LinkFileList
-dependency_info /Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Intermediates/example.build/Debug/example.build/Objects-normal/x86_64/example_dependency_info.dat
-lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a
-F/Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Products/Debug

Resources