Openmoko under QEMU on MacOSX

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(catspec)
m (-Guides)
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
Warning: this is draft!
+
= Making developers image =
 +
Optional: Install python2.5 and py25-psyco from MacPorts then create a symlink from /opt/local/bin/python2.5 to /usr/bin/python
  
I try to put here my notes on setting up OpenMoko environment (Qemu and MokoMakefile) on Mac OS X.
+
<pre>
 +
make openmoko-devel-image
 +
</pre>
  
= Introduction =
+
I ended up with:
  
Some time ago I ask if anyone has ever set up OpenMoko environment on MacOS X. No one has answered that he did but several people were interested. So I deceided to wrote some directions on how to do that.  
+
<pre>
 +
ERROR: Error in executing: /Volumes/OE/moko/openembedded/packages/quilt/quilt-native_0.45.bb
 +
ERROR: Exception:exceptions.UnboundLocalError Message:local variable 'md5data' referenced before assignment
 +
</pre>
  
As for now I was not successful but I am still trying ;)
+
make a script named md5sum that lives in /bin containing
 +
<pre>
 +
#!/bin/sh
 +
echo `/sbin/md5 $1` | awk {'print $4'}
 +
</pre>
  
= Setting up environment =
+
Then I got
  
== Prequisites ==
+
<pre>
 
+
| checking for sed... /usr/bin/sed
Install fink and darwinports (both have neccesary packages).
+
| checking whether /usr/bin/sed understands (foo|bar)... no
 +
| configure: error:
 +
| Sorry, you have a version of sed which doesn't understand constructs
 +
| of the form (foo|bar). quilt needs it.  If you have access to
 +
| a version of sed which does understand such constructs, you can supply
 +
| its path with the '--with-sed=' option.
 +
</pre>
  
Follow instructions on:
+
Install GNU sed from MacPorts
http://www.openembedded.org/wiki/BuildOnOSX
+
to set up OE environment.
+
 
+
It is neccessary to create new disk image, just as BuildOnOSX says.
+
 
+
If you're compiilng something connected with X11 be sure to install X11devel package from your MacOS X CD1.
+
 
+
You can get mentioned packages using darwinports:
+
  
 
<pre>
 
<pre>
sudo port install quilt
+
$ port install gsed
sudo port install py-psyco
+
sudo port install cogito
+
sudo port install gawk
+
fink install sed
+
 
</pre>
 
</pre>
  
Then get Q[kju] project: http://www.kju-app.org/proj/wiki/CompilingQ into /Volumes/OE/Q but do not compile it yet (run only "prepare the sources"). This will be needed for compiling Neo1973 emulator.
+
If you get:
 
+
Set up environment as described in MokoMakefile:
+
  
 
<pre>
 
<pre>
cd /Volumes/OE
+
| Making install in tests
mkdir moko; cd moko
+
| make[3]: Nothing to be done for `install-exec-am'.
wget http://www.rwhitby.net/files/openmoko/Makefile
+
| make[3]: Nothing to be done for `install-data-am'.
 +
| cp: illegal option -- t
 +
| usage: cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file target_file
 +
|        cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file ... target_directory
 +
</pre>
  
make setup
+
Apply this patch:
 +
<pre>
 +
### Fix cp command ###
 +
perl -pi -e 's,cp -fpPR -t "$to" "$from"/*,cp -fpPR "$from"/* "$to",g'
 
</pre>
 
</pre>
  
= Making developers image =
+
I then got:
 
+
 
<pre>
 
<pre>
make openmoko-devel-image
 
 
</pre>
 
</pre>
  
I had problems with bitbake - it does not run correctly with psyco (I got "Illegal instruction error" and make exited with error 132)  so I had to disable it: I run bitbake  -d openmoko-devel-image in MokoMakefile.
+
I had to add:
 
+
Also, I ended up with:  
+
  
 
<pre>
 
