C linking fails

Ryan Schmidt ryandesign at macports.org
Tue Jul 28 23:05:05 PDT 2015


On Jul 28, 2015, at 3:45 PM, James Rome wrote:
> 
> I am using gcc and ggdb from MacPorts, and Apple's make to try and
> develop C programs in Yosemite using NetBeans.
> 
> But I keep getting the following when I build:
> Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
> Target: x86_64-apple-darwin14.4.0
> Thread model: posix
> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
> -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all
> -disable-free -disable-llvm-verifier -main-file-name zcursor.c
> -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose
> -munwind-tables -target-cpu core2 -target-linker-version 242.2 -v
> -gdwarf-2 -dwarf-column-info -coverage-file
> /Volumes/MacHD3/PASSUR/TimeStamps/build/Debug/GNU-MacOSX/src/zcursor.o
> -resource-dir
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0
> -dependency-file build/Debug/GNU-MacOSX/src/zcursor.o.d -MT
> build/Debug/GNU-MacOSX/src/zcursor.o -MP -I /Users/jar/GraphiC2/include
> -I /opt/local/include -I
> /opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include -I
> /opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include-fixed -O0
> -fdebug-compilation-dir /Volumes/MacHD3/PASSUR/TimeStamps -ferror-limit
> 19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks
> -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature
> -fmax-type-align=16 -fdiagnostics-show-option -o
> build/Debug/GNU-MacOSX/src/zcursor.o -x c src/zcursor.c
> clang -cc1 version 6.1.0 based upon LLVM 3.6.0svn default target
> x86_64-apple-darwin14.4.0
> ignoring nonexistent directory
> "/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include"
> ignoring nonexistent directory
> "/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include-fixed"
> #include "..." search starts here:
> #include <...> search starts here:
> /Users/jar/GraphiC2/include
> /opt/local/include
> /usr/local/include
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
> /usr/include
> /System/Library/Frameworks (framework directory)
> /Library/Frameworks (framework directory)
> End of search list.
> mkdir -p dist/Debug/GNU-MacOSX
> ld -o dist/Debug/GNU-MacOSX/timestamps build/Debug/GNU-MacOSX/main.o
> build/Debug/GNU-MacOSX/src/arrow.o build/Debug/GNU-MacOSX/src/axesdraw.o
> build/Debug/GNU-MacOSX/src/barplt.o build/Debug/GNU-MacOSX/src/baux.o
> build/Debug/GNU-MacOSX/src/bothplt.o
> build/Debug/GNU-MacOSX/src/boxfill.o build/Debug/GNU-MacOSX/src/bplt.o
> build/Debug/GNU-MacOSX/src/circles.o build/Debug/GNU-MacOSX/src/cntaux.o
> build/Debug/GNU-MacOSX/src/cntplt.o build/Debug/GNU-MacOSX/src/color.o
> build/Debug/GNU-MacOSX/src/colorkey.o
> build/Debug/GNU-MacOSX/src/conmatr.o build/Debug/GNU-MacOSX/src/cursor.o
> build/Debug/GNU-MacOSX/src/curves.o build/Debug/GNU-MacOSX/src/d3aux.o
> build/Debug/GNU-MacOSX/src/d3plt.o build/Debug/GNU-MacOSX/src/d4plt.o
> build/Debug/GNU-MacOSX/src/erfplt.o build/Debug/GNU-MacOSX/src/getxy.o
> build/Debug/GNU-MacOSX/src/gridopts.o
> build/Debug/GNU-MacOSX/src/insert.o build/Debug/GNU-MacOSX/src/labset.o
> build/Debug/GNU-MacOSX/src/legend.o
> build/Debug/GNU-MacOSX/src/lineattr.o build/Debug/GNU-MacOSX/src/lines.o
> build/Debug/GNU-MacOSX/src/linplt.o build/Debug/GNU-MacOSX/src/logplt.o
> build/Debug/GNU-MacOSX/src/lplt.o build/Debug/GNU-MacOSX/src/matsolve.o
> build/Debug/GNU-MacOSX/src/memory.o
> build/Debug/GNU-MacOSX/src/messages.o
> build/Debug/GNU-MacOSX/src/panfil.o
> build/Debug/GNU-MacOSX/src/patchplt.o build/Debug/GNU-MacOSX/src/pclp.o
> build/Debug/GNU-MacOSX/src/pieplt.o
> build/Debug/GNU-MacOSX/src/plumeplt.o
> build/Debug/GNU-MacOSX/src/polplt.o
> build/Debug/GNU-MacOSX/src/position.o
> build/Debug/GNU-MacOSX/src/psfont.o build/Debug/GNU-MacOSX/src/r3plt.o
> build/Debug/GNU-MacOSX/src/rfit.o build/Debug/GNU-MacOSX/src/roundoff.o
> build/Debug/GNU-MacOSX/src/simplt.o build/Debug/GNU-MacOSX/src/smear.o
> build/Debug/GNU-MacOSX/src/smith.o build/Debug/GNU-MacOSX/src/smooth.o
> build/Debug/GNU-MacOSX/src/statfuns.o
> build/Debug/GNU-MacOSX/src/surmatr.o build/Debug/GNU-MacOSX/src/svc.o
> build/Debug/GNU-MacOSX/src/symbols.o build/Debug/GNU-MacOSX/src/tekint.o
> build/Debug/GNU-MacOSX/src/tkfPush.o build/Debug/GNU-MacOSX/src/tplt.o
> build/Debug/GNU-MacOSX/src/triangle.o
> build/Debug/GNU-MacOSX/src/truetype.o
> build/Debug/GNU-MacOSX/src/ttdisk.o build/Debug/GNU-MacOSX/src/ttfntld.o
> build/Debug/GNU-MacOSX/src/ttfntplt.o
> build/Debug/GNU-MacOSX/src/zcursor.o  -v
> @(#)PROGRAM:ld  PROJECT:ld64-242.2
> configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64
> x86_64h armv6m armv7m armv7em
> Library search paths:
>    /usr/lib
>    /usr/local/lib
> Framework search paths:
>    /Library/Frameworks/
>    /System/Library/Frameworks/
> ld: warning: -macosx_version_min not specified, assuming 10.10
> Undefined symbols for architecture x86_64:
>  "_RingBuffer_create", referenced from:
>      _main in main.o
>  "___memcpy_chk", referenced from:
> 
> . . . .
> 
>  "start", referenced from:
>     implicit entry/start for main executable
>     (maybe you meant: _startq, _get_start_endq , _startplot , _line_start )
> ld: symbol(s) not found for inferred architecture x86_64
> make[2]: *** [dist/Debug/GNU-MacOSX/timestamps] Error 1
> make[1]: *** [.build-conf] Error 2
> make: *** [.build-impl] Error 2
> 
> How do I overcome this?


I'm unclear exactly what you're doing... you said you're using MacPorts gcc, and I do see references to paths used by gcc49 in your transcript, but I also see that the clang compiler is being used. Mixing these two might be problematic. Mixing them is definitely problematic when using C++ code, but I'm not sure if you're using C++ or not.

How are you specifying that MacPorts gcc49 should be used? Since clang is showing up in the output, you're not being entirely successful... Either try to more fully specify that gcc49 should be used, or else try to use clang; not sure if that will work for your situation but it is the recommended compiler to use on OS X.




More information about the macports-users mailing list