Last Comment Bug 672501 - [Clang]: Not able anymore to build with the 10.7 SDK
: [Clang]: Not able anymore to build with the 10.7 SDK
Status: RESOLVED FIXED
fixed-in-bs
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla8
Assigned To: Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
:
Mentors:
Depends on:
Blocks: clang 675447
  Show dependency treegraph
 
Reported: 2011-07-19 07:34 PDT by Nomis101
Modified: 2011-08-01 05:13 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
don't enable __thread if the linker crashes (1.51 KB, patch)
2011-07-25 20:43 PDT, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
ted: review+
Details | Diff | Splinter Review

Description Nomis101 2011-07-19 07:34:00 PDT
Since I've installed the GM versions of Mac OS X 10.7 and Xcode 4.1, I'm not able anymore to build Firefox/Thunderbird with Clang 3.0 and the 10.7 SDK. It works still fine with the 10.6 SDK. And it doesn't make any differences if I link DYLD_LIBRARY_PATH or not. Its Clang 3.0 from the clang page, Xcode 4.1 4B103 and Mac OS X 10.7 11A511.

I get the following error:

/Users/polysom/Documents/Developer/build/Release/bin/clang++ -o nsRDFResource.o -c  -fvisibility=hidden -DMOZ_JSDEBUGGER -DMOZ_PREF_EXTENSIONS -DMOZ_AUTH_EXTENSION -DMOZ_PERMISSIONS -DMOZ_UNIVERSALCHARDET -DICON_DECODER -DMOZ_SPELLCHECK -DMOZ_ZIPWRITER -DIMPL_XREAPI -DMOZILLA_INTERNAL_API -DOSTYPE=\"Darwin11.0.0\" -DOSARCH=Darwin -D_IMPL_NS_COM -D_IMPL_NS_STRINGAPI -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET  -I/Users/polysom/Documents/Developer/temp/src/mozilla/intl/unicharutil/util -I/Users/polysom/Documents/Developer/temp/src/mozilla/intl/unicharutil/src -I/Users/polysom/Documents/Developer/temp/src/mozilla/config -I/Users/polysom/Documents/Developer/temp/src/mozilla/widget/src/windows -I/Users/polysom/Documents/Developer/temp/src/mozilla/widget/src/build  -I/Users/polysom/Documents/Developer/temp/src/mozilla/toolkit/library -I. -I../../dist/include -I../../dist/include/nsprpub  -I/Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/dist/include/nspr -I/Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/dist/include/nss       -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.7.sdk -fno-strict-aliasing -fno-common -fshort-wchar -pthread -DNO_X11 -pipe  -DNDEBUG -DTRIMMED -g -O3 -fomit-frame-pointer   -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MF .deps/nsRDFResource.pp /Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/toolkit/library/nsRDFResource.cpp
/Users/polysom/Documents/Developer/build/Release/bin/clang++ -o nsBidiUtils.o -c  -fvisibility=hidden -DMOZ_JSDEBUGGER -DMOZ_PREF_EXTENSIONS -DMOZ_AUTH_EXTENSION -DMOZ_PERMISSIONS -DMOZ_UNIVERSALCHARDET -DICON_DECODER -DMOZ_SPELLCHECK -DMOZ_ZIPWRITER -DIMPL_XREAPI -DMOZILLA_INTERNAL_API -DOSTYPE=\"Darwin11.0.0\" -DOSARCH=Darwin -D_IMPL_NS_COM -D_IMPL_NS_STRINGAPI -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET  -I/Users/polysom/Documents/Developer/temp/src/mozilla/intl/unicharutil/util -I/Users/polysom/Documents/Developer/temp/src/mozilla/intl/unicharutil/src -I/Users/polysom/Documents/Developer/temp/src/mozilla/config -I/Users/polysom/Documents/Developer/temp/src/mozilla/widget/src/windows -I/Users/polysom/Documents/Developer/temp/src/mozilla/widget/src/build  -I/Users/polysom/Documents/Developer/temp/src/mozilla/toolkit/library -I. -I../../dist/include -I../../dist/include/nsprpub  -I/Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/dist/include/nspr -I/Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/dist/include/nss       -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.7.sdk -fno-strict-aliasing -fno-common -fshort-wchar -pthread -DNO_X11 -pipe  -DNDEBUG -DTRIMMED -g -O3 -fomit-frame-pointer   -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MF .deps/nsBidiUtils.pp /Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/toolkit/library/nsBidiUtils.cpp
/Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/config/nsinstall -D ../../dist/sdk/lib
rm -f XUL
/usr/bin/python2.7 /Users/polysom/Documents/Developer/temp/src/mozilla/config/pythonpath.py -I../../config /Users/polysom/Documents/Developer/temp/src/mozilla/config/expandlibs_exec.py --uselist --  /Users/polysom/Documents/Developer/build/Release/bin/clang++  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.7.sdk -fno-strict-aliasing -fno-common -fshort-wchar -pthread -DNO_X11 -pipe  -DNDEBUG -DTRIMMED -g -O3 -fomit-frame-pointer -fPIC  -o XUL  nsStaticXULComponents.o nsUnicharUtils.o nsBidiUtils.o nsRDFResource.o     -framework Cocoa -lobjc  -framework ExceptionHandling -Wl,-executable_path,/Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/dist/bin -Wl,-dead_strip ../../toolkit/xre/libxulapp_s.a  ../../staticlib/components/libnecko.a ../../staticlib/components/libuconv.a ../../staticlib/components/libi18n.a ../../staticlib/components/libchardet.a ../../staticlib/components/libjar50.a ../../staticlib/components/libstartupcache.a ../../staticlib/components/libpref.a ../../staticlib/components/libhtmlpars.a ../../staticlib/components/libimglib2.a ../../staticlib/components/libgkgfx.a ../../staticlib/components/libgklayout.a ../../staticlib/components/libdocshell.a ../../staticlib/components/libembedcomponents.a ../../staticlib/components/libwebbrwsr.a ../../staticlib/components/libnsappshell.a ../../staticlib/components/libtxmgr.a ../../staticlib/components/libcommandlines.a ../../staticlib/components/libtoolkitcomps.a ../../staticlib/components/libpipboot.a ../../staticlib/components/libpipnss.a ../../staticlib/components/libappcomps.a ../../staticlib/components/libjsreflect.a ../../staticlib/components/libcomposer.a ../../staticlib/components/libjetpack_s.a ../../staticlib/components/libtelemetry.a ../../staticlib/components/libjsctypes.a ../../staticlib/components/libjsperf.a ../../staticlib/components/libgkplugin.a ../../staticlib/components/libosxproxy.a ../../staticlib/components/libjsd.a ../../staticlib/components/libautoconfig.a ../../staticlib/components/libauth.a ../../staticlib/components/libcookie.a ../../staticlib/components/libpermissions.a ../../staticlib/components/libuniversalchardet.a ../../staticlib/components/librdf.a ../../staticlib/components/libwindowds.a ../../staticlib/components/libstoragecomps.a ../../staticlib/components/libplaces.a ../../staticlib/components/libtkautocomplete.a ../../staticlib/components/libsatchel.a ../../staticlib/components/libpippki.a ../../staticlib/components/libimgicon.a ../../staticlib/components/libwidget_mac.a ../../staticlib/components/libspellchecker.a ../../staticlib/components/libzipwriter.a ../../staticlib/components/libservices-crypto.a ../../staticlib/libjsipc_s.a ../../staticlib/libdomipc_s.a ../../staticlib/libdomplugins_s.a ../../staticlib/libmozipc_s.a ../../staticlib/libmozipdlgen_s.a ../../staticlib/libipcshell_s.a ../../staticlib/libgfx2d.a ../../staticlib/libgfxipc_s.a ../../staticlib/libxpcom_core.a ../../staticlib/libucvutil_s.a ../../staticlib/libchromium_s.a ../../staticlib/libmozreg_s.a ../../staticlib/libthebes.a ../../staticlib/libycbcr.a ../../staticlib/libangle.a  ../../dist/lib/libmozsqlite3.a -L../../dist/bin -L../../dist/lib ../../jpeg/libmozjpeg.a ../../modules/libimg/png/libmozpng.a ../../gfx/qcms/libmozqcms.a /Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/dist/lib/libjs_static.a -L../../dist/bin -L../../dist/lib -lcrmf -lsmime3 -lssl3 -lnss3 -lnssutil3 ../../gfx/cairo/cairo/src/libmozcairo.a  ../../gfx/cairo/libpixman/src/libmozlibpixman.a ../../gfx/harfbuzz/src/libmozharfbuzz.a ../../gfx/ots/src/libmozots.a   ../../modules/zlib/src/libmozz.a -L../../dist/bin -L../../dist/lib  -L/Users/polysom/Documents/Developer/temp/src/mozilla/obj-x86_64-apple-darwin11.0.0/dist/lib -lplds4 -lplc4 -lnspr4 ../../dist/lib/libmozalloc.a -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework IOKit -framework Foundation -framework AppKit  -dynamiclib -install_name @executable_path/XUL -compatibility_version 1 -current_version 1 -single_module  -framework OpenGL -lcups -framework SystemConfiguration -framework QuickTime -framework IOKit -lcrypto -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL     
clang: warning: argument unused during compilation: '-pthread'
ld: warning: ignoring file /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks//QuickTime.framework/QuickTime, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: could not create compact unwind for _ffi_call_unix64: does not use RBP or RSP based frame
Assertion failed: (_mode == modeFinalAddress), function finalAddress, file /SourceCache/ld64/ld64-123.2.1/src/ld/ld.hpp, line 573.
0  0x1007bc71c  __assert_rtn + 76
1  0x10083501c  ld::tool::OutputFile::addressOf(ld::Internal const&, ld::Fixup const*, ld::Atom const**) + 172
2  0x100837a25  ld::tool::OutputFile::applyFixUps(ld::Internal&, unsigned long long, ld::Atom const*, unsigned char*) + 3909
3  0x100833f70  ld::tool::OutputFile::writeOutputFile(ld::Internal&) + 816
4  0x10082cab9  ld::tool::OutputFile::write(ld::Internal&) + 153
5  0x1007bccaa  main + 1178
6  0x1007ab2b4  start + 52
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [XUL] Error 1
make[4]: *** [libs_tier_platform] Error 2
make[3]: *** [tier_platform] Error 2
make[2]: *** [default] Error 2
make[1]: *** [realbuild] Error 2
make: *** [build] Error 2
Comment 1 Nomis101 2011-07-22 06:48:55 PDT
Strange, if I build with LTO, than I don't see this error. But than the application crashes on startup.
Comment 2 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-07-22 20:57:10 PDT
I have just finished a non LTO build using clang 135210, xcode 4.1 and the shipping OS X. Can you try that or a newer clang and see if this is still failing?