<pre>
ERROR: Error in executing: /Volumes/OE/moko/openembedded/packages/quilt/quilt-native_0.45.bb
+
#ifndef HAVE_ENVIRON_DECL
ERROR: Exception:exceptions.UnboundLocalError Message:local variable 'md5data' referenced before assignment
+
# ifdef __APPLE__
 +
# include <crt_externs.h>
 +
# define environ (*_NSGetEnviron())
 +
# else
 +
extern char **environ;
 +
# endif
 +
#endif
 
</pre>
 
</pre>
  
I found out that I did not have md5sum which is used by bitbake. I found it in testutils packages from fink. Installing it did not help... I got pissed and temporarily changed
+
to the following files build/tmp/work/i386-darwin/gettext-native-0.14.1-r8/gettext-0.14.1/gettext-tools/lib/execute.c , pipe-bidi.c, pipe-in.c, pipe-out.c
  
vim /Volumes/OE/moko/bitbake/lib/bb/fetch/wget.py +114
+
Next I had to add information for i386-darwin to openembedded/classes/siteinfo.bbclass, I copied the powerpc-darwin info.
  
so it look like this
+
Now you should have:
  
 
<pre>
 
<pre>
#          supposedly complete.. write out md5sum
+
| libbb.h:53:22: error: features.h: No such file or directory
            md5data = ""
+
            if bb.which(data.getVar('PATH', d), 'md5sum'):
+
                try:
+
                    md5pipe = os.popen('md5sum ' + dl)
+
                    md5data = (md5pipe.readline().split() or [ "" ])[0]
+
                    md5pipe.close()
+
                except OSError:
+
                    md5data = ""
+
 
+
            # verify the md5sum
+
            #if not verify_md5sum(wanted_md5sum, md5data):
+
            #    raise MD5SumError(uri)
+
 
</pre>
 
</pre>
  
As you can see there I disabled md5sum verification.
+
while compiling ipkg. Run following patches in folder:
 
+
If you have error like this
+
  
 
<pre>
 
<pre>
 
+
cd /Volumes/OE/moko/build/tmp/work/i386-darwin/ipkg-native-0.99.163-r1/ipkg-0.99.163/
| checking for sed... /usr/bin/sed
+
| checking whether /usr/bin/sed understands (foo|bar)... no
+
| configure: error:
+
| Sorry, you have a version of sed which doesn't understand constructs
+
| of the form (foo|bar).  quilt needs it.  If you have access to
+
| a version of sed which does understand such constructs, you can supply
+
| its path with the '--with-sed=' option.
+
 
</pre>
 
</pre>
  
 +
apply this patch
  
Install GNU sed from fink.
+
<pre>
 +
  perl -pi -e 's,struct errlist\*,extern struct errlist\*,g' ipkg.h.in
 +
  perl -pi -e 's,#include "libbb.h",#include "libbb.h"\nstruct errlist\* error_list;,g' libbb/error_msg.c
  
Now I have:
+
  ### fix endian.h include in md5.c
 +
  perl -pi -e 's,#include \<endian.h\>,#ifndef __APPLE__\n# include \<endian.h\>\n#else\n# include \<machine/endian.h\>\n#endif,g' md5.c
  
<pre>
+
  ### fix vfs.h include in ipkg_utils.c
| libbb.h:53:22: error: features.h: No such file or directory
+
  perl -pi -e 's,#include \<sys/vfs.h\>,#ifndef __APPLE__\n# include \<sys/vfs.h\>\n#else\n# include \<sys/mount.h\>\n#endif,g' ipkg_utils.c
</pre>
+
  
while compiling ipkg
+
  ### remove un-needed features.h include from libbb/libbb.h
 +
  perl -pi -e 's,#include \<features.h\>,#ifndef __APPLE__\n# include \<features.h\>\n#endif,g' libbb/libbb.h
  
= Patching qemu-neo1973 =
+
  ### dirname already defined OS X
 +
  perl -pi -e 's,char \*dirname \(char \*path\);,#ifndef __APPLE__\nchar \*dirname \(char \*path\);\n#endif,g' libbb/libbb.h
  
