Compiling PTAM on OSX Leopard
**NOTE: THIS IS TO GET PTAM RUNNING ON LEOPARD (10.5.8) NOT ON SNOW LEOPARD. WHILE MUCH OF THIS INFORMATION WILL BE USEFUL FOR SNOW LEOPARD, YOU WILL NEED TO COMPILE THE LIBRARIES FOR 32-bit as PTAM DOES NOT SUPPORT 64-BIT LIBRARIES **
**SNOW LEOPARD NOTES CAN NOW BE FOUND HERE FROM MY COLLEAGUE ANDREW HATCH**
Parallel Tracking and Mapping is a solution developed by Georg Klein et al. at the Robotics Lab in Oxford University. It addresses the problem of markerless Augmented Reality by using the features which already exist within the environment, rather than having to add special markers to the scene.
It is officially supported by OSX in the downloadable files, however I ran into a couple of issues, and it seems a few other people on the net have had similar issues too. So here are my solutions to the problems I had:
Firstly you need to make sure that you have the X11 libraries for OSX installed. These can be found on your leopard CD or on the XQuartz project website. You will also need to install fink in order to grab some packages. Let’s do that first. Fire up your terminal and:
sudo fink install readline5
That will take care of one of the problems before you even get to it. Also you will need to compile the libc1394 sources which area available here. Now I’m going to assume you’ve downloaded PTAM and the required libraries as explained in the PTAM README.txt
The order of compilation is:
- TooN
- libcvd
- gvars3
- PTAM
TooN is a straightfoward ./configure make sudo make install – that should work first time for you
libcvd isn’t that easy. In your libcvd source directory, edit the file ./cvd/gl_helpers.h
You need to change:
#include <GL/gl.h> #include <GL/glu.h>
To:
#include <OpenGL/gl.h> #include <OpenGL/glu.h>
Which makes sure that the OSX X11 libraries are found and used for this. Save and exit.
Now you can go for a configure, the README file suggests that you use the options
./configure --without-ffmpeg
However, I found that the configure script still has difficulty finding the X libraries resulting in a compilation line:
Checking for X.... no
In order to explicitly tell the compiler where to find it:
./configure --without-ffmpeg --x-libraries=/usr/X11/lib --x-includes=/usr/X11/include
Moving swiftly onwards to the next error:
Undefined symbols: "_png_set_gray_1_2_4_to_8", referenced from: CVD::PNG::png_reader::png_reader(std::basic_istream<char, std::char_traits<char> >&)in png.o</div> ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [libcvd.dylib] Error 1
This is caused by a conflict between libcvd and the newer version of libpng. In order to remedy it edit (in your libcvd source folder still) ./pnm_src/png.cc
Find the line which makes a function call to:
png_set_gray_1_2_4_to_8
and replace the call with
png_set_expand_gray_1_2_4_to_8
That should resolve that error.
You should now be able to go to PTAM source folder, run the makefile and all should go OK.
[...] and compile PTAM first, it comes with great instructions and I have some troubleshooting notes here as you will need all the same [...]
PTAMM porting to OSX Leopard « Augmented Reality Junkie
August 17, 2010 at 4:22 pm
I try to compile the libcvd in snow leopard in 32 bit, it says it found the X and lGL, however, I got following error.
./cvd/gl_helpers.h: In function ‘void CVD::glVertex(const C&) [with C = TooN::Vector]’:
progs/calibrate.cxx:75: instantiated from here
./cvd/gl_helpers.h:450: error: no type named ‘const_iterator’ in ‘struct TooN::Vector’
./cvd/gl_helpers.h:450: error: ‘const struct TooN::Vector’ has no member named ‘end’
./cvd/gl_helpers.h:450: error: no type named ‘const_iterator’ in ‘struct TooN::Vector’
./cvd/gl_helpers.h:450: error: no type named ‘const_iterator’ in ‘struct TooN::Vector’
./cvd/gl_helpers.h:450: error: no type named ‘const_iterator’ in ‘struct TooN::Vector’
Do you have the same error on compiling PTAM in snow leopard?
Leo
August 21, 2010 at 12:48 pm
which version of TooN are you using, and did you force the TooN compile to be done in 32bit also?
Cheers
Adam
ajclarkson
August 23, 2010 at 9:35 am
No, I didn’t. I tried compile TooN in 32 bit, but still get the same error. I am using the now using Toon 2.0 To compile the PTAM on snow leopard is quit a pain.
Leo
August 24, 2010 at 11:37 am
Got the link to my colleagues notes on how to compile on SL. I’ll update the post above, but here you go:
http://www.andrewhatch.net/2010/08/ptam-on-os-x-1064.html#more
Hope that helps,
Adam
ajclarkson
August 24, 2010 at 11:41 am
Thanks a lot. I will try it.
Cheers
Leo
August 24, 2010 at 12:00 pm
I’ve seen it working on his MBP so hopefully you will have the same success
ajclarkson
August 24, 2010 at 12:01 pm
I tried the post you just gave, the libcvd now is compiled. However, I still get the error in PTAM.
ld: warning: directory ‘/MY_CUSTOM_LINK_PATH/’ following -L not found
ld: warning: in /usr/local/lib/libcvd.dylib, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols:
“CVD::QT::RawQT::frame_rate()”, referenced from:
CVD::QTBuffer::frame_rate() in VideoSource_OSX.o
“CVD::GLWindow::size() const”, referenced from:
GLWindow2::SetupWindowOrtho() in GLWindow2.o
GLWindow2::DrawCaption(std::basic_string<char, std::char_traits, std::allocator >)in GLWindow2.o
GLWindow2::DrawCaption(std::basic_string<char, std::char_traits, std::allocator >)in GLWindow2.o
GLWindow2::DrawCaption(std::basic_string<char, std::char_traits, std::allocator >)in GLWindow2.o
GLWindow2::DrawCaption(std::basic_string<char, std::char_traits, std::allocator >)in GLWindow2.o
GLWindow2::DrawCaption(std::basic_string<char, std::char_traits, std::allocator >)in GLWindow2.o
GLWindow2::DrawCaption(std::basic_string<char, std::char_traits, std::allocator >)in GLWindow2.o
GLWindow2::DrawMenus() in GLWindow2.o
GLWindow2::DrawMenus() in GLWindow2.o
GLWindow2::SetupViewport() in GLWindow2.o
GLWindow2::SetupViewport() in GLWindow2.o
GLWindow2::SetupVideoRasterPosAndZoom() in GLWindow2.o
GLWindow2::SetupVideoRasterPosAndZoom() in GLWindow2.o
“CVD::Thread::start(CVD::Runnable*)”, referenced from:
MapMaker::MapMaker(Map&, ATANCamera const&)in MapMaker.o
“CVD::QT::RawQT::put_frame(unsigned char*)”, referenced from:
CVD::QTBuffer::put_frame(CVD::VideoFrame*)in VideoSource_OSX.o
It seems the same error as I have before.
Leo
August 24, 2010 at 12:43 pm