linking question

Sorry for what might be naive question.

So I have the following command:

/usr/bin/g++ -I. -I./include -I/usr/include/libxml2 -arch i386 -fno-common -pipe -O3 -g -Wall -fexceptions -Wno-parentheses -Wno-deprecated-declarations -Werror array.o bignum.o class.o compar.o complex.o enum.o enumerator.o error.o eval.o file.o load.o proc.o gc.o hash.o inits.o io.o math.o numeric.o object.o pack.o parse.o prec.o dir.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o set.o signal.o sprintf.o st.o string.o struct.o time.o transcode.o util.o variable.o version.o thread.o id.o objc.o bs.o encoding.o main.o dln.o dmyext.o enc/ascii.o vm_eval.o miniprelude.o gc-stub.o roxor.o -L/Volumes/Rafi/llvm/Release/lib -lpthread -lm /Volumes/Rafi/llvm/Release/lib/LLVMX86CodeGen.o -lLLVMSelectionDAG -lLLVMAsmPrinter /Volumes/Rafi/llvm/Release/lib/LLVMExecutionEngine.o /Volumes/Rafi/llvm/Release/lib/LLVMJIT.o -lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMSupport -lLLVMSystem -lpthread -ldl -lxml2 -lobjc -lffi -lauto -framework Foundation -o miniruby

And when I replace g++ with clang, I get a lot of unresolved symbols pertaining to c++ objects in one .o file (rest of .o are created via clang).
Is this reasonable or am I doing something wrong?

I did notice that -flto and -O4 is disabled in clang. Is this going to be in for 1.0?
I want to try to see if it makes any difference on the above. Do I need to update my system ld with what?

This is correct behavior. If you have any C++ object files, you should use g++ (or whatever c++ compiler you used) for linking, since it will likely implicitly add libraries like the standard C++ library. Alternatively, you can try using clang for the link and adding -lstdc++, but there may be other things necessary.


-lstd++ was it.