The main idea is to get patches for gcc-4.x from Q project and apply it to qemu-neo1973 branch. I'm still working on it.
+
  ### Use fink dir for etc
 +
  perl -pi -e 's,/etc,%p/etc,g' args.h
  
= Building emulator =
+
  ### Add define for strndup
 +
  perl -pi -e "s,#include \"xsystem.h\",#include \"xsystem.h\"\n\n#ifndef HAVE_STRNDUP\nstatic void\*\nstrndup \(const char \*src\, size_t n\)\n\{\n      size_t i;\n      char \*dst;\n\n      if \(src == NULL\)\n              return NULL;\n\n      dst = \(char*\) malloc \(n + 1\);\n      if \(dst != NULL\) \{\n              for \(i = 0; i \< n \&\& src\[i\]; i++\)\n                      dst\[i\] = src\[i\];\n              dst\[i\] = '\\\0';\n      \}\n\n      return dst;\n\}\n#endif,g" ipkg_conf.c
 +
</pre>
  
TODO
+
Now I get:
 +
 
 +
<pre>
 +
 
 +
| Extracting /Volumes/OE/moko/build/tmp/work/i386-darwin/ipkg-native-0.99.163-r1/ipkg-0.99.163/libbb/.libs/libbb.a
 +
| gcc -dynamiclib ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/libipkg.0.0.0.dylib  .libs/libipkg_la-args.o .libs/libipkg_la-libipkg.o .libs/libipkg_la-user.o .libs/libipkg_la-ipkg_cmd.o .libs/libipkg_la-ipkg_configure.o .libs/libipkg_la-ipkg_download.o .libs/libipkg_la-ipkg_install.o .libs/libipkg_la-ipkg_upgrade.o .libs/libipkg_la-ipkg_remove.o .libs/libipkg_la-ipkg_conf.o .libs/libipkg_la-ipkg_utils.o .libs/libipkg_la-pkg.o .libs/libipkg_la-pkg_depends.o .libs/libipkg_la-pkg_extract.o .libs/libipkg_la-hash_table.o .libs/libipkg_la-pkg_hash.o .libs/libipkg_la-pkg_parse.o .libs/libipkg_la-pkg_vec.o .libs/libipkg_la-file_util.o .libs/libipkg_la-ipkg_message.o .libs/libipkg_la-md5.o .libs/libipkg_la-sprintf_alloc.o .libs/libipkg_la-str_util.o .libs/libipkg_la-xregex.o .libs/libipkg_la-xsystem.o .libs/libipkg_la-conffile.o .libs/libipkg_la-conffile_list.o .libs/libipkg_la-nv_pair.o .libs/libipkg_la-nv_pair_list.o .libs/libipkg_la-pkg_dest.o .libs/libipkg_la-pkg_dest_list.o .libs/libipkg_la-pkg_src.o .libs/libipkg_la-pkg_src_list.o .libs/libipkg_la-str_list.o .libs/libipkg_la-void_list.o  .libs/libipkg.lax/libbb.a/libbb_la-all_read.o .libs/libipkg.lax/libbb.a/libbb_la-ask_confirmation.o .libs/libipkg.lax/libbb.a/libbb_la-concat_path_file.o .libs/libipkg.lax/libbb.a/libbb_la-copy_file.o .libs/libipkg.lax/libbb.a/libbb_la-copy_file_chunk.o .libs/libipkg.lax/libbb.a/libbb_la-error_msg.o .libs/libipkg.lax/libbb.a/libbb_la-error_msg_and_die.o .libs/libipkg.lax/libbb.a/libbb_la-gz_open.o .libs/libipkg.lax/libbb.a/libbb_la-last_char_is.o .libs/libipkg.lax/libbb.a/libbb_la-make_directory.o .libs/libipkg.lax/libbb.a/libbb_la-messages.o .libs/libipkg.lax/libbb.a/libbb_la-mode_string.o .libs/libipkg.lax/libbb.a/libbb_la-parse_mode.o .libs/libipkg.lax/libbb.a/libbb_la-perror_msg.o .libs/libipkg.lax/libbb.a/libbb_la-perror_msg_and_die.o .libs/libipkg.lax/libbb.a/libbb_la-safe_strncpy.o .libs/libipkg.lax/libbb.a/libbb_la-time_string.o .libs/libipkg.lax/libbb.a/libbb_la-unarchive.o .libs/libipkg.lax/libbb.a/libbb_la-unzip.o .libs/libipkg.lax/libbb.a/libbb_la-verror_msg.o .libs/libipkg.lax/libbb.a/libbb_la-vperror_msg.o .libs/libipkg.lax/libbb.a/libbb_la-wfopen.o .libs/libipkg.lax/libbb.a/libbb_la-xfuncs.o .libs/libipkg.lax/libbb.a/libbb_la-xreadlink.o  -L/Volumes/OE/moko/build/tmp/staging/i386-darwin/lib  -install_name  /Volumes/OE/moko/build/tmp/staging/i386-darwin/lib/libipkg.0.dylib -Wl,-compatibility_version -Wl,1 -Wl,-current_version -Wl,1.0
 +
