Configuring NetBeans to Use a Build Host

So, tell me if you’ve heard this one before: you’re sitting there programming for some customer, minding your own business. But guess what? The requirements for your program depend on some platform-specific behavior. Behavior that your computer doesn’t mirror. Say, the requirements depend on the fact that 0x80000000 < 0, but you have a 64-bit compiler installed. This means that you have to test your program on their computer using their compiler. Irritating, right?

Sure, you could just sftp your code to their computer and then compile, while doing the actual development on your computer, but that sounds like so much work, right? Not as much as you’d think, thanks to NetBeans.

Enter The Build Host

With NetBeans, you can configure a Build Host, and use a remote server for compilation. Got SSH access to a user account on the build host? Got internet access? Copied the source to your computer? Then we’re set, let’s fire up NetBeans and get to work.

First, we need to set up the build host. On the left pane that normally shows your project source files, there should be a Services tab. Click on it. In the Services pane, right-click C/C++ Build Hosts and click Add New Host...

In the Hostname: field, enter the FQDN of the build host. Click Next >

add2

Next, enter your username in the Login: field. Click Next > and you’ll be prompted to enter your password. Finally, NetBeans will attempt to connect to the build server.

add3

Assuming all is well, you should be presented with the Summary page. On the Summary page, ensure the correct tool collection is selected, and set the Access project files via: combo box to SFTP. We can’t use Samba/NFS because that would require root on the remote server which we almost surely don’t have. When we’re done, click Finish.

add4

Creating The Project

Now we’re ready to create a new project. This is a pretty straightforward process. First, click File -> New Project...

1

Select C/C++ -> C/C++ Project with Existing Sources and then click Next >

2

On the Select Mode page, select the local directory containing your source files. In the Build Host: combo box, select the build host we just created. Finally, click Finish

3

The project will make clean and then make. This process will take slightly longer than usual, due to the fact that your sources are being SFTP‘d to the build host and build there.

NetBeans will create a .netbeans directory in the home directory of the user used to connect to the remote server. This is where it stores the remote sources and files. However, this is largely irrelevant to us; we can treat it like a local project, and let NetBeans deal with all this clerical work!

One response to “Configuring NetBeans to Use a Build Host”

  1. icehouse15 says :

    Does NetBeans have a vim editor style?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: