Closed swarn closed 7 years ago
Yes, you want to build everything through waf rather than using gcc directly:
./waf configure --prefix=install
./waf install
(Or, if you want to build just show_nitf
and show_nitf++
, the second line can be used to target them directly:
./waf install --target=show_nitf,show_nitf++
Sorry, I was unclear. I was just using show_nitf
as an example. I built NITRO as per the instructions:
$ python waf configure --alltests --enable-64bit --disable-swig --disable-java --disable-python --disable-matlab --prefix=installed
$ python waf build
$ python waf install
Both show_nitf
and show_nitf++
compiled successfully and were copied to the bin
directory.
Now, I have my own C++ code that I want to compile and link to NITRO. I copied show_nitf++.cpp
from the NITRO source directory to another directory as a "known good" file so that I could attempt to build it before trying the same with my code.
Ahh gotcha. So, two things:
sys_config.h
file (and so sys/Mutex.h
isn't finding the ifdef it's looking for). You're reporting above you configured (which is when sys_config.h
gets generated)... make sure that header is in your installed/include/sys directory.waf dumplib --target=show_nitf++
to get a list of all the required libraries to link in (though this doesn't seem to be your issue or you'd get a linker error... although above it doesn't look like you're linking in sys-c++
so you'd get one eventually).Documentation on this site is sparse but SIX, which is another open source library we provide that's built on top of NITRO, is also built the same way and has a manual with some helpful build tips in it: https://github.com/ngageoint/six-library/blob/master/docs/six-manual.pdf.
Let me know if you still need a hand getting this working though.
Many thanks, @asylvest.
When I saw that I had no sys_config.h
, I got the notion that maybe I should clone the latest version, rather than using the latest tagged version (2.7), which I now see is older than I realized. Mea culpa!
With new NITRO source and the info from waf dumplib
, I write this:
g++ show_nitf++.cpp -lnitf-c++.2.7 -lmt-c++.1.1 -lio-c++.1.0 -lsys-c++.1.2 -lstr-c++.1.0 -lexcept-c++.1.0 -lnitf-c.2.7 -lnrt-c.2.7 -ldl -lrt -lm
Everything compiles and runs perfectly. I'll read the SIX docs for further info.
OK great - glad you got this working. Ahh yes, I hadn't thought of this... In 2.7, we weren't generating the config.h files like we are now (you needed to set the proper defines yourself if you were building outside of waf... this led to a lot of confused users seeing the kinds of things you ran into :o) ).
I can build, for example,
show_nitf.c
from the command line:But trying something similar for
show_nitf++.cpp
:Results in:
I'm probably missing something...