Google

Michael L. Love/proclus/GNU-Darwin link block

Related social networking sites that might be lesser known

status and microblogs

  • proclus - FriendFeed
  • hi5 - Michael-L Love
  • Michael L. Love (proclus) - Identi.ca
  • proclus/Michael L. Love on status.net
  • proclus « koornk
  • Michael L. Love/proclus/GNU-Darwin on hellotxt
  • ZooLoo - proclus.zooloo.com - Graffiti
  • eYari | Michael L. Love | Activity
  • Michael L. Love/proclus/GNU-Darwin on myspace
  • proclus/Michael L. Love on Jaikus
  • Michael L. Love on youare.com
  • Michael L. Love/proclus/GNU-Darwin on Ning Network
  • blogs

  • Michael L. Love/proclus/GNU-Darwin on LiveJournal
  • Michael L. Love/proclus/GNU-Darwin tumblr blog
  • Michael L. Love/proclus/GNU-Darwin on Xanga
  • Michael L. Love: proclus on Blogger
  • Michael L. Love's Site - Michael L. Love on Multiply
  • proclus on Hatena
  • bookmark sites

  • gnudarwin's favorite websites - StumbleUpon
  • Michael L. Love's links on Netlog
  • Michael L. Love's links on digg
  • Michael L. Love's links on reddit
  • Gravee - Michael L. Love's Bookmarks on Gravee
  • follow us: distro feeds:
    molecules feeds: GNU-Darwin Action blog feeds:


    Darwin Porting Notes

    Dr. Michael L. Love
    updated Thu Oct 25 20:51:08 EDT 2001

    Warning: These instructions are still a work in progress and may contain inaccuracies or omissions. Be sure to read the APSL and the GPL, so that you will know your rights. Send any email regarding this document to proclus@gnu-darwin.org (Dr. Michael Love). Please remember that we are in alpha, so this procedure is for the adventurous. Almost all the packages work (to some degree of "work" :-), but there are still many problems. Join the project, if you want them fixed!

    There are several routine steps that everyone who is porting software to Darwin should know:

    1. Configure, Make, etc.

      To configure under Darwin, you usually have to type ./configure ppc.

    2. Add Users

      Some programs require the addition of specific users, such as man, news, games, cyrus, etc, in order to install correctly. A variation of the net installer script is useful for adding users.

      Check it out, and adapt it to your needs. These users typically do not require home directories, and ideally, nologin should be set (or a very obscure passwd). Sometimes you can edit /etc/mtree/* to get around this problem, but that does not work for every case.
    3. Shims

      Occasionally, ports require the addition of shims (aka stubs), which can be compiled into your program. I have a shim collection at http://www.gnu-darwin.org/shims/. Some of these are terrible hacks or quite obsolete, so if you have shims you would like to contribute, please do!

    4. Enabling pthread

      Pthreading (POSIX threading) is good, because it makes some programs go faster. On Darwin, pthread does not reside in a library, but is actually part of the operating system.

      Certain programs don't recognize, however, that Darwin has some pthread awareness. There might be a line in the ./configure file that reads something like this:

      libs="-pthread"

      Remove -pthread from that line. When you configure, the program will say pthread... yes.

      Later, you might run into problems, because not all of the pthread calls are implemented yet. If this happens, you can put -pthread back in the ./configure file and reconfigure without pthreading. We can always turn pthreading back on when the needed support is ready...

    5. Repair libraries

      If you get a message about an undefined symbol (e.g., "/usr/bin/ld: Undefined symbols: __Xdebug"), you can try the following procedure, but use care. You don't want to mess up your libraries! I sometimes use grep to test the archives, but that is not actually the correct method. Here it is anyway. I'm sure that someone will clue me in at some point...

      % grep __Xdebug /usr/X11R6/lib/*.a

      Let's say it returns the result "Binary file /usr/X11R6/lib/libX11.a matches", suggesting that there might be something wrong with libX11. If so, try this:

      % su root
      # ranlib -s /usr/X11R6/lib/libX11.a

      or this:

      # ranlib -c /usr/X11R6/lib/libX11.a

      If those don't work, check the ar man page for how to delete possible empty archives from libX11. I believe that the syntax would be something like this:

      # ar -d /usr/X11R6/lib/libX11.a empty_archive_needs_deleting.o

      Most likely, you will have to run another ranlib command after running ar. This procedure only works if the desired symbol is present in a given library, but the library is not indexed right for some reason.

      Later, when you are confident with this procedure, you can use ar and ranlib to patch shims into your libraries. It is very convenient.

    6. Links

      In order to get some programs compiling, it is convenient to make a few symbolic links.

      # ln -s /usr/bin/cc /usr/local/bin/gcc
      # ln -s /usr/bin/c++ /usr/local/bin/g++
      # ln -s /usr/bin/cc /usr/bin/gcc
      # ln -s /usr/bin/c++ /usr/bin/g++
      # ln -s /usr/bin/install /usr/bin/install-info
    7. Finding .h files

      Read the locate man page, then use locate to find .h files that appear to be missing. Check your -I statements to be sure the correct include directories are used. If this doesn't work, then get your missing .h files from Apple's Darwin CVS or from the FreeBSD distribution.

    8. Upgrading your development tools

      If you still have problems, consider upgrading your development tools (by CVS, from Apple's Darwin page). O'Reilly has a guide for doing this under OSX:

      http://www.oreillynet.com/pub/a/network/2000/12/15/osx_dev.html
    9. Dummying missing libraries

      You can use file links as shown above to let libraries stand in for missing ones. Here are some examples:

      # ln -s /usr/include/limits.h /usr/local/include/values.h
      # touch /usr/include/malloc.h
      # echo "dumdum_fun(){}" >the.c
      # cc -c the.c
      # ar ur /usr/lib/libcompat.a the.o
      # ranlib /usr/lib/libcompat.a

      I leave it as an exercise to produce similar results for "-lc", "-lg++", -lpthread", and so on, if you choose.

    10. Use switches

      For example, the definition of sys_errlist is a common problem that can be overcome with a switch. Edit the code around line 265 of /usr/include/stdio.h so that it looks like this:

      #ifdef mygnudarwindef
      extern __const char *__const sys_errlist[];
      #endif

      A similar switch can be installed for the bzero definition, if that gives you problems. When you want it to go back to the normal definition, change the ifdef to ifndef.

      Switching is a fine strategy for high throughput porting and bootstrapping the ports tree. On the other hand, if you are interested in seeing your favorite programs patched for Darwin, install Darwin switches in the source code of the port and send patch files to the package maintainers. In this way, you will be contributing to the improvement of free software, and the whole community will benefit.

    11. If you still have questions, try posting a message to the one of the discussion forums.

          http://lists.sourceforge.net/lists/listinfo/gnu-darwin-ports
          GNU-Darwin-ports for discussion of the GNU-Darwin porting engine.

          http://lists.sourceforge.net/lists/listinfo/gnu-darwin-distribution
          Using The GNU-Darwin Distribution

        Once you get past a certain point, you will have added enough infrastructure to handle most situations. Porting will go much faster then.

        Thank you for reading these tips. It is important that we are all on the same page, and that we keep the project goals in mind as we do the ports.