Closed Bug 956310 Opened 10 years ago Closed 10 years ago

DMD builds fail on Mac OS X

Categories

(Core :: DMD, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: ehsan.akhgari, Assigned: smichaud)

References

Details

(Keywords: regression)

Attachments

(1 file)

4:08.25 Executing: /usr/local/bin/clang++ -Qunused-arguments -Qunused-arguments -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wsign-compare -Wno-invalid-offsetof -Wno-c++0x-extensions -Wno-extended-offsetof -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-mismatched-tags -Wno-error=uninitialized -Wno-error=deprecated-declarations -fcolor-diagnostics -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -DNO_X11 -pipe -DDEBUG -D_DEBUG -DTRACING -g -fno-omit-frame-pointer -fPIC -o libdmd.dylib -Wl,-filelist,/Users/ehsan/moz/src/obj-ff-dbg-dmd.noindex/memory/replace/dmd/tmp9c_CG9.list -framework Cocoa -lobjc -framework ExceptionHandling -Wl,-executable_path,/Users/ehsan/moz/src/obj-ff-dbg-dmd.noindex/dist/bin -dynamiclib -install_name @executable_path/libdmd.dylib -compatibility_version 1 -current_version 1 -single_module
 4:08.25 /Users/ehsan/moz/src/obj-ff-dbg-dmd.noindex/memory/replace/dmd/tmp9c_CG9.list:
 4:08.25     strcpy.o
 4:08.25     HashFunctions.o
 4:08.25     nsStackWalk.o
 4:08.25     DMD.o
 4:08.25
 4:08.25 Undefined symbols for architecture x86_64:
 4:08.25   "nsCocoaFeatures::OnLionOrLater()", referenced from:
 4:08.25       OnLionOrLater() in nsStackWalk.o
 4:08.25 ld: symbol(s) not found for architecture x86_64
 4:08.25 clang++: error: linker command failed with exit code 1 (use -v to see invocation)
 4:08.25 make[5]: *** [libdmd.dylib] Error 1
 4:08.25 make[4]: *** [memory/replace/dmd/libs] Error 2
 4:08.25 make[3]: *** [libs] Error 2
 4:08.25 make[2]: *** [default] Error 2
 4:08.25 make[1]: *** [realbuild] Error 2
 4:08.25 make: *** [build] Error 2
Blocks: 676907
Keywords: regression
I tried adding nsCocoaFeatures.mm to the build but that opens a can of worms since that will require us to pull in a whole bunch of XPCOM code...  One alternative is to copy the code inside nsCocoaFeatures.mm in nsStackWalk.cpp without the XPCOM-isms such as NS_OBJC_BEGIN_TRY_ABORT_BLOCK, etc.
Blocks: 884368
FWIW, I'm still on 10.7 and I don't have any problem building.
(In reply to comment #2)
> FWIW, I'm still on 10.7 and I don't have any problem building.

I'm on 10.9 in case it makes a difference.
Actually, I don't understand why this has to be a 10.9 specific issue.  Does your nsStackWalk.cpp depend on nsCocoaFeatures.mm?  If yes, you should experience the same problem!
Flags: needinfo?(n.nethercote)
Summary: DMD builds fail on Mac → DMD builds fail on Mac OS X 10.9
Also, are you on a debug build?  The code in question doesn't exist in opt builds.
Oh, I only tested an opt build.
Flags: needinfo?(n.nethercote)
What are DMD builds? :-)

What mozconfig option do you need to make them happen?
DMD wraps malloc and free calls with various logging stuff, roughly speaking.

There's info on how to build it here:
  https://wiki.mozilla.org/Performance/MemShrink/DMD#Build
This is the mozconfig you need to repro this bug:

ac_add_options --enable-dmd
ac_add_options --enable-debug

And it's not 10.9 specific, sorry for the red herring.
Summary: DMD builds fail on Mac OS X 10.9 → DMD builds fail on Mac OS X
No longer blocks: 10.9-build_issues
Attached patch Simple fixSplinter Review
The problem here is that nsStackWalk.cpp, which contains a call to nsCocoaFeatures::OnLionOrLater(), is linked into both XUL and libdmd.dylib.  But while XUL also links the object code corresponding to nsCocoaFeatures.mm, libdmd.dylib doesn't.

So we can't call nsCocoaFeatures::OnLionOrLater() from nsStackWalk.cpp.

We also can't just paste in the version checking code from nsCocoaFeatures.mm (intAtStringIndex() and GetSystemVersion()), because that uses Objective-C syntax.  So unless we want to rewrite those methods to use CoreFoundation calls instead of Cocoa ones, we'll have to go back to using Gestalt() to get the OS X system version.

We've left lots of other calls to Gestalt() in the tree.  And (for complicated reasons) I'm reasonably certain Apple will never get rid of Gestalt(), though they've deprecated it.  So I think it's fine to also go back to using Gestalt() here.

It would be neater (and in the long run probably better) to rewrite the version checking code from nsCocoaFeatures.mm to not use Objective-C syntax.  That way we could (probably) replace all the calls to Gestalt() in the tree.  But we'll *never* be able to replace all the calls to Gestalt() with calls to nsCocoaFeatures::OnLionOrLater() and friends.
Assignee: nobody → smichaud
Attachment #8357412 - Flags: review?(bgirard)
Attachment #8357412 - Flags: review?(bgirard) → review+
https://hg.mozilla.org/mozilla-central/rev/8e8e69473e91
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: