edrosten / libcvd

libcvd - efficient and easy to use C++ computer vision library.
Other
239 stars 103 forks source link

Problem with CVD for build Oxford-PTAM/PTAM-GPL #32

Open divbyzero opened 7 years ago

divbyzero commented 7 years ago

Hello. I want to compile project on MacOS 10.11 with arch i386 and have several problem with linking.

System information (version)
libcvd configuration

I'm using ./configure_osx

#!/bin/bash
ARCH="-arch i386 -m32"

export LIBS="$LIBS -framework OpenGL"

export CXXFLAGS="$ARCH -std=c++14 -stdlib=libc++ -D_OSX"
export LDFLAGS="$ARCH -stdlib=libc++"

export CC="clang"
export CXX="clang++"
export LD="clang++"

./configure $1 $2 $3 $4 $5 $6 $7 $8 $9

libcvd attributes

./configure_osx --without-ffmpeg --without-v4l1buffer --without-dc1394v1 --without-dc1394v2

libcvd config log

checking for gcc... clang checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether clang accepts -g... yes checking for clang option to accept ISO C89... none needed checking how to run the C preprocessor... clang -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for gawk... gawk checking whether we are using the GNU C++ compiler... yes checking whether clang++ accepts -g... yes checking for a BSD-compatible install... /usr/bin/install -c checking whether ln -s works... yes checking for ranlib... ranlib checking how to run the C++ preprocessor... clang++ -E checking build system type... i386-apple-darwin15.6.0 checking host system type... i386-apple-darwin15.6.0 checking if compiler flag -Wall works... yes checking if compiler flag -Wextra works... yes checking if compiler flag -pipe works... yes checking For C++1y support... yes checking for main in -lpthread... yes checking if compiler flag -ggdb works... yes checking if -D_GLIBCXX_DEBUG can works...... yes checking if compiler flag -fPIC works... yes checking if compiler flag -O3 works... yes


Checking processor specific features

checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether byte ordering is bigendian... no checking for MMX support... yes checking for MMXEXT support... yes checking for SSE support... yes checking for SSE2 support... yes checking for SSE3 support... yes checking size of void*... 4 checking for inline asm statement... yes checking assembler supports .type pseudo-op... no


Checking for operating system specific features

checking for /opt/local... no checking for /sw... no configure: Adding /usr/X11R6/include to the build path. checking Carbon and QuickTime framework... no


Checking for optional libraries

checking for X11 using dubious methods...... yes checking for sharedptr... yes checking for TooN... yes checking for dgesvd in -lacml... no checking if Accelerate framework is needed for LAPACK... checking for dgesvd_... yes checking png.h usability... yes checking png.h presence... yes checking for png.h... yes checking for png_init_io in -lpng... no checking for png_set_expand_gray_1_2_4_to_8 in -lpng... no checking jpeglib.h usability... yes checking jpeglib.h presence... yes checking for jpeglib.h... yes checking for jpeg_destroy_decompress in -ljpeg... no checking tiffio.h usability... yes checking tiffio.h presence... yes checking for tiffio.h... yes checking for TIFFReadRGBAImage in -ltiff... no checking if perhaps libtiff requires zlib... checking for tiffio.h... (cached) yes checking for deflate in -lz... yes checking for TIFFReadRGBAImage in -ltiff... no checking for doxygen... no


Checking for platform compatibility

checking glob.h usability... yes checking glob.h presence... yes checking for glob.h... yes checking for glob... yes checking for GLOB_BRACE and GLOB_TILDE in glob.h... yes checking whether feenableexcept is declared... no checking for posix_memalign... yes


Checking for extra build options

Options: inline_asm shared_ptr toon lapack glob memalign

Missing options for darwin15.6.0: assembler dc1394v2 ffmpeg jpeg png posix_rt qtbuffer tiff videodisplay

Dodgy things: oldpng missing_c99_feenableexcept

SIMD support: mmx mmxext sse sse2 sse3

Missing SIMD support for i386-apple-darwin15.6.0:

-arch i386 -m32 -std=c++14 -stdlib=libc++ -D_OSX -Wall -Wextra -pipe -ggdb -fPIC -mmmx -msse -msse -msse2 -msse3 -lpthread -framework OpenGL -framework Accelerate -n Generating config... configuration unchanged configure: creating ./config.status config.status: creating Makefile

otool - L /usr/local/lib/libcvd.a

otool -L /usr/local/lib/libcvd.a Archive : /usr/local/lib/libcvd.a /usr/local/lib/libcvd.a(diskbuffer2.o): /usr/local/lib/libcvd.a(deinterlacebuffer.o): /usr/local/lib/libcvd.a(exceptions.o): /usr/local/lib/libcvd.a(image_io.o): /usr/local/lib/libcvd.a(bayer.o): /usr/local/lib/libcvd.a(morphology.o): /usr/local/lib/libcvd.a(colourspace_convert.o): /usr/local/lib/libcvd.a(draw.o): /usr/local/lib/libcvd.a(yuv422.o): /usr/local/lib/libcvd.a(yuv420.o): /usr/local/lib/libcvd.a(pnm_grok.o): /usr/local/lib/libcvd.a(bmp.o): /usr/local/lib/libcvd.a(bmp_read.o): /usr/local/lib/libcvd.a(bmp_write.o): /usr/local/lib/libcvd.a(cvdimage.o): /usr/local/lib/libcvd.a(fits.o): /usr/local/lib/libcvd.a(fitswrite.o): /usr/local/lib/libcvd.a(save_postscript.o): /usr/local/lib/libcvd.a(text_write.o): /usr/local/lib/libcvd.a(text.o): /usr/local/lib/libcvd.a(fast_corner.o): /usr/local/lib/libcvd.a(convolution.o): /usr/local/lib/libcvd.a(nonmax_suppression.o): /usr/local/lib/libcvd.a(timeddiskbuffer.o): /usr/local/lib/libcvd.a(videosource.o): /usr/local/lib/libcvd.a(connected_components.o): /usr/local/lib/libcvd.a(cvd_timer.o): /usr/local/lib/libcvd.a(thread.o): /usr/local/lib/libcvd.a(half_sample.o): /usr/local/lib/libcvd.a(convert_rgb_to_y.o): /usr/local/lib/libcvd.a(convolve_gaussian.o): /usr/local/lib/libcvd.a(gradient.o): /usr/local/lib/libcvd.a(median_3x3.o): /usr/local/lib/libcvd.a(utility_float.o): /usr/local/lib/libcvd.a(utility_byte_differences.o): /usr/local/lib/libcvd.a(utility_double_int.o): /usr/local/lib/libcvd.a(two_thirds_sample.o): /usr/local/lib/libcvd.a(fast_7_detect.o): /usr/local/lib/libcvd.a(fast_7_score.o): /usr/local/lib/libcvd.a(slower_corner_7.o): /usr/local/lib/libcvd.a(fast_8_detect.o): /usr/local/lib/libcvd.a(fast_8_score.o): /usr/local/lib/libcvd.a(slower_corner_8.o): /usr/local/lib/libcvd.a(fast_9_detect.o): /usr/local/lib/libcvd.a(fast_9_score.o): /usr/local/lib/libcvd.a(fast_corner_9_nonmax.o): /usr/local/lib/libcvd.a(fast_10_detect.o): /usr/local/lib/libcvd.a(fast_10_score.o): /usr/local/lib/libcvd.a(fast_11_detect.o): /usr/local/lib/libcvd.a(fast_11_score.o): /usr/local/lib/libcvd.a(slower_corner_11.o): /usr/local/lib/libcvd.a(fast_12_detect.o): /usr/local/lib/libcvd.a(fast_12_score.o): /usr/local/lib/libcvd.a(faster_corner_9.o): /usr/local/lib/libcvd.a(faster_corner_10.o): /usr/local/lib/libcvd.a(faster_corner_12.o): /usr/local/lib/libcvd.a(videosource_nodvbuffer.o): /usr/local/lib/libcvd.a(videosource_nov4lbuffer.o): /usr/local/lib/libcvd.a(videosource_noqtbuffer.o): /usr/local/lib/libcvd.a(posix_memalign.o): /usr/local/lib/libcvd.a(videosource_novideofilebuffer.o): /usr/local/lib/libcvd.a(globlist.o): /usr/local/lib/libcvd.a(tensor_voting.o): /usr/local/lib/libcvd.a(brezenham.o): /usr/local/lib/libcvd.a(draw_toon.o): /usr/local/lib/libcvd.a(quartic.o): /usr/local/lib/libcvd.a(threepointpose.o):

Not found glwindow.o

PTAM Log

I'm compiling PTAM with keys:

cmake .. -DCMAKE_OSX_ARCHITECTURES="i386"
make -j4

Linking problem:

Undefined symbols for architecture i386: "CVD::glDrawText(std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, CVD::TEXT_STYLE, double, double)", referenced from: GLWindow2::PrintString(CVD::ImageRef, std::1::basic_string<char, std::__1::char_traits, std::1::allocator >) in GLWindow2.cpp.o "CVD::GLWindow::swap_buffers()", referenced from: CameraCalibrator::Run() in CameraCalibrator.cpp.o "CVD::GLWindow::handle_events(CVD::GLWindow::EventHandler&)", referenced from: GLWindow2::HandlePendingEvents() in GLWindow2.cpp.o "CVD::GLWindow::init(CVD::ImageRef const&, int, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&)", referenced from: CVD::GLWindow::GLWindow(CVD::ImageRef const&, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, int, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&) in GLWindow2.cpp.o "CVD::GLWindow::~GLWindow()", referenced from: GLWindow2::~GLWindow2() in CameraCalibrator.cpp.o GLWindow2::GLWindow2(CVD::ImageRef, std::1::basic_string<char, std::__1::char_traits, std::1::allocator >) in GLWindow2.cpp.o GLWindow2::~GLWindow2() in GLWindow2.cpp.o "CVD::glSetFont(std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&)", referenced from: GLWindow2::GLWindow2(CVD::ImageRef, std::1::basic_string<char, std::__1::char_traits, std::1::allocator >) in GLWindow2.cpp.o "CVD::GLWindow::size() const", referenced from: GLWindow2::DrawMenus() in GLWindow2.cpp.o GLWindow2::SetupWindowOrtho() in GLWindow2.cpp.o GLWindow2::SetupVideoRasterPosAndZoom() in GLWindow2.cpp.o GLWindow2::SetupViewport() in GLWindow2.cpp.o GLWindow2::DrawCaption(std::1::basic_string<char, std::__1::char_traits, std::1::allocator >) in GLWindow2.cpp.o ld: symbol(s) not found for architecture i386

But libcvd, gvars - builded for i386.

> lipo -info /usr/local/lib/libcvd.a input file /usr/local/lib/libcvd.a is not a fat file Non-fat file: /usr/local/lib/libcvd.a is architecture: i386

> lipo -info /usr/local/lib/libGVars3-0.6.dylib Non-fat file: /usr/local/lib/libGVars3-0.6.dylib is architecture: i386

How can I fix it? Thx

divbyzero commented 7 years ago

I tried the patch: https://github.com/edrosten/libcvd/pull/8/files And now videodisplay is works after add the key for x11:

./configure_osx --without-ffmpeg --x-libraries=/usr/X11/lib --x-includes=/usr/X11/include

configure log

Options: inline_asm videodisplay shared_ptr toon lapack glob memalign