| ld: multiple definitions of symbol _error_list
 +
| .libs/libipkg_la-args.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-libipkg.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-user.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_cmd.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_configure.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_download.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_install.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_upgrade.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_remove.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_conf.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_utils.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_depends.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_extract.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-hash_table.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_hash.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_parse.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_vec.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-file_util.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-ipkg_message.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-sprintf_alloc.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-str_util.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-xregex.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-xsystem.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-conffile.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-conffile_list.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-nv_pair.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-nv_pair_list.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_dest.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_dest_list.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_src.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-pkg_src_list.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-str_list.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg_la-void_list.o definition of _error_list in section (__DATA,__common)
 +
| .libs/libipkg.lax/libbb.a/libbb_la-error_msg.o definition of _error_list in section (__DATA,__common)
 +
| /usr/bin/libtool: internal link edit command failed
 +
| make[3]: *** [libipkg.la] Error 1
 +
| make[2]: *** [all-recursive] Error 1
 +
| make[1]: *** [all] Error 2
 +
| FATAL: oe_runmake failed
 +
NOTE: Task failed: /Volumes/OE/moko/build/tmp/work/i386-darwin/ipkg-native-0.99.163-r1/temp/log.do_compile.16640
 +
NOTE: package ipkg-native-0.99.163-r1: task do_compile: failed
 +
ERROR: TaskFailed event exception, aborting
 +
NOTE: package ipkg-native-0.99.163: failed
 +
ERROR: Build of openmoko-devel-image failed
 +
make: *** [openmoko-devel-image] Error 1
 +
</pre>
  
[[Category:Developer software]]
+
[[Category:Emulation]]

Latest revision as of 21:50, 12 September 2008

[edit] Making developers image

Optional: Install python2.5 and py25-psyco from MacPorts then create a symlink from /opt/local/bin/python2.5 to /usr/bin/python

make openmoko-devel-image

I ended up with:

ERROR: Error in executing: /Volumes/OE/moko/openembedded/packages/quilt/quilt-native_0.45.bb
ERROR: Exception:exceptions.UnboundLocalError Message:local variable 'md5data' referenced before assignment

make a script named md5sum that lives in /bin containing

#!/bin/sh
echo `/sbin/md5 $1` | awk {'print $4'}

Then I got

| checking for sed... /usr/bin/sed
| checking whether /usr/bin/sed understands (foo|bar)... no
| configure: error:
| Sorry, you have a version of sed which doesn't understand constructs
| of the form (foo|bar).  quilt needs it.  If you have access to
| a version of sed which does understand such constructs, you can supply
| its path with the '--with-sed=' option.

Install GNU sed from MacPorts

$ port install gsed

If you get:

