Okay, so I wanted to share my journey compiling ITK on Linux. You know, it was a bit of a mess, but I finally got it figured out, and I thought I’d write it all down so maybe it helps someone else out there.
First off, I got this ITK thing. It’s a toolkit, not a simple app, so you can’t just double-click and install. Nope, you gotta compile it from the source. I downloaded the source code and extracted it to a folder. All good so far, right?
Next, I needed a build system. Now, I’m not a big fan of CMake, so I decided to use GNU Make, I already installed it. It’s what I’m comfortable with, and I’ve heard it’s pretty good for this kind of thing.
So, I fired up my terminal and navigated to the ITK source code directory. Then, I created a separate “build” directory. This is where all the compiled files will go. Keeps things neat and tidy. Inside the build directory, this is where the magic happens. I wanted to make sure the compiler was doing its best, so I used the -O3 flag for optimization. I had heard it can make a big difference in performance. But at first I didn’t add it, just want to test it step by step.
-
cd /path/to/itk/source
(obviously, replace this with where you put the ITK files) -
mkdir build
-
cd build
-
make
Here’s how the commands I ran looked like:
The make process took a while. I mean, I went to grab a cup of coffee and came back, and it was still going. It felt like forever. I’m running this on a 6-core Intel CPU with hyper-threading, so it’s not exactly a potato, but still. It was a bit of a wait, to put it mildly.
Then I tried to use -O3
flag to complie it. I ran make clean
first, then ran make -O3
. It’s so slow than before.
Finally, after what felt like an eternity, it finished! No errors, thankfully. I was pretty stoked, not gonna lie. I guess all those online guides and forum posts I read paid off. Then, I ran make install
to put all the compiled stuff in the right place.
So yeah, that’s how I compiled ITK on Linux. Not the most straightforward thing in the world, but definitely doable. Hopefully, this little write-up of my experience will help someone out there avoid some of the headaches I went through. If you’re stuck, just remember to create a separate build directory, use the -O3 flag and be patient. Very patient. Good luck!