OpenCores
Issue List
Patch or1ksim to build on Mac OS X (Snow Leopard) #75
Closed mark.jarvin opened this issue over 14 years ago
mark.jarvin commented over 14 years ago

There are a few minor issues that prevent or1ksim from building on Mac OS X; the following patch should resolve them.

Index: configure.ac

--- configure.ac (revision 59) +++ configure.ac (working copy) @@ -137,6 +137,8 @@

check for GNU readline

AC_CHECK_LIB(readline, add_history) +# Not all versions of readline have rl_event_hook (e.g., Mac OS X) +AC_CHECK_DECLS(rl_event_hook, [], [], #include <readline/readline.h>)

yuck

case "$host_os" in

Index: sim-cmd.c

--- sim-cmd.c (revision 59) +++ sim-cmd.c (working copy) @@ -837,8 +837,10 @@ / Tell the completer that we want a crack first. / rl_attempted_completion_function = sim_completion;

+#if HAVE_DECL_RL_EVENT_HOOK / Handle the gdb socket while waiting for input / rl_event_hook = check_gdb_comm; +#endif }

/* Attempt to complete on the contents of TEXT. START and END bound the

Index: peripheral/atadevice.c

--- peripheral/atadevice.c (revision 59) +++ peripheral/atadevice.c (working copy) @@ -30,8 +30,16 @@ #include "port.h"

/ System includes / +#ifdef APPLE +#include <libkern/OSByteOrder.h> +#define bswap_16(x) OSSwapInt16(x) +#define bswap_32(x) OSSwapInt32(x) +#define bswap_64(x) OSSwapInt64(x) +#else #include <byteswap.h> +#endif

+ / Package includes / #include "atadevice.h" #include "atadevice-cmdi.h"

Index: port/strndup.c

--- port/strndup.c (revision 59) +++ port/strndup.c (working copy) @@ -29,7 +29,8 @@

#ifndef HAVE_STRNDUP

+/ the definition of size_t is provided in stddef.h / +#include <stddef.h> / Taken from glibc / char strndup (const char s, size_t n)

mark.jarvin commented over 14 years ago

Er... formatting didn't come through. At any rate, the patch is clean if you "View source" on the page. I've uploaded a copy to http://jarv.in/or1ksim.svn.min.patch, just in case.

jeremybennett commented over 14 years ago
<p> Hi Mark, </p> <p> Thanks for this. I'll get your patch uploaded to the website, so it's immediately available. I'll also update the Or1ksim page with information about the patch. May take a day or two. </p> <p> When I do an update of Or1ksim, I'll incorporate these changes. I have no way to test on Mac OS X, so I hope you'll be able to test things when we get to that stage. I'll leave the bug open until then. </p> <p> Formatting of bugs is a pain in the neck. You have to do them explicitly as HTML. Here is what you submitted for the record: </p> <pre> Index: configure.ac =================================================================== --- configure.ac (revision 59) +++ configure.ac (working copy) @@ -137,6 +137,8 @@

check for GNU readline

AC_CHECK_LIB(readline, add_history) +# Not all versions of readline have rl_event_hook (e.g., Mac OS X) +AC_CHECK_DECLS(rl_event_hook, [], [], #include <readline/readline.h>)

yuck

case "$host_os" in

Index: sim-cmd.c

--- sim-cmd.c (revision 59) +++ sim-cmd.c (working copy) @@ -837,8 +837,10 @@ / Tell the completer that we want a crack first. / rl_attempted_completion_function = sim_completion;

+#if HAVE_DECL_RL_EVENT_HOOK / Handle the gdb socket while waiting for input / rl_event_hook = check_gdb_comm; +#endif }

/* Attempt to complete on the contents of TEXT. START and END bound the

Index: peripheral/atadevice.c

--- peripheral/atadevice.c (revision 59) +++ peripheral/atadevice.c (working copy) @@ -30,8 +30,16 @@ #include "port.h"

/ System includes / +#ifdef APPLE +#include <libkern/OSByteOrder.h>

+#define bswap_16(x) OSSwapInt16(x) +#define bswap_32(x) OSSwapInt32(x) +#define bswap_64(x) OSSwapInt64(x) +#else #include <byteswap.h> +#endif

+ / Package includes / #include "atadevice.h" #include "atadevice-cmdi.h"

Index: port/strndup.c

--- port/strndup.c (revision 59) +++ port/strndup.c (working copy) @@ -29,7 +29,8 @@

#ifndef HAVE_STRNDUP

+/ the definition of size_t is provided in stddef.h / +#include <stddef.h> / Taken from glibc / char strndup (const char s, size_t n)

</pre> <p> Jeremy </p> <p> -- <br /> Tel: +44 (1590) 610184<br /> Cell: +44 (7970) 676050<br /> SkypeID: jeremybennett<br /> Email: <a href="mailto:jeremy.bennett@embecosm.com">jeremy.bennett@embecosm.com</a><br /> Web: <a href="http://www.embecosm.com">www.embecosm.com</a> </p>
jeremybennett was assigned over 14 years ago
jeremybennett commented over 14 years ago
<p> I've applied your patch to the Or1ksim SVN tree and also provided a patch for the Or1ksim 0.3.0 distribution on the downloads page. </p>
mark.jarvin commented over 14 years ago

Thanks for applying the patch. The code more-or-less builds cleanly from SVN on my Macbook (10.6.2). Presently, I have to execute the following to get the build to complete:

<pre> svn co --username=${OCUSER} http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1ksim cd or1ksim automake --add-missing autoreconf ./configure --target=or32-elf --prefix=${OR32TOOLS}/or32-elf sed -i.bak -e's/^ECHO=/echo=/' libtool make all install </pre>
jeremybennett commented over 14 years ago
<p> Hi Mark, </p> <p> Thanks for the update. The <em>autobuild</em> structure for Or1ksim needs reviewing (see your bug <a href="http://opencores.org/bug,view,1678">Move/remove or1ksim/downloads and or1ksim/build</a>. There seem to be some dependencies on which version of <em>autobuild</em> is being used. I did the 0.3.0 work with Fedora 9, which uses <em>autoconf</em> 2.61, <em>automake</em> 1.10.1 and <em>libtool</em> 1.5.24. </p> <p> I'll try to resolve this with the next release of Or1ksim. </p> <p> Jeremy </p> <p> -- <br /> Tel: +44 (1590) 610184<br /> Cell: +44 (7970) 676050<br /> SkypeID: jeremybennett<br /> Email: <a href="mailto:jeremy.bennett@embecosm.com">jeremy.bennett@embecosm.com</a><br /> Web: <a href="http://www.embecosm.com">www.embecosm.com</a> </p>
jeremybennett commented about 14 years ago
<p> Patches committed to SVN tree. </p>
jeremybennett closed this about 14 years ago

Assignee
jeremybennett
Labels
Request