Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Compiling LINUX apps for OS X w/ SCONS

Posted on 2007-10-16
Medium Priority
Last Modified: 2012-05-05
Here's an easy one from a somewhat mac n00b: Compiling w/ SCONS (python based comp. tool).

I have a few linux apps that are a nessisity for my NetSec degree, and would like to re-compile them for os x. How would I do this w/ SCONS? One of the most needed is nmap: http://sourceforge.net/projects/nmap-scanner/

I have no programming experience w/ very little scripting exp, and therefore don't know how to create the python script needed (the "SConstruct" file for SCONS to compile).

Could an expert please post a walkthrough on this...

In particular how does one creat the SConstruct file with multiple source files in the app's dir?
Question by:Trilokavijaya
LVL 11

Expert Comment

ID: 20087040
There is a project called fink (http://www.finkproject.org) that has ported many popular linux apps and utilities to OS X. nmap is included as should most of the apps you would need - http://pdb.finkproject.org/pdb/browse.php?summary=nmap

Author Comment

ID: 20087299
I appreciate the valued link. Fink has come accross my desk before, and as I'm not doubting that there's compilied packages, I would still like to learn compiling with SCONS.
LVL 29

Expert Comment

ID: 20091531
Hi Trilokavijaya. Firstly, I have to say that I am very new to scons. I have learned from you that it exists -- thanks ;)

From the scons documentation (http://www.scons.org/doc/0.97/HTML/scons-user/c251.html) the SConstruct is a normal text file. Just use your favourite text editor to create it and type the command inside. There is a minimal example in the doc:


This is for a C program of that name. Then you have to run the scons utility in the directory where the SConstruct file is located. It will find the SConstruct file and it will use the content.

I suggest to subscribe to the scons mailing list through the http://www.scons.org/lists.php page (or directly through the mailto:users-subscribe@scons.tigris.org).

Anyway, I would try the first example from the above doc (the hello.c) just to ensure that you have installed scons correctly and that it works for you. After (un)successfull compilation of the hello.c example you will have more questions.

Author Comment

ID: 20092931

np on the heads up on such a sweat compiling prog.

My question still abides in the  the "vi'ing a fresh SConcstruct" method...I can't simply call to a single file...there's tons of .sh files in the dir, i have to dig a touch deeper...

If you somehow can get a consistent way to compile more complex progs than the hello world exam[ple, please post it.

Why not try out nmap? it's a small prog, and would be a great excersice to help out.

BTW, this is a SCONS thread, not nmap...yes, fink carries the package...however fink doesn't compile scons, and fink doesn't offer much selection only 1700 progs...run of the mill unix, ie. "fetchmail"...and is far behind on the security sector, with unfulfilled packages for apps like "wireshark," etc...

MacAnthony, as skillful as your answer is as a workaround for installing nmap, people need to become more aware as to the awesome compiling prowess of SCONS, and add their advices pertaining to such.

LVL 15

Accepted Solution

mish33 earned 500 total points
ID: 20113483
nmap-scanner is a perl module and need not to be build.

If you want to build your program out of main.c, file1.c, file2.c say

Program('program', ['main.c', 'file1.c', 'file2.c'])

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show the steps for installing Python on Ubuntu Operating System. I have created a virtual machine with Ubuntu Operating system 8.10 and this installing process also works with upgraded version of Ubuntu OS. For installing Py…
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question