otool -L /usr/local/lib/libcvd.a Archive : /usr/local/lib/libcvd.a /usr/local/lib/libcvd.a(diskbuffer2.o): /usr/local/lib/libcvd.a(deinterlacebuffer.o): /usr/local/lib/libcvd.a(exceptions.o): /usr/local/lib/libcvd.a(image_io.o): /usr/local/lib/libcvd.a(bayer.o): /usr/local/lib/libcvd.a(morphology.o): /usr/local/lib/libcvd.a(colourspace_convert.o): /usr/local/lib/libcvd.a(draw.o): /usr/local/lib/libcvd.a(yuv422.o): /usr/local/lib/libcvd.a(yuv420.o): /usr/local/lib/libcvd.a(pnm_grok.o): /usr/local/lib/libcvd.a(bmp.o): /usr/local/lib/libcvd.a(bmp_read.o): /usr/local/lib/libcvd.a(bmp_write.o): /usr/local/lib/libcvd.a(cvdimage.o): /usr/local/lib/libcvd.a(fits.o): /usr/local/lib/libcvd.a(fitswrite.o): /usr/local/lib/libcvd.a(save_postscript.o): /usr/local/lib/libcvd.a(text_write.o): /usr/local/lib/libcvd.a(text.o): /usr/local/lib/libcvd.a(fast_corner.o): /usr/local/lib/libcvd.a(convolution.o): /usr/local/lib/libcvd.a(nonmax_suppression.o): /usr/local/lib/libcvd.a(timeddiskbuffer.o): /usr/local/lib/libcvd.a(videosource.o): /usr/local/lib/libcvd.a(connected_components.o): /usr/local/lib/libcvd.a(cvd_timer.o): /usr/local/lib/libcvd.a(thread.o): /usr/local/lib/libcvd.a(half_sample.o): /usr/local/lib/libcvd.a(convert_rgb_to_y.o): /usr/local/lib/libcvd.a(convolve_gaussian.o): /usr/local/lib/libcvd.a(gradient.o): /usr/local/lib/libcvd.a(median_3x3.o): /usr/local/lib/libcvd.a(utility_float.o): /usr/local/lib/libcvd.a(utility_byte_differences.o): /usr/local/lib/libcvd.a(utility_double_int.o): /usr/local/lib/libcvd.a(two_thirds_sample.o): /usr/local/lib/libcvd.a(fast_7_detect.o): /usr/local/lib/libcvd.a(fast_7_score.o): /usr/local/lib/libcvd.a(slower_corner_7.o): /usr/local/lib/libcvd.a(fast_8_detect.o): /usr/local/lib/libcvd.a(fast_8_score.o): /usr/local/lib/libcvd.a(slower_corner_8.o): /usr/local/lib/libcvd.a(fast_9_detect.o): /usr/local/lib/libcvd.a(fast_9_score.o): /usr/local/lib/libcvd.a(fast_corner_9_nonmax.o): /usr/local/lib/libcvd.a(fast_10_detect.o): /usr/local/lib/libcvd.a(fast_10_score.o): /usr/local/lib/libcvd.a(fast_11_detect.o): /usr/local/lib/libcvd.a(fast_11_score.o): /usr/local/lib/libcvd.a(slower_corner_11.o): /usr/local/lib/libcvd.a(fast_12_detect.o): /usr/local/lib/libcvd.a(fast_12_score.o): /usr/local/lib/libcvd.a(faster_corner_9.o): /usr/local/lib/libcvd.a(faster_corner_10.o): /usr/local/lib/libcvd.a(faster_corner_12.o): /usr/local/lib/libcvd.a(videosource_nodvbuffer.o): /usr/local/lib/libcvd.a(videosource_nov4lbuffer.o): /usr/local/lib/libcvd.a(videosource_noqtbuffer.o): /usr/local/lib/libcvd.a(posix_memalign.o): /usr/local/lib/libcvd.a(videodisplay.o): /usr/local/lib/libcvd.a(glwindow.o): /usr/local/lib/libcvd.a(gltext.o): /usr/local/lib/libcvd.a(videosource_novideofilebuffer.o): /usr/local/lib/libcvd.a(globlist.o): /usr/local/lib/libcvd.a(tensor_voting.o): /usr/local/lib/libcvd.a(brezenham.o): /usr/local/lib/libcvd.a(draw_toon.o): /usr/local/lib/libcvd.a(quartic.o): /usr/local/lib/libcvd.a(threepointpose.o):

But now problem with i386 with XQuartz.

logs

Undefined symbols for architecture i386: "_XCloseDisplay", referenced from: CVD::GLWindow::init(CVD::ImageRef const&, int, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&) in libcvd.a(glwindow.o) CVD::GLWindow::~GLWindow() in libcvd.a(glwindow.o) "_XCreateColormap", referenced from: CVD::GLWindow::init(CVD::ImageRef const&, int, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&) in libcvd.a(glwindow.o) ...

After that I tried make build with x86_64 (GVars3, libcvd, opencv) using xcode. And all is ok now expect one thing: http://imgur.com/kU1LbvA Menu is mirrored.

I also patched "progs/video_play_source.cc"

--- a/progs/video_play_source.cc
+++ b/progs/video_play_source.cc
@@ -297,7 +297,16 @@ template<class C> void play(string s, string fmt, unsigned int decimate)

                        rec_number++;

-                       glTexImage2D(*frame, 0, GL_TEXTURE_RECTANGLE_NV);
+#ifdef GL_TEXTURE_RECTANGLE_ARB
+            glTexImage2D(*frame, 0, GL_TEXTURE_RECTANGLE_ARB);
+#else
+#ifdef GL_TEXTURE_RECTANGLE_NV
+            glTexImage2D(*frame, 0, GL_TEXTURE_RECTANGLE_NV);
+#else
+            glTexImage2D(*frame, 0, GL_TEXTURE_RECTANGLE_EXT);
+#endif
+#endif

Is it correct? Or maybe this is a problem with mirrored menu?