| Making install in tests
| make[3]: Nothing to be done for `install-exec-am'.
| make[3]: Nothing to be done for `install-data-am'.
| cp: illegal option -- t
| usage: cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file target_file
|        cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file ... target_directory

Apply this patch:

### Fix cp command ### 
perl -pi -e 's,cp -fpPR -t "$to" "$from"/*,cp -fpPR "$from"/* "$to",g'

I then got:


I had to add:

#ifndef HAVE_ENVIRON_DECL
# ifdef __APPLE__
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
# else
extern char **environ;
# endif
#endif

to the following files build/tmp/work/i386-darwin/gettext-native-0.14.1-r8/gettext-0.14.1/gettext-tools/lib/execute.c , pipe-bidi.c, pipe-in.c, pipe-out.c

Next I had to add information for i386-darwin to openembedded/classes/siteinfo.bbclass, I copied the powerpc-darwin info.

Now you should have:

| libbb.h:53:22: error: features.h: No such file or directory

while compiling ipkg. Run following patches in folder:

cd /Volumes/OE/moko/build/tmp/work/i386-darwin/ipkg-native-0.99.163-r1/ipkg-0.99.163/

apply this patch

  perl -pi -e 's,struct errlist\*,extern struct errlist\*,g' ipkg.h.in
  perl -pi -e 's,#include "libbb.h",#include "libbb.h"\nstruct errlist\* error_list;,g' libbb/error_msg.c

  ### fix endian.h include in md5.c
  perl -pi -e 's,#include \<endian.h\>,#ifndef __APPLE__\n# include \<endian.h\>\n#else\n# include \<machine/endian.h\>\n#endif,g' md5.c

  ### fix vfs.h include in ipkg_utils.c
  perl -pi -e 's,#include \<sys/vfs.h\>,#ifndef __APPLE__\n# include \<sys/vfs.h\>\n#else\n# include \<sys/mount.h\>\n#endif,g' ipkg_utils.c

  ### remove un-needed features.h include from libbb/libbb.h
  perl -pi -e 's,#include \<features.h\>,#ifndef __APPLE__\n# include \<features.h\>\n#endif,g' libbb/libbb.h

  ### dirname already defined OS X
  perl -pi -e 's,char \*dirname \(char \*path\);,#ifndef __APPLE__\nchar \*dirname \(char \*path\);\n#endif,g' libbb/libbb.h

  ### Use fink dir for etc
  perl -pi -e 's,/etc,%p/etc,g' args.h

  ### Add define for strndup
  perl -pi -e "s,#include \"xsystem.h\",#include \"xsystem.h\"\n\n#ifndef HAVE_STRNDUP\nstatic void\*\nstrndup \(const char \*src\, size_t n\)\n\{\n       size_t i;\n       char \*dst;\n\n       if \(src == NULL\)\n               return NULL;\n\n       dst = \(char*\) malloc \(n + 1\);\n       if \(dst != NULL\) \{\n               for \(i = 0; i \< n \&\& src\[i\]; i++\)\n                       dst\[i\] = src\[i\];\n               dst\[i\] = '\\\0';\n       \}\n\n       return dst;\n\}\n#endif,g" ipkg_conf.c

Now I get:


