undefined reference compiling taskwarrior on arm chromebook - c++

I tried to build task-2.5.1 on my armv81 chromebook inside a termux session. It didn't work due build dependencies so I installed them then uncompressed and started in a fresh new directory. When I ran make VERBOSE=1 I got an undefined reference to __atomic_fetch_add_4 when linking...
[ 98%] Linking CXX executable lex
cd /data/data/com.termux/files/home/src/task-2.5.1/src && /data/data/com.termux/files/usr/bin/cmake -E cmake_link_script CMakeFiles/lex_executable.dir/link.txt --verbose=1
/data/data/com.termux/files/usr/bin/c++ -Wall -Wsign-compare -Wreturn-type -std=c++11 -stdlib=libc++ -O3 -DNDEBUG -rdynamic CMakeFiles/lex_executable.dir/lex.cpp.o -o lex libtask.a commands/libcommands.a columns/libcolumns.a libtask.a -lgnutls -luuid
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: libtask.a(Nibbler.cpp.o): in function `Nibbler::Nibbler(Nibbler const&)':
Nibbler.cpp:(.text+0x8c): undefined reference to `__atomic_fetch_add_4'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: libtask.a(Nibbler.cpp.o): in function `Nibbler::operator=(Nibbler const&)':
Nibbler.cpp:(.text+0xe0): undefined reference to `__atomic_fetch_add_4'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: Nibbler.cpp:(.text+0x104): undefined reference to `__atomic_fetch_add_4'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: libtask.a(Nibbler.cpp.o): in function `Nibbler::~Nibbler()':
Nibbler.cpp:(.text+0x174): undefined reference to `__atomic_fetch_add_4'
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/CMakeFiles/lex_executable.dir/build.make:90: src/lex] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/src/task-2.5.1'
make[1]: *** [CMakeFiles/Makefile2:175: src/CMakeFiles/lex_executable.dir/all] Error 2
make[1]: Leaving directory '/data/data/com.termux/files/home/src/task-2.5.1'
make: *** [Makefile:152: all] Error 2
I found this discussion about undefined references in arm builds. I tried adding a -latomic to CMakeFiles/task_executable.dir/link.txt but it didn't change the output.
Any ideas how to fix this?

Many thanks to wbsch in this issue (posted just after this one) for the link to the known fix which was successful on my machine, removing the three lines from CMakeLists.txt.

Related

Make failing with not used function

I am trying to build my code.
After I do cmake .. from a build directory I do make -j8 and I get
[ 90%] Building CXX object common/CMakeFiles/common.dir/src/utils/path_util.cpp.o
[ 95%] Linking CXX executable myproj
CMakeFiles/myproj.dir/main.cpp.o: In function `cv::String::~String()':
main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to `cv::String::deallocate()'
CMakeFiles/myproj.dir/main.cpp.o: In function `cv::String::operator=(cv::String const&)':
main.cpp:(.text._ZN2cv6StringaSERKS0_[_ZN2cv6StringaSERKS0_]+0x28): undefined reference to `cv::String::deallocate()'
collect2: error: ld returned 1 exit status
CMakeFiles/myproj.dir/build.make:95: recipe for target 'myproj' failed
make[2]: *** [myproj] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/myproj.dir/all' failed
make[1]: *** [CMakeFiles/myproj.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
The curious thing is that nowhere in the code I use cv::String.
I have also put
#Search for dependencies
set(MIN_OPENCV_VERSION "3.4.11" CACHE STRING "OpenCV version")
find_package(OpenCV ${MIN_OPENCV_VERSION} REQUIRED
COMPONENTS core
PATHS /usr/local/opencv-${MIN_OPENCV_VERSION}
NO_DEFAULT_PATH
)
in several CMakeLists.txt files and cmake finds opencv
What could be the problem?
EDIT
I set the VERBOSE environment variable to 1 as stated here
and I got
[ 90%] Building CXX object common/CMakeFiles/common.dir/src/utils/path_util.cpp.o
cd /home/user/ws/src/build/common && /usr/bin/c++ -I/usr/local/include/eigen3 -isystem /usr/local/opencv-3.4.11/include -isystem /usr/local/opencv-3.4.11/include/opencv -I/home/user/ws/src/common/include -I/home/user/ws/src/common/src -isystem /usr/local -fPIC -o CMakeFiles/common.dir/src/utils/path_util.cpp.o -c /home/user/ws/src/common/src/utils/path_util.cpp
[ 95%] Linking CXX executable road_info
/usr/bin/cmake -E cmake_link_script CMakeFiles/myproj.dir/link.txt --verbose=1
/usr/bin/c++ -rdynamic CMakeFiles/myproj.dir/main.cpp.o -o myproj mainpub_lib/mainpub.a
CMakeFiles/myproj.dir/main.cpp.o: In function `cv::String::~String()':
main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to `cv::String::deallocate()'
CMakeFiles/myproj.dir/main.cpp.o: In function `cv::String::operator=(cv::String const&)':
main.cpp:(.text._ZN2cv6StringaSERKS0_[_ZN2cv6StringaSERKS0_]+0x28): undefined reference to `cv::String::deallocate()'
collect2: error: ld returned 1 exit status
CMakeFiles/myproj.dir/build.make:95: recipe for target 'myproj' failed
make[2]: *** [myproj] Error 1
make[2]: Leaving directory '/home/user/ws/src/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/myproj.dir/all' failed
make[1]: *** [CMakeFiles/myproj.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
First, thanks #fabian for the help and pointers
I finally realized that the problem was not in my main.cpp but in a hpp file that main calls. This one.hpp file included another hpp file that was the one that caused the problem (When I commented it, the problem disapeared)
So what I did was change the CMakeLists.txt of the second level (the one dealing with the problematic hpp file) and added
target_link_libraries(mainpub PRIVATE ${OpenCV_LIBS})
With this the problem was solved
To allow for a verbose make I did export VERBOSE=1 because my make version is old. With the verbose output I could see that mainpub was the only library linked
What strikes me strange is that mainpub was apparently being built even with the problem instead the main build was signaled as problematic

OpenSSL Compilation fails in test

I have compiled Openssl FIPS object module 2.0.16 and I am trying to compile compatable openssl 1.0.2 with FIPS 2.0.16
Here are the options used
./config fips no-shared --with-fipsdir=/home/dinesh/openssl-fips-install
make depend
make
The compilation fails in test directory.
make[2]: Entering directory '/home/dinesh/openssl-1.0.2t/test'
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -I/home/dinesh/openssl-fips-install/include -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM}"; LIBPATH=`for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=dtlstest} dtlstest.o ssltestlib.o ${LIBDEPS} )
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: ssltestlib.o: in function `main':
ssltestlib.c:(.text.startup+0x0): multiple definition of `main'; dtlstest.o:dtlstest.c:(.text.startup+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: dtlstest.o: in function `test_dtls_unprocessed':
dtlstest.c:(.text+0x6d): undefined reference to `create_ssl_ctx_pair'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: dtlstest.c:(.text+0xaf): undefined reference to `bio_f_tls_dump_filter'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: dtlstest.c:(.text+0xde): undefined reference to `create_ssl_objects'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: dtlstest.c:(.text+0x124): undefined reference to `mempacket_test_inject'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: dtlstest.c:(.text+0x133): undefined reference to `create_ssl_connection'
collect2: error: ld returned 1 exit status
make[2]: *** [../Makefile.shared:164: link_app.] Error 1
make[2]: Leaving directory '/home/dinesh/openssl-1.0.2t/test'
make[1]: *** [Makefile:583: dtlstest] Error 2
make[1]: Leaving directory '/home/dinesh/openssl-1.0.2t/test'
make: *** [Makefile:295: build_tests] Error 1
I have read some forums which suggested to login as root and try make clean and run make. Still I am getting the same error. Please suggest.
Finally I was able to compile. This is what I found out.
Though config tells us to run make depend, it's not need to run make depend as this is a new compilation.
By logging in as root user and just by running make with out make depend solved the issue.

Undefined reference to symbol, DSO missing from command line

I'm trying to compile the Lotech framework under Debian Jessie, but I'm can't seem to get past a specific point in compilation. I've searched the error messages that come up, and almost all of them seem to be resolved by installing or linking a missing dependency, but I can't figure out what that dependency is in this situation.
cp buildtmp.linux/liblt.a linux/
cd clients/glfw/ && make LTCFLAGS="-O3 -DNDEBUG -DLTLINUX " && cp ltclient ../../
make[1]: Entering directory `/home/jake/Desktop/copy-lotech-master/clients/glfw'
g++ -O3 -DNDEBUG -DLTLINUX -I../../linux/include -L../../linux ltclient.cpp \
-o ltclient -static-libstdc++ -static-libgcc ../../linux/liblt.a ../../linux/libpng.a ../../linux/libz.a ../../linux/liblua.a ../../linux/libvorbis.a ../../linux/libbox2d.a ../../linux/libglfw.a ../../linux/libGLEW.a ../../linux/libopenal.a ../../linux/libcurl.a -lX11 -lGL wrap_memcpy.o -Wl,--wrap=memcpy
/usr/bin/ld: ../../linux/libopenal.a(helpers.o): undefined reference to symbol 'dlclose##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [ltclient] Error 1
make[1]: Leaving directory `/home/jake/Desktop/copy-lotech-master/clients/glfw'
make: *** [ltclient] Error 2
For me this does the trick
set (CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl")
Useful links
Link1
Link2
Link3 <- Cmake how to find libraries
Link4
Link5
DSO means Dynamic Shared Object. Add the option "-lpthread" works for me.

Build error: bad reloc address

I am trying to build IPopt with MKL blas on a 64 bit machine using MingW 64,
I can go through the configure process using the command below:
../configure ADD_FFLAGS=-fopenmp --with-blas="-L/c/intel/COMPOS~1/mkl/lib/intel64 \
-lmkl_intel_lp64_dll -lmkl_intel_thread_dll -lmkl_core_dll -Wl,\
--rpath,/c/intel/COMPOS~1/mkl/lib/intel64" \
--with-lapack="-L/c/intel/COMPOS~1/mkl/lib/intel64 \
-lmkl_intel_lp64_dll -lmkl_intel_thread_dll -lmkl_core_dll -Wl,\
--rpath,/c/intel/COMPOS~1/mkl/lib/intel64"
and I get successful configuration message, However when I try to proceed with "make" I get an error as below:
g++ -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual
-Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-lon
g-long -DIPOPT_BUILD -o ipopt.exe ampl_ipopt.o -Wl,--rpath -Wl,"/c/intel/COMPOS~
1/mkl/lib/intel64" -Wl,--rpath -Wl,"/c/intel/COMPOS~1/mkl/lib/intel64" -Wl,--rpa
th -Wl,"/c/intel/COMPOS~1/mkl/lib/intel64" -Wl,--rpath -Wl,"/c/intel/COMPOS~1/mk
l/lib/intel64" -Wl,--rpath -Wl,"/c/intel/COMPOS~1/mkl/lib/intel64" ./.libs/libi
poptamplinterface.a ../../Interfaces/.libs/libipopt.a /home/Kevin/mybuild/coin
ipopt/build_64_intel/ThirdParty/ASL/.libs/libcoinasl.a /home/Kevin/mybuild/coi
nipopt/build_64_intel/ThirdParty/Mumps/.libs/libcoinmumps.a -L/c/intel/COMPOS~1/
mkl/lib/intel64 -Lc:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1 -Lc:/mingw6
4/bin/../lib/gcc -Lc:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../.
./x86_64-w64-mingw32/lib/../lib -Lc:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4
.7.1/../../../../lib -Lc:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../
../../x86_64-w64-mingw32/lib -Lc:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.
1/../../.. /home/Kevin/mybuild/coinipopt/build_64_intel/ThirdParty/HSLold/.lib
s/libcoinhsl.a -lgfortran -lgomp -lmingwthrd -lmingw32 -lgcc_s -lmoldname -lming
wex -lmsvcrt -lquadmath -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 /home
/Kevin/mybuild/coinipopt/build_64_intel/ThirdParty/Metis/.libs/libcoinmetis.a
-lmkl_intel_lp64_dll -lmkl_intel_thread_dll -lmkl_core_dll
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/libgcc.a(unwind-sjlj.o): In f
unction `_Unwind_SjLj_Register':
c:\crossdev\build\gcc-tdm64\x86_64-w64-mingw32\libgcc/../../../../src/gcc-4.7.1/
libgcc/unwind-sjlj.c:127: multiple definition of `_Unwind_SjLj_Register'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/libgcc_s.a(d000017.o):(.text+
0x0): first defined here
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/libgcc.a(unwind-sjlj.o): In f
unction `_Unwind_SjLj_Unregister':
c:\crossdev\build\gcc-tdm64\x86_64-w64-mingw32\libgcc/../../../../src/gcc-4.7.1/
libgcc/unwind-sjlj.c:174: multiple definition of `_Unwind_SjLj_Unregister'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/libgcc_s.a(d000020.o):(.text+
0x0): first defined here
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/libgcc.a(unwind-sjlj.o): In f
unction `_Unwind_SjLj_Resume':
c:\crossdev\build\gcc-tdm64\x86_64-w64-mingw32\libgcc/../../../../src/gcc-4.7.1/
libgcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/libgcc_s.a(d000018.o):(.text+
0x0): first defined here
c:/intel/COMPOS~1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrf_lp64.obj):(.tex
t[dgetrf]+0xb4): undefined reference to `__security_check_cookie'
c:/intel/COMPOS~1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrf_lp64.obj):(.tex
t[dgetrf]+0xf5): undefined reference to `__security_check_cookie'
c:/intel/COMPOS~1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrf_lp64.obj):(.xda
ta+0xc): undefined reference to `__GSHandlerCheck'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw3
2/bin/ld.exe: c:/intel/COMPOS~1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrf_l
p64.obj): bad reloc address 0x1 in section `.text[DGETRF]'
collect2.exe: error: ld returned 1 exit status
make[3]: *** [ipopt.exe] Error 1
make[3]: Leaving directory `/home/Kevin/mybuild/coinipopt/build_64_intel/Ipopt
/src/Apps/AmplSolver'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/Kevin/mybuild/coinipopt/build_64_intel/Ipopt
/src/Apps'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Kevin/mybuild/coinipopt/build_64_intel/Ipopt
'
make: *** [all-recursive] Error 1
I would be thankful if somebody could help with it.
Follow Up: I think I found what the error stems from,
when running configure, it goes back to the shared library of MKL and gets its path as (available in the configure log file):
/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler
which indeed its not a short path! so I guess this is raising the problem but I don't know how to force configure get short path! In addition, I am using Windows 8 64 bit, despite enabling 8.3 naming convention (Reg. Key set to 0) still I only get 8.3 name for some directories for example I don't get short path for Program Files and Program Files (x86).
Simple answer:
Intel MKL for windows does not provide compatibility with gnu compilers available with MingW!
Switched to OpenBlas and it was sorted.
Special Thanks goes to Tony Kelman.

OpenCV 2.3 doesn't compile, undefined reference error

I'm using OpenCV in Windows 7 64bits and Netbeans 7.0. I tried to compile the next code using MinGW and cygwin but both fails with undefined references.
When I use MAT or FLANN and others I can't compile, but I'm adding all libraries (I tried only adding Debug ones, Release ones, only needed ones... but fails).
The same code in ubuntu works, but I need to compile it in windows too. I'm using the 2.3 compiled version (using CMake) and the installable one.
#include "opencv2\opencv.hpp"
#include <iostream>
using namespace std;
int main(void)
{
cv::Mat::eye(1, 1, 0);
return 0;
}
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
rm -f -r build/Release
rm -f dist/Release/Cygwin-Windows/opencv23sandbox.exe
make[1]: Leaving directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
CLEAN SUCCESSFUL (total time: 1s)
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
"/usr/bin/make" -f nbproject/Makefile-Release.mk dist/Release/Cygwin-Windows/opencv23sandbox.exe
make[2]: Entering directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
mkdir -p build/Release/Cygwin-Windows
rm -f build/Release/Cygwin-Windows/main.o.d
g++.exe -c -O2 -I/cygdrive/C/OpenCV2.3/build/include -MMD -MP -MF build/Release/Cygwin-Windows/main.o.d -o build/Release/Cygwin-Windows/main.o main.cpp
mkdir -p dist/Release/Cygwin-Windows
g++.exe -o dist/Release/Cygwin-Windows/opencv23sandbox build/Release/Cygwin-Windows/main.o -L/cygdrive/C/OpenCV2.3/build/x86/vc10/lib -lopencv_calib3d230 -lopencv_calib3d230d -lopencv_contrib230 -lopencv_contrib230d -lopencv_core230 -lopencv_core230d -lopencv_features2d230 -lopencv_features2d230d -lopencv_flann230 -lopencv_flann230d -lopencv_gpu230 -lopencv_gpu230d -lopencv_haartraining_engine -lopencv_haartraining_engined -lopencv_highgui230 -lopencv_highgui230d -lopencv_imgproc230 -lopencv_imgproc230d -lopencv_legacy230 -lopencv_legacy230d -lopencv_ml230 -lopencv_ml230d -lopencv_objdetect230 -lopencv_objdetect230d -lopencv_video230 -lopencv_video230d
build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0xac): undefined reference to `cv::Mat::eye(int, int, int)'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x106): undefined reference to `cv::fastFree(void*)'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x16f): undefined reference to `cv::fastFree(void*)'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x1dd): undefined reference to `cv::fastFree(void*)'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x1fa): undefined reference to `cv::Mat::deallocate()'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x20a): undefined reference to `cv::Mat::deallocate()'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x21a): undefined reference to `cv::Mat::deallocate()'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x66): undefined reference to `cv::Mat::deallocate()'
build/Release/Cygwin-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x5e): undefined reference to `cv::fastFree(void*)'
collect2: ld returned 1make[2]: Leaving directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
make[1]: Leaving directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
exit status
make[2]: *** [dist/Release/Cygwin-Windows/opencv23sandbox.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
Trying with MinGW libs:
"/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory `/f/Proyectos/C++/OpenCV23Sandbox'
rm -f -r build/Release
rm -f dist/Release/MinGW-Windows/opencv23sandbox.exe
make[1]: Leaving directory `/f/Proyectos/C++/OpenCV23Sandbox'
CLEAN SUCCESSFUL (total time: 350ms)
"/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/f/Proyectos/C++/OpenCV23Sandbox'
"/bin/make" -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/opencv23sandbox.exe
make[2]: Entering directory `/f/Proyectos/C++/OpenCV23Sandbox'
mkdir -p build/Release/MinGW-Windows
rm -f build/Release/MinGW-Windows/main.o.d
g++.exe -c -O2 -I/C/OpenCV2.3/build/include -MMD -MP -MF build/Release/MinGW-Windows/main.o.d -o build/Release/MinGW-Windows/main.o main.cpp
mkdir -p dist/Release/MinGW-Windows
g++.exe -o dist/Release/MinGW-Windows/opencv23sandbox build/Release/MinGW-Windows/main.o -L../OpenCV/OpenCV2.3/build/x86/mingw/lib ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_calib3d230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_contrib230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_core230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_features2d230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_flann230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_gpu230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_highgui230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_imgproc230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_legacy230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_ml230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_objdetect230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_video230.dll.a
build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x4f): undefined reference to `cv::Mat::eye(int, int, int)'
build/Release/MinGW-Windows/main.o:main.cpp:(.text+0xac): undefined reference to `cv::fastFree(void*)'
build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x11a): undefined reference to `cv::fastFree(void*)'
build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x191): undefined reference to `cv::fastFree(void*)'
build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x1a7): undefined reference to `cv::Mat::deallocate()'
build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x1ba): undefined reference to `cv::Mat::deallocate()'
build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x1ce): undefined reference to `cv::Mat::deallocate()'
build/Release/MinGW-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x74): undefined reference to `cv::Mat::deallocate()'
build/Release/MinGW-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x63): undefined reference to `cv::fastFree(void*)'
collect2: ld returned 1 exit status
make[2]: Leaving directory `/f/Proyectos/C++/OpenCV23Sandbox'
make[1]: Leaving directory `/f/Proyectos/C++/OpenCV23Sandbox'
make[2]: *** [dist/Release/MinGW-Windows/opencv23sandbox.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
or
g++.exe -o dist/Release/MinGW-Windows/opencv23sandbox build/Release/MinGW-Windows/main.o -L../OpenCV/OpenCV2.3/build/x86/mingw/lib -lopencv_calib3d230.dll -lopencv_contrib230.dll -lopencv_core230.dll -lopencv_features2d230.dll -lopencv_flann230.dll -lopencv_gpu230.dll -lopencv_highgui230.dll -lopencv_imgproc230.dll -lopencv_legacy230.dll -lopencv_ml230.dll -lopencv_objdetect230.dll -lopencv_video230.dll
same result.
Are you using the precompiled MinGW libraries? (it appears so). I tried for a couple of days to get my project to link successfully under Code::Blocks. I was seeing the same sort of errors you describe (bad references, etc).
I finally recompiled OpenCV using the steps shown here, and all became well.
I guess the Problem is that the library path points to the vc10 directory (-L/cygdrive/C/OpenCV2.3/build/x86/vc10/lib) instead of the mingw directory (-L/cygdrive/C/OpenCV2.3/build/x86/mingw/lib). The ld-linker can't find the methods because they are mangled for the vc++ "link.exe".
If you use 64 bit, then you have also link against 64-bit libs:
-L/cygdrive/C/OpenCV2.3/build/x64/mingw/lib.
I have exactly the same issue. I am trying to compile my program under a 64-bit Windows 7 machine with MinGW. Here is several possibilities that may result in the problem:
1) You need to make sure OpenCV2.3/build/x64/mingw/lib is link. Be careful, don't link the project to the libs for visual studio or libs for x86.
2) Make sure the proper dlls are copied to the project directory, or have been added to PATH. For example, if you use this lib libopencv_core243.dll.a, you should make sure libopencv_core243.dll can be loaded by the project. This is not the cause of the problem. But I think it is also important to know.
3) Make sure the MinGW can compile x64 programs. This is what I use: mingw-w64 (But since mingw-w64 project is moving to mingw-w64.org it's better to use the new website). Unfortunately, the one that download from MinGW32 won't work. And the link from the official site of MinGW will bring you to a second one (MinGW32).
4) By default, MinGw may compile your project to a 32 bit program. In order to make sure it compiles for 64 bit, add this compile flag -m64. Otherwise, if you only link the project with all the 64-bit libs, it will result in the problem as well.