* Compiling Emacs on Mac OS X 10.6 Snow Leopard
@ 2009-08-31 10:36 YAMAMOTO Mitsuharu
2009-08-31 14:40 ` Stefan Monnier
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-08-31 10:36 UTC (permalink / raw
To: emacs-devel
This is a summary of the current status of compilation on the newly
released Mac OS X 10.6 Snow Leopard.
* For Emacs 22.3 and 23.1, you need to apply the patch below. It
has already been applied to the CVS trunk.
* Now gcc seems to make a 64-bit binary by default (the situation
might be different on Core Solo/Duo machines). Emacs 22.3 Carbon
port can't make it because the GUI portion of Carbon doesn't have
64-bit support. Currently, the Cocoa port (23.1 or the CVS trunk)
can't do that either because the code doesn't take account of it.
In either case, you need to specify the 32-bit option CC='gcc
-arch i386' when running configure. This restriction does not
apply to tty-only or X11 builds.
* If you want to use a 64-bit binary with native GUI support, you
can try Emacs 22.3 Carbon+AppKit port or 23.1 Mac port (the latter
is currently experimental/hackers-only).
http://lists.gnu.org/archive/html/emacs-devel/2009-08/msg01309.html
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
Index: src/unexmacosx.c
===================================================================
RCS file: /sources/emacs/emacs/src/unexmacosx.c,v
retrieving revision 1.22.2.5
diff -c -p -r1.22.2.5 unexmacosx.c
*** src/unexmacosx.c 8 Jan 2008 04:29:48 -0000 1.22.2.5
--- src/unexmacosx.c 30 Aug 2009 09:01:00 -0000
*************** print_load_command_name (int lc)
*** 584,589 ****
--- 584,597 ----
printf ("LC_UUID ");
break;
#endif
+ #ifdef LC_DYLD_INFO
+ case LC_DYLD_INFO:
+ printf ("LC_DYLD_INFO ");
+ break;
+ case LC_DYLD_INFO_ONLY:
+ printf ("LC_DYLD_INFO_ONLY");
+ break;
+ #endif
default:
printf ("unknown ");
}
*************** copy_data_segment (struct load_command *
*** 821,826 ****
--- 829,835 ----
|| strncmp (sectp->sectname, "__const", 16) == 0
|| strncmp (sectp->sectname, "__cfstring", 16) == 0
|| strncmp (sectp->sectname, "__gcc_except_tab", 16) == 0
+ || strncmp (sectp->sectname, "__program_vars", 16) == 0
|| strncmp (sectp->sectname, "__objc_", 7) == 0)
{
if (!unexec_copy (sectp->offset, old_file_offset, sectp->size))
*************** copy_twolevelhints (struct load_command
*** 1088,1093 ****
--- 1097,1132 ----
curr_header_offset += lc->cmdsize;
}
+ #ifdef LC_DYLD_INFO
+ /* Copy a LC_DYLD_INFO(_ONLY) load command from the input file to the output
+ file, adjusting the file offset fields. */
+ static void
+ copy_dyld_info (struct load_command *lc, long delta)
+ {
+ struct dyld_info_command *dip = (struct dyld_info_command *) lc;
+
+ if (dip->rebase_off > 0)
+ dip->rebase_off += delta;
+ if (dip->bind_off > 0)
+ dip->bind_off += delta;
+ if (dip->weak_bind_off > 0)
+ dip->weak_bind_off += delta;
+ if (dip->lazy_bind_off > 0)
+ dip->lazy_bind_off += delta;
+ if (dip->export_off > 0)
+ dip->export_off += delta;
+
+ printf ("Writing ");
+ print_load_command_name (lc->cmd);
+ printf (" command\n");
+
+ if (!unexec_write (curr_header_offset, lc, lc->cmdsize))
+ unexec_error ("cannot write dyld info command to header");
+
+ curr_header_offset += lc->cmdsize;
+ }
+ #endif
+
/* Copy other kinds of load commands from the input file to the output
file, ones that do not require adjustments of file offsets. */
static void
*************** dump_it ()
*** 1154,1159 ****
--- 1193,1204 ----
case LC_TWOLEVEL_HINTS:
copy_twolevelhints (lca[i], linkedit_delta);
break;
+ #ifdef LC_DYLD_INFO
+ case LC_DYLD_INFO:
+ case LC_DYLD_INFO_ONLY:
+ copy_dyld_info (lca[i], linkedit_delta);
+ break;
+ #endif
default:
copy_other (lca[i]);
break;
Index: src/s/darwin.h
===================================================================
RCS file: /sources/emacs/emacs/src/s/darwin.h,v
retrieving revision 1.28.2.4
diff -c -p -r1.28.2.4 darwin.h
*** src/s/darwin.h 17 Jul 2008 09:07:06 -0000 1.28.2.4
--- src/s/darwin.h 30 Aug 2009 09:01:01 -0000
*************** Boston, MA 02110-1301, USA. */
*** 351,356 ****
--- 351,359 ----
#define malloc unexec_malloc
#define realloc unexec_realloc
#define free unexec_free
+ /* Don't use posix_memalign because it is not compatible with
+ unexmacosx.c. */
+ #undef HAVE_POSIX_MEMALIGN
#endif
/* This makes create_process in process.c save and restore signal
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling Emacs on Mac OS X 10.6 Snow Leopard
2009-08-31 10:36 Compiling Emacs on Mac OS X 10.6 Snow Leopard YAMAMOTO Mitsuharu
@ 2009-08-31 14:40 ` Stefan Monnier
2009-08-31 17:50 ` David Reitter
2009-08-31 18:02 ` CHENG Gao
2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2009-08-31 14:40 UTC (permalink / raw
To: YAMAMOTO Mitsuharu; +Cc: emacs-devel
> * Now gcc seems to make a 64-bit binary by default (the situation
> might be different on Core Solo/Duo machines). Emacs 22.3 Carbon
> port can't make it because the GUI portion of Carbon doesn't have
> 64-bit support. Currently, the Cocoa port (23.1 or the CVS trunk)
> can't do that either because the code doesn't take account of it.
That shouldn't be difficult to fix. Can someone look into it?
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling Emacs on Mac OS X 10.6 Snow Leopard
2009-08-31 10:36 Compiling Emacs on Mac OS X 10.6 Snow Leopard YAMAMOTO Mitsuharu
2009-08-31 14:40 ` Stefan Monnier
@ 2009-08-31 17:50 ` David Reitter
2009-09-01 5:24 ` YAMAMOTO Mitsuharu
2009-08-31 18:02 ` CHENG Gao
2 siblings, 1 reply; 6+ messages in thread
From: David Reitter @ 2009-08-31 17:50 UTC (permalink / raw
To: YAMAMOTO Mitsuharu; +Cc: emacs-devel
On Aug 31, 2009, at 6:36 AM, YAMAMOTO Mitsuharu wrote:
> * For Emacs 22.3 and 23.1, you need to apply the patch below. It
> has already been applied to the CVS trunk.
This works, even though I had to include loader.h explicitly with a
full path, because it otherwise seems to include an older loader.h
that doesn't define LC_DYLD_INFO.
The bigger problem now is that it won't run on 10.5 systems:
./emacs
dyld: unknown required load command 0x80000022
Trace/BPT trap
(LC_DYLD_INFO = 0x22)
So I set the deployment target...
export MACOSX_DEPLOYMENT_TARGET=10.4
In that case it builds fine, even without LC_DYLD_INFO being defined.
I think the linker will correctly generate compatible mach-o files.
It still won't execute on 10.5. Not sure what this is about:
./Emacs -nw
dyld: lazy symbol binding failed: Symbol not found: _fdopen$UNIX2003
Referenced from: /Users/dr/Emacs.app/Contents/MacOS/./Emacs
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _fdopen$UNIX2003
Referenced from: /Users/dr/Emacs.app/Contents/MacOS/./Emacs
Expected in: /usr/lib/libSystem.B.dylib
This is with CC=-arch i386, --without-x --with-ns, from the master
branch.
Thanks for working on the 10.6 build issue.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling Emacs on Mac OS X 10.6 Snow Leopard
2009-08-31 10:36 Compiling Emacs on Mac OS X 10.6 Snow Leopard YAMAMOTO Mitsuharu
2009-08-31 14:40 ` Stefan Monnier
2009-08-31 17:50 ` David Reitter
@ 2009-08-31 18:02 ` CHENG Gao
2 siblings, 0 replies; 6+ messages in thread
From: CHENG Gao @ 2009-08-31 18:02 UTC (permalink / raw
To: emacs-devel
I confirm Emacs 23.1 Mac port 1.91 builds out of box on Snow Leopard.
Activity Monitor shows it's 64bit.
--
Volo, non valeo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling Emacs on Mac OS X 10.6 Snow Leopard
2009-08-31 17:50 ` David Reitter
@ 2009-09-01 5:24 ` YAMAMOTO Mitsuharu
2009-09-01 17:35 ` David Reitter
0 siblings, 1 reply; 6+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-09-01 5:24 UTC (permalink / raw
To: David Reitter; +Cc: emacs-devel
>>>>> On Mon, 31 Aug 2009 13:50:06 -0400, David Reitter <david.reitter@gmail.com> said:
> On Aug 31, 2009, at 6:36 AM, YAMAMOTO Mitsuharu wrote:
>> * For Emacs 22.3 and 23.1, you need to apply the patch below. It
>> has already been applied to the CVS trunk.
> This works, even though I had to include loader.h explicitly with a
> full path, because it otherwise seems to include an older loader.h
> that doesn't define LC_DYLD_INFO.
How did you build it? The standard procedure should include the right
loader.h.
> The bigger problem now is that it won't run on 10.5 systems:
> ./emacs dyld: unknown required load command 0x80000022 Trace/BPT
> trap
> (LC_DYLD_INFO = 0x22)
Yes. It is mentioned in "Dynamic Loader Release Notes"
http://developer.apple.com/mac/library/releasenotes/DeveloperTools/RN-dyld/index.html
> So I set the deployment target...
> export MACOSX_DEPLOYMENT_TARGET=10.4
> In that case it builds fine, even without LC_DYLD_INFO being
> defined. I think the linker will correctly generate compatible
> mach-o files.
> It still won't execute on 10.5. Not sure what this is about:
> ./Emacs -nw dyld: lazy symbol binding failed: Symbol not found:
> _fdopen$UNIX2003 Referenced from:
> /Users/dr/Emacs.app/Contents/MacOS/./Emacs Expected in:
> /usr/lib/libSystem.B.dylib
> dyld: Symbol not found: _fdopen$UNIX2003 Referenced from:
> /Users/dr/Emacs.app/Contents/MacOS/./Emacs Expected in:
> /usr/lib/libSystem.B.dylib
I can't reproduce this with the CVS trunk HEAD. What I did was:
mkdir emacs-ns-i386-10.4
cd emacs-ns-i386-10.4
MACOSX_DEPLOYMENT_TARGET=10.4 CC='gcc -arch i386' ../emacs/configure --with-ns
MACOSX_DEPLOYMENT_TARGET=10.4 make install
The resulting binary runs on both 10.5 and 10.4. You can check which
object uses _fdopen$UNIX2003 by running "nm -A src/*.o | grep fdopen".
Or maybe Emacs is unconsciously linked with some external libraries?
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Compiling Emacs on Mac OS X 10.6 Snow Leopard
2009-09-01 5:24 ` YAMAMOTO Mitsuharu
@ 2009-09-01 17:35 ` David Reitter
0 siblings, 0 replies; 6+ messages in thread
From: David Reitter @ 2009-09-01 17:35 UTC (permalink / raw
To: YAMAMOTO Mitsuharu, Emacs Development
On Sep 1, 2009, at 1:24 AM, YAMAMOTO Mitsuharu wrote:
>> This works, even though I had to include loader.h explicitly with a
>> full path, because it otherwise seems to include an older loader.h
>> that doesn't define LC_DYLD_INFO.
>
> How did you build it? The standard procedure should include the right
> loader.h.
CC='gcc -arch i386' ./configure --with-ns --without-x
make bootstrap
Turns out that I had a /usr/local/include/mach-o directory with the
old loader.h file.
It looks like it was installed along with llvm in spring 2008. It may
have been part of a free iPhone OS related build stack that I
installed around that time.
I've fixed it for myself, but I can't tell how likely this sort of
thing will happen on other people's systems. It's of course a problem
with whatever I installed back then rather than with your code.
>> export MACOSX_DEPLOYMENT_TARGET=10.4
>
> I can't reproduce this with the CVS trunk HEAD. What I did was:
>
> mkdir emacs-ns-i386-10.4
> cd emacs-ns-i386-10.4
> MACOSX_DEPLOYMENT_TARGET=10.4 CC='gcc -arch i386' ../emacs/
> configure --with-ns
> MACOSX_DEPLOYMENT_TARGET=10.4 make install
>
> The resulting binary runs on both 10.5 and 10.4. You can check which
> object uses _fdopen$UNIX2003 by running "nm -A src/*.o | grep fdopen".
> Or maybe Emacs is unconsciously linked with some external libraries?
That brings up charset.o, lread.o and term.o.
Well, I did a "make clean" and started from scratch with the 10.4
deployment target, and the results run fine on 10.5.
Thanks
- D
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-01 17:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-31 10:36 Compiling Emacs on Mac OS X 10.6 Snow Leopard YAMAMOTO Mitsuharu
2009-08-31 14:40 ` Stefan Monnier
2009-08-31 17:50 ` David Reitter
2009-09-01 5:24 ` YAMAMOTO Mitsuharu
2009-09-01 17:35 ` David Reitter
2009-08-31 18:02 ` CHENG Gao
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.