| Extracting /Volumes/OE/moko/build/tmp/work/i386-darwin/ipkg-native-0.99.163-r1/ipkg-0.99.163/libbb/.libs/libbb.a
| gcc -dynamiclib ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/libipkg.0.0.0.dylib  .libs/libipkg_la-args.o .libs/libipkg_la-libipkg.o .libs/libipkg_la-user.o .libs/libipkg_la-ipkg_cmd.o .libs/libipkg_la-ipkg_configure.o .libs/libipkg_la-ipkg_download.o .libs/libipkg_la-ipkg_install.o .libs/libipkg_la-ipkg_upgrade.o .libs/libipkg_la-ipkg_remove.o .libs/libipkg_la-ipkg_conf.o .libs/libipkg_la-ipkg_utils.o .libs/libipkg_la-pkg.o .libs/libipkg_la-pkg_depends.o .libs/libipkg_la-pkg_extract.o .libs/libipkg_la-hash_table.o .libs/libipkg_la-pkg_hash.o .libs/libipkg_la-pkg_parse.o .libs/libipkg_la-pkg_vec.o .libs/libipkg_la-file_util.o .libs/libipkg_la-ipkg_message.o .libs/libipkg_la-md5.o .libs/libipkg_la-sprintf_alloc.o .libs/libipkg_la-str_util.o .libs/libipkg_la-xregex.o .libs/libipkg_la-xsystem.o .libs/libipkg_la-conffile.o .libs/libipkg_la-conffile_list.o .libs/libipkg_la-nv_pair.o .libs/libipkg_la-nv_pair_list.o .libs/libipkg_la-pkg_dest.o .libs/libipkg_la-pkg_dest_list.o .libs/libipkg_la-pkg_src.o .libs/libipkg_la-pkg_src_list.o .libs/libipkg_la-str_list.o .libs/libipkg_la-void_list.o  .libs/libipkg.lax/libbb.a/libbb_la-all_read.o .libs/libipkg.lax/libbb.a/libbb_la-ask_confirmation.o .libs/libipkg.lax/libbb.a/libbb_la-concat_path_file.o .libs/libipkg.lax/libbb.a/libbb_la-copy_file.o .libs/libipkg.lax/libbb.a/libbb_la-copy_file_chunk.o .libs/libipkg.lax/libbb.a/libbb_la-error_msg.o .libs/libipkg.lax/libbb.a/libbb_la-error_msg_and_die.o .libs/libipkg.lax/libbb.a/libbb_la-gz_open.o .libs/libipkg.lax/libbb.a/libbb_la-last_char_is.o .libs/libipkg.lax/libbb.a/libbb_la-make_directory.o .libs/libipkg.lax/libbb.a/libbb_la-messages.o .libs/libipkg.lax/libbb.a/libbb_la-mode_string.o .libs/libipkg.lax/libbb.a/libbb_la-parse_mode.o .libs/libipkg.lax/libbb.a/libbb_la-perror_msg.o .libs/libipkg.lax/libbb.a/libbb_la-perror_msg_and_die.o .libs/libipkg.lax/libbb.a/libbb_la-safe_strncpy.o .libs/libipkg.lax/libbb.a/libbb_la-time_string.o .libs/libipkg.lax/libbb.a/libbb_la-unarchive.o .libs/libipkg.lax/libbb.a/libbb_la-unzip.o .libs/libipkg.lax/libbb.a/libbb_la-verror_msg.o .libs/libipkg.lax/libbb.a/libbb_la-vperror_msg.o .libs/libipkg.lax/libbb.a/libbb_la-wfopen.o .libs/libipkg.lax/libbb.a/libbb_la-xfuncs.o .libs/libipkg.lax/libbb.a/libbb_la-xreadlink.o   -L/Volumes/OE/moko/build/tmp/staging/i386-darwin/lib  -install_name  /Volumes/OE/moko/build/tmp/staging/i386-darwin/lib/libipkg.0.dylib -Wl,-compatibility_version -Wl,1 -Wl,-current_version -Wl,1.0
| ld: multiple definitions of symbol _error_list
| .libs/libipkg_la-args.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-libipkg.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-user.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_cmd.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_configure.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_download.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_install.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_upgrade.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_remove.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_conf.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_utils.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_depends.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_extract.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-hash_table.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_hash.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_parse.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_vec.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-file_util.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-ipkg_message.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-sprintf_alloc.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-str_util.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-xregex.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-xsystem.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-conffile.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-conffile_list.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-nv_pair.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-nv_pair_list.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_dest.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_dest_list.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_src.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-pkg_src_list.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-str_list.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg_la-void_list.o definition of _error_list in section (__DATA,__common)
| .libs/libipkg.lax/libbb.a/libbb_la-error_msg.o definition of _error_list in section (__DATA,__common)
| /usr/bin/libtool: internal link edit command failed
| make[3]: *** [libipkg.la] Error 1
| make[2]: *** [all-recursive] Error 1
| make[1]: *** [all] Error 2
| FATAL: oe_runmake failed
NOTE: Task failed: /Volumes/OE/moko/build/tmp/work/i386-darwin/ipkg-native-0.99.163-r1/temp/log.do_compile.16640
NOTE: package ipkg-native-0.99.163-r1: task do_compile: failed
ERROR: TaskFailed event exception, aborting
NOTE: package ipkg-native-0.99.163: failed
ERROR: Build of openmoko-devel-image failed
make: *** [openmoko-devel-image] Error 1
Personal tools

