Tag Archives: make

Cmake and Scons – Other Ways to Build

A few days ago friend Matthew Fillpot from Linux.com suggested that I write a little something about cmake and scons compiler applications.

I’m familiar with cmake, but I had to do a little reading on scons. Interesting stuff. I’ll briefly introduce you to both of them in this article and leave you with some links to much more detailed information on these alternative building methods. Let’s start off with cmake…

Cmake

Cmake is a cross platform software development tool. Cmake uses native build tools such as make. It’s strength and advantages come in to play in the cross platform environment, where it seriously reduces the complexity of software development and maintenance.

Unlike other similar tools, doesn’t really care about the system you’re attempting to build on. It’s written in C++, so it’ll run on most any modern platform. It uses the native build tools found on that system. Cool, huh? It’s much more versatile than vanilla make, which is limited to the platforms it can build on.

Also, if you’re interested in open source, using cmake to build with will give your code more apparent openness because it will be capable of being built on a variety of systems.

Linux Journal has a somewhat advanced article about cmake entitled Cross-Platform Software Development Using CMake by Andrej Cedilnik. It’s a good read. Also, you can refer to the cmake man page HERE. Give this flexible tool a tryout. It might be something worth having in your toolbox.

=====

Scons

Scons is a unique software construction tool which utilizes Python scripts and modules. This method gives scons powerful capabilities not available to vanilla build tools. You can grab your own copy of scons over at SourceForge. Scons needs Python 1.5.2. However, you don’t have to know how to program in Python to use scons.

Everything you need to know about scons in on the Scons User Guide by Steven Knight. Scons looks pretty interesting. When I get a minute or two, I’m going to download and play around with it. There may be a follow-up to this article sometime in the future. In the meantime, if you’re feeling adventurous, download scons and tinker around a bit.

Until next time, folks…

~Eric

Let’s Play With Tarballs

A tarball is a compressed archive. Usually, a developer will provide his program in this format on his website or one of the third party software sites like SourceForge.

While it’s not normally recommended that you install software this way on your Linux system, sometimes it is necessary. The usual way to install software, of course, would be to utilize your particular distribution’s package management application (e.g., apt-get in Debian or Slackpkg in Slackware). There are inherent risks in installing software from tarballs onto your Linux system, especially if you’re unfamiliar with the developer or his reputation in the Linux community. Beware.

Let’s say you want to install Bill’s Clown Clock, but it’s not available in your distribution’s repositories. You do a search for it on Google and find that Developer Bill has provided a copy on LinuxApps4U’s website, so you surf on over there to check it out. It’s available for download, but… UH-OH! It’s one of those tarball things. How do you handle that? First, you download it to your computer, of course. Now that you have it on your system, you’re going to have to decompress that compressed archive… sorta’ like “unzipping” something using WinZip in MS Windows. Remember that?

Turns out your package that you downloaded is called billscc_v1.4.tar.gz. This is an archive that was created using the gzip archiving application. Great! Now, here’s what you’ll need to do to get that baby installed:

In the command line (c’mon… you didn’t think I was going to do the GUI thing, did ya’?)…

1) You’ll need to unpack the archive:

$ tar -xzvf billscc_v1.4.tar.gz

2) Navigate to within the new decompressed directory:

$ cd billscc_v1.4

Most developers will include a configure script in the package.

3) You’ll need to run that script:

$ ./configure

4) Now you’ll need make, make install, and make clean:

$ make (actually generates executables and other non-source files – GNU Make)

as root # make install (intalls the app globally for all users on the system)

# make clean (cleans refuse left from the compiling of the app)

If all went well, you just installed your first application from a tarball. COOL, huh? Like I said, it is sometimes necessary, but not recommended to install applications this way on your Linux system. You risk corrupting your system with poorly written configuration scripts, or worse, intentionally written scripts that trash your system. You never know. There are asshats in the Linux world, too. There’s also the possibility of sliding down the slippery slope into Dependency HELL! I’ve been there. You don’t want to go there. Believe me!

I used some information from berkshirelug.org in the creation of this article. I urge you to click HERE to view their excellent tutorial on installing tarballs.

As always, have FUN while you learn…

~Eric

Note: Article amended to utilize the user/root commands in a more secure way. Thanks to Eddie Ringle for the suggestion.