I thought that I would find a sample program to port as an example for this column, but over a weekend, as I downloaded program after program, I was just more and more impressed with the Linux C library as program after program compiled with simple tweaks like changing the Makefile to use gcc instead of cc and changing paths to executables. I finally found a program that might give some people problems porting, an editor called Freyja.
I copied the supplied makefile.unx to Makefile, and edited the Makefile. I changed CFLAGS to -O2 to use the highest level of optimization from GCC, and typed make at the command line. GCC complained that TIOCGETP, TIOCSETP, and RAW were undefined. This means that Freyja is written with BSD in mind. There did not appear to be any #define's that I could make to change Freyja's behavior to SYSV or POSIX, either.
So, following the steps in the GCC-FAQ, I added -I/usr/include/bsd to the CFLAGS line, and -lbsd to the link line (called FXLINK in Freyja for some strange reason; it's usually called LDFLAGS), and ran make again.
That was all that was required to “port” this bsd-oriented program. I had to read the documentation to find out that I needed to call it with the arguments “-kT -s29” to tell it how to write to the screen and read from the keyboard, or that I needed to compile an equivalent change into the resource file that Freyja uses, but it was very simple.
Freyja is written by Craig A. Finseth, and is available via ftp from mail.unet.umn.edu, or if you don't have ftp access, via U.S. mail. Quoting the README:
Diskette: Send the author blank diskettes:
3 1/2" (1.44 MB), or
3 1/2" (720 KB)
and a SASE or enough stamps to cover return postage plus a dollar or so (so that I can buy a diskette mailer). Or you can just send me about US\$5.00 in check, stamp, whatever and I will furnish the diskette(s) and mailer. Non-US people can send me four 1.44 MB 3 1/2" diskettes in lieu of money. (More money is always nice, but please don't feel obligated in any way.)
The address is: Craig Finseth1343 LafondSt. Paul, MN55104, USA
Here's your chance to contribute! If you have difficulties porting a general Un*x application to Linux, please either send email to email@example.com or send snail mail to Programming Tips, Linux Journal, P.O. Box 85867, Seattle, WA 98145-1867, with a description of how to get the program via the internet, or with a copy of the application enclosed on floppy, 150MB QIC tape, or standard DAT, and with a detailed explanation of what you have tried in your attempt to port it, and I may try it myself, especially if it looks like it will make worthwhile material for this column.
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
- RSS Feeds
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Download the Free Red Hat White Paper "Using an Open Source Framework to Catch the Bad Guy"
- Tech Tip: Really Simple HTTP Server with Python
- Roll your own dynamic dns
1 hour 33 min ago
- Please correct the URL for Salt Stack's web site
4 hours 45 min ago
- Android is Linux -- why no better inter-operation
7 hours 30 sec ago
- Connecting Android device to desktop Linux via USB
7 hours 29 min ago
- Find new cell phone and tablet pc
8 hours 27 min ago
9 hours 55 min ago
- Automatically updating Guest Additions
11 hours 4 min ago
- I like your topic on android
11 hours 50 min ago
- This is the easiest tutorial
18 hours 26 min ago
- Ahh, the Koolaid.
1 day 5 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?