Warning: this is draft!

I try to put here my notes on setting up OpenMoko environment (Qemu and MokoMakefile) on Mac OS X.

Introduction

Some time ago I ask if anyone has ever set up OpenMoko environment on MacOS X. No one has answered that he did but several people were interested. So I deceided to wrote some directions on how to do that.

As for now I was not successful but I am still trying ;)

Setting up environment

Prequisites

Install fink and darwinports (both have neccesary packages).

Follow instructions on: http://www.openembedded.org/wiki/BuildOnOSX to set up OE environment.

It is neccessary to create new disk image, just as BuildOnOSX says.

If you're compiilng something connected with X11 be sure to install X11devel package from your MacOS X CD1.

You can get mentioned packages using darwinports:

sudo port install quilt
sudo port install py-psyco
sudo port install cogito
sudo port install gawk
fink install sed

Then get Q[kju] project: http://www.kju-app.org/proj/wiki/CompilingQ into /Volumes/OE/Q but do not compile it yet (run only "prepare the sources"). This will be needed for compiling Neo1973 emulator.

Set up environment as described in MokoMakefile:

cd /Volumes/OE
mkdir moko; cd moko
wget http://www.rwhitby.net/files/openmoko/Makefile

make setup

Making developers image

make openmoko-devel-image

I had problems with bitbake - it does not run correctly with psyco (I got "Illegal instruction error" and make exited with error 132) so I had to disable it: I run bitbake -d openmoko-devel-image in MokoMakefile.

Also, I ended up with:

ERROR: Error in executing: /Volumes/OE/moko/openembedded/packages/quilt/quilt-native_0.45.bb
ERROR: Exception:exceptions.UnboundLocalError Message:local variable 'md5data' referenced before assignment

I found out that I did not have md5sum which is used by bitbake. I found it in testutils packages from fink. Installing it did not help... I got pissed and temporarily changed

vim /Volumes/OE/moko/bitbake/lib/bb/fetch/wget.py +114

so it look like this

#           supposedly complete.. write out md5sum
            md5data = ""
            if bb.which(data.getVar('PATH', d), 'md5sum'):
                try:
                    md5pipe = os.popen('md5sum ' + dl)
                    md5data = (md5pipe.readline().split() or [ "" ])[0]
                    md5pipe.close()
                except OSError:
                    md5data = ""

            # verify the md5sum
            #if not verify_md5sum(wanted_md5sum, md5data):
            #    raise MD5SumError(uri)

As you can see there I disabled md5sum verification.

If you have error like this


| checking for sed... /usr/bin/sed
| checking whether /usr/bin/sed understands (foo|bar)... no
| configure: error:
| Sorry, you have a version of sed which doesn't understand constructs
| of the form (foo|bar).  quilt needs it.  If you have access to
| a version of sed which does understand such constructs, you can supply
| its path with the '--with-sed=' option.


Install GNU sed from fink.

Now I have:

| libbb.h:53:22: error: features.h: No such file or directory

while compiling ipkg

Patching qemu-neo1973

The main idea is to get patches for gcc-4.x from Q project and apply it to qemu-neo1973 branch. I'm still working on it.

Building emulator

TODO