Thanks
Comment 3 Nomis101 2011-07-23 02:48:21 PDT
My clang was 135045, I will try a newer version. Have you build with the 10.7 SDK (--with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk)?
Comment 4 Nomis101 2011-07-24 06:57:18 PDT
Ah, I found the reason. Its not only the 10.7 SDK, its the combination with target=10.7

If I only build with --with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk than it builds just fine.
But if I build with --with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk AND --enable-macos-target=10.7 than I get the above error. I used clang version 3.0 (trunk 135851).
Comment 5 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-07-24 09:47:30 PDT
You were right, I was using the default universal mozconfig and that uses the 10.6 sdk. Trying the 10.7 sdk I found bug 673789.
Comment 6 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-07-24 20:29:09 PDT
ok, I am able to reproduce this. Will try to debug.
Comment 7 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-07-25 16:57:33 PDT
I reduced this to

__thread int gTLSThreadID = 0;
int foobar() {
  return gTLSThreadID;
}
int main(void) {
  return foobar();
}

which crashes the linker if -dead_strip is used. I am trying to figure out if there is some way to work around it in clang/llvm, but if not I will try to disable TLS when building for 10.7.
Comment 8 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-07-25 20:43:24 PDT
Created attachment 548359 [details] [diff] [review]
don't enable __thread if the linker crashes

This patch adds MOZ_OPTIMIZE_LDFLAGS to the link line when checking for __thread. With the current (xcode 4.1) linker, the test fails. As soon as the linker is fixed we will get TLS.

TLS was not available in 10.6, so this is not a regression.
Comment 9 Ted Mielczarek [:ted.mielczarek] 2011-07-26 04:06:29 PDT
Comment on attachment 548359 [details] [diff] [review]
don't enable __thread if the linker crashes

Review of attachment 548359 [details] [diff] [review]:
-----------------------------------------------------------------
Comment 10 Nomis101 2011-07-26 05:35:58 PDT
Thanks, I can confirm that this patch will fix the error. 
Tested with clang version 3.0 trunk 135851, Mac OS X 10.7.2 11C26, XCode 4.1 4B110.
Comment 11 Ted Mielczarek [:ted.mielczarek] 2011-07-26 09:46:31 PDT
http://hg.mozilla.org/projects/build-system/rev/d0978a2e87fd
Comment 12 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-08-01 05:13:34 PDT
http://hg.mozilla.org/mozilla-central/rev/d0978a2e87fd

Note You need to log in before you can comment on or make changes to this bug.