Compiling LINUX apps for OS X w/ SCONS

Posted on 2007-10-16
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:

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

    There is a project called fink ( that has ported many popular linux apps and utilities to OS X. nmap is included as should most of the apps you would need -

    Author Comment

    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 28

    Expert Comment

    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 ( 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 page (or directly through the

    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


    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 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

    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'])

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (, affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
    Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
    Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
    Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now