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.
Related
Background
I recently downloaded a lib called "RayLib" for c and c++. I added the mingw includes and libs into my project and well, now i wanna link them.
The problem
For some reason, cmake does not link the static lib. When i try to run the project, it tells me that there still undefined references to "InitWindow" and "SetTargetFPS" :
====================[ Build | Engine | Debug ]==================================
C:\Users\Lars\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\203.7148.70\bin\cmake\win\bin\cmake.exe --build C:\Users\Lars\CLionProjects\Engine\cmake-build-debug --target Engine -- -j 9
C:\Users\Lars\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\203.7148.70\bin\cmake\win\bin\cmake.exe -SC:\Users\Lars\CLionProjects\Engine -BC:\Users\Lars\CLionProjects\Engine\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
C:/Users/Lars/Desktop/Development/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 Engine
mingw32-make.exe[1]: Entering directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
C:\Users\Lars\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\203.7148.70\bin\cmake\win\bin\cmake.exe -SC:\Users\Lars\CLionProjects\Engine -BC:\Users\Lars\CLionProjects\Engine\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
C:\Users\Lars\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\203.7148.70\bin\cmake\win\bin\cmake.exe -E cmake_progress_start C:\Users\Lars\CLionProjects\Engine\cmake-build-debug\CMakeFiles 2
C:/Users/Lars/Desktop/Development/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 CMakeFiles/Engine.dir/all
mingw32-make.exe[2]: Entering directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
C:/Users/Lars/Desktop/Development/MinGW/bin/mingw32-make.exe -f CMakeFiles\Engine.dir\build.make CMakeFiles/Engine.dir/depend
mingw32-make.exe[3]: Entering directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
C:\Users\Lars\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\203.7148.70\bin\cmake\win\bin\cmake.exe -E cmake_depends "MinGW Makefiles" C:\Users\Lars\CLionProjects\Engine C:\Users\Lars\CLionProjects\Engine C:\Users\Lars\CLionProjects\Engine\cmake-build-debug C:\Users\Lars\CLionProjects\Engine\cmake-build-debug C:\Users\Lars\CLionProjects\Engine\cmake-build-debug\CMakeFiles\Engine.dir\DependInfo.cmake --color=
mingw32-make.exe[3]: Leaving directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
C:/Users/Lars/Desktop/Development/MinGW/bin/mingw32-make.exe -f CMakeFiles\Engine.dir\build.make CMakeFiles/Engine.dir/build
mingw32-make.exe[3]: Entering directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
[ 50%] Linking CXX executable Engine.exe
C:\Users\Lars\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\203.7148.70\bin\cmake\win\bin\cmake.exe -E cmake_link_script CMakeFiles\Engine.dir\link.txt --verbose=1
C:\Users\Lars\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\203.7148.70\bin\cmake\win\bin\cmake.exe -E rm -f CMakeFiles\Engine.dir/objects.a
C:\Users\Lars\Desktop\Development\MinGW\bin\ar.exe cr CMakeFiles\Engine.dir/objects.a #CMakeFiles\Engine.dir\objects1.rsp
C:\Users\Lars\Desktop\Development\MinGW\bin\g++.exe -Wall -std=c++17 -g -Wl,--whole-archive CMakeFiles\Engine.dir/objects.a -Wl,--no-whole-archive -o Engine.exe -Wl,--out-implib,libEngine.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\Engine.dir\linklibs.rsp
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\Engine.dir/objects.a(main.cpp.obj): in function `main':
C:/Users/Lars/CLionProjects/Engine/main.cpp:22: undefined reference to `InitWindow'
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Users/Lars/CLionProjects/Engine/main.cpp:24: undefined reference to `SetTargetFPS'
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Users/Lars/CLionProjects/Engine/main.cpp:28: undefined reference to `WindowShouldClose'
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Users/Lars/CLionProjects/Engine/main.cpp:37: undefined reference to `BeginDrawing'
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Users/Lars/CLionProjects/Engine/main.cpp:39: undefined reference to `ClearBackground'
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Users/Lars/CLionProjects/Engine/main.cpp:41: undefined reference to `DrawText'
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Users/Lars/CLionProjects/Engine/main.cpp:43: undefined reference to `EndDrawing'
c:/users/lars/desktop/development/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Users/Lars/CLionProjects/Engine/main.cpp:49: undefined reference to `CloseWindow'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [Engine.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles/Engine.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles/Engine.dir/rule] Error 2
mingw32-make.exe: *** [Engine] Error 2
CMakeFiles\Engine.dir\build.make:108: recipe for target 'Engine.exe' failed
mingw32-make.exe[3]: Leaving directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
CMakeFiles\Makefile2:97: recipe for target 'CMakeFiles/Engine.dir/all' failed
mingw32-make.exe[2]: Leaving directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
CMakeFiles\Makefile2:104: recipe for target 'CMakeFiles/Engine.dir/rule' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Lars/CLionProjects/Engine/cmake-build-debug'
Makefile:140: recipe for target 'Engine' failed
My cmake file looks like this...
cmake_minimum_required(VERSION 3.17)
project(Engine)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_VERBOSE_MAKEFILE ON)
include_directories(include)
include_directories(libs)
link_directories(libs)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++17")
add_executable(Engine main.cpp)
target_link_libraries(Engine raylib)
My own written make file, located in the root which simply adds a -I include, -L libs and -lraylib is able to compile this project.
main: main.o
g++ -I include ... -o main main.o -L libs -lraylib
main.o: main.cpp
g++ -I include ... -c main.cpp -L libs -lraylib
Question
Why exactly does target_link_libraries not work ? Why doesnt it link my .a file located in libs/ ? What am i doing wrong here ? Why isnt Cmake able to link my project, but my own makefile is able to do it ?
Any help is welcome !
From the documentation about the command link_directories():
This command is rarely necessary and should be avoided where there are other choices. Prefer to pass full absolute paths to libraries where possible, since this ensures the correct library will always be linked. The find_library() command provides the full path, which can generally be used directly in calls to target_link_libraries().
find_library() is hopefully sufficient by itself.
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.
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.
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.
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.