libfreefare mingw32-make error on windows - nfc

I am on windows 8 64 bits.
I have installed successfully libnfc, and I am able to use the .exe examples that are in libnfc\utils (like nfc-mfclassic.exe; nfc-list.exe ...)
I would like to manipulate Mifare cards and use NDEF Format, so I am trying to install libfreefare on Windows.
I have followed a tutorial on libnfc.org showing how to have libfreefare on Windows and It worked fine.
And I used cmake-gui to generate build file
Coming now to the step of mingw32-make, I have this error :
[ 55%] Building C object libfreefare/CMakeFiles/freefare.dir/tlv.c.obj
Linking C shared library libfreefare.dll
CMakeFiles\freefare.dir/objects.a(mifare_desfire.c.obj):mifare_desfire.c:(.text+0x64f): undefined reference to `RAND_bytes'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x1219): undefined reference to `DES_ecb_encrypt'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x1242): undefined reference to `DES_ecb_encrypt'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x1280): undefined reference to `DES_ecb_encrypt'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x12a9): undefined reference to `DES_ecb_encrypt'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x12d0): undefined reference to `DES_ecb_encrypt'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x12f9): more undefined references to `DES_ecb_encrypt' follow
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x1489): undefined reference to `AES_set_encrypt_key'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x14a8): undefined reference to `AES_encrypt'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x14c7): undefined reference to `AES_set_decrypt_key'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_crypto.c.obj):mifare_desfire_crypto.c:(.text+0x14e6): undefined reference to `AES_decrypt'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_key.c.obj):mifare_desfire_key.c:(.text+0x17): undefined reference to `DES_set_key'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_key.c.obj):mifare_desfire_key.c:(.text+0x32): undefined reference to `DES_set_key'
CMakeFiles\freefare.dir/objects.a(mifare_desfire_key.c.obj):mifare_desfire_key.c:(.text+0x58): undefined reference to `DES_set_key'
CMakeFiles\freefare.dir/objects.a(mifare_ultralight.c.obj):mifare_ultralight.c:(.text+0x7a3): undefined reference to `DES_random_key'
collect2.exe: error: ld returned 1 exit status
libfreefare\CMakeFiles\freefare.dir\build.make:351: recipe for target 'libfreefare/libfreefare.dll' failed
mingw32-make[2]: *** [libfreefare/libfreefare.dll] Error 1
CMakeFiles\Makefile2:74: recipe for target 'libfreefare/CMakeFiles/freefare.dir/all' failed
mingw32-make[1]: *** [libfreefare/CMakeFiles/freefare.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Thanks for your help !!

I've found a solution :
At the root of the folder : libfreefare-0.4.0 there is CMakeLists.txt
I replaced this line :
set(LIBS ${LIBS} ${LIBNFC_LIBRARIES} ${OPENSSL_LIBRARIES})
by this one
set(LIBS ${LIBS} ${LIBNFC_LIBRARIES} D:/tools/OpenSSL-Win32/libeay32.dll D:/tools/OpenSSL-Win32/libssl32.dll)
And it worked fine ! Thanks #MichaelRoland for the tips on libcrypto equivalent

Related

How to configure ffmpeg with libsrt (Secure Reliable Transport) protocol?

I want to configure ffmpeg with libsrt (Secure Reliable Transport) protocol on linux-Ubuntu OS, I followed the steps from this link
But when run $./configure --enable-libsrt command it gives me an error:
ERROR: srt >= 1.3.0 not found using pkg-config
I modified the configuration file, it executed the above command but when i run $ make command it end up with the following errors:
LD ffmpeg_g
libavformat/libavformat.so: undefined reference to `srt_socket'
libavformat/libavformat.so: undefined reference to `srt_bind'
libavformat/libavformat.so: undefined reference to `srt_getsockopt'
libavformat/libavformat.so: undefined reference to `srt_close'
libavformat/libavformat.so: undefined reference to `srt_epoll_add_usock'
libavformat/libavformat.so: undefined reference to `srt_startup'
libavformat/libavformat.so: undefined reference to `srt_connect'
libavformat/libavformat.so: undefined reference to `srt_epoll_release'
libavformat/libavformat.so: undefined reference to `srt_listen'
libavformat/libavformat.so: undefined reference to `srt_getlasterror'
libavformat/libavformat.so: undefined reference to `srt_getlasterror_str'
libavformat/libavformat.so: undefined reference to `srt_cleanup'
libavformat/libavformat.so: undefined reference to `srt_setsockopt'
libavformat/libavformat.so: undefined reference to `srt_sendmsg'
libavformat/libavformat.so: undefined reference to `srt_clearlasterror'
libavformat/libavformat.so: undefined reference to `srt_epoll_wait'
libavformat/libavformat.so: undefined reference to `srt_epoll_remove_usock'
libavformat/libavformat.so: undefined reference to `srt_epoll_create'
libavformat/libavformat.so: undefined reference to `srt_recvmsg'
libavformat/libavformat.so: undefined reference to `srt_accept'
collect2: error: ld returned 1 exit status
Makefile:108: recipe for target 'ffmpeg_g' failed
make: *** [ffmpeg_g] Error 1
What are exact steps to enable libsrt with ffmpeg ? Am i missing anything ? Is there any patch i have to add to existing ffmpeg source ?
Thanks in advance !!!
The answer you referred to assumes the question asker was following the Ubuntu compile guide on the FFmpeg Wiki (because they claimed to be doing so). The compile guide "installs" external libraries into ~/ffmpeg_build for a variety of reasons. The libsrt instructions in that answer does the same to fit with the wiki article. Therefore, it is expected that you will use the additional compilation options as shown in the wiki to deal with this when compiling ffmpeg.
Undo whatever changes you made to configure.
Follow the linked answer and compile libsrt if you haven't already.
Now compile ffmpeg.
make distclean
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --enable-libsrt --pkg-config-flags="--static"
Alternatively, if you don't want to have to use most of those extra options then omit -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" when compiling libsrt.

MINGW64 cannot find reference to libcrypt

I have problem with building my C++ project using CLion, MINGw64.
So this is the problem I cannot handle with ._.
Everything works on Linux but on Win10 I have this log:
libBiblioteka.a(Rent.cpp.obj): In function `boost::uuids::detail::random_provider_base::random_provider_base()':
C:/msys64/mingw64/include/boost/uuid/detail/random_provider_bcrypt.ipp:40: undefined reference to `BCryptOpenAlgorithmProvider'
libBiblioteka.a(Rent.cpp.obj): In function `boost::uuids::detail::random_provider_base::get_random_bytes(void*, unsigned long long)':
C:/msys64/mingw64/include/boost/uuid/detail/random_provider_bcrypt.ipp:76: undefined reference to `BCryptGenRandom'
libBiblioteka.a(Rent.cpp.obj): In function `boost::uuids::detail::random_provider_base::destroy()':
C:/msys64/mingw64/include/boost/uuid/detail/random_provider_bcrypt.ipp:93: undefined reference to `BCryptCloseAlgorithmProvider'
collect2.exe: error: ld returned 1 exit status
I have read these references are unavaiable on win10. But there is an question:
Is there any way to workaround this?
Those are not defined in libcrypt but in libbcrypt.
Did you have the same typo in your linker flags (you should have -lbcrypt)?

net-snmp flags in CMAKE

Before anything, I just want to say I am very new to CMAKE, almost never used it but now forced to...
I am trying to include snmp features in a previous project, using Net-SNMP library. But first, I wrote a minimalistic code just to test my functions. According to the library tutorial, this is how I must compile the code:
First, I must create object file:
gcc -I. `net-snmp-config --cflags` -c -o tfsnmpset.o tfsnmpset.c
Then, I must generate the executable:
gcc -o tfsnmpset tfsnmpset.o `net-snmp-config --libs`
By doing this, the program compiles perfectly and everything is fine.
Now the project in which I want to incorporate that piece of code uses CMakeLists.txt to generate its makefile.
My question is, how do I include the following flags in my CMakeLists.txt?
When creating object files: `net-snmp-config --cflags`
When generating executable: `net-snmp-config --libs`
I actually tried to build a library out of my code that uses Net-SNMP that I could just use in my main project:
cmake_minimum_required(VERSION 3.12)
project(snmp_daemon C)
set(CMAKE_C_STANDARD 99)
SET(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I. `net-snmp-config --cflags`" )
add_library(tfsnmpset tfsnmp.c tfsnmp.h)
add_executable(snmp_daemon main.c ./tfsnmp.h)
target_link_libraries(snmp_daemon tfsnmpset)
The errors:
/media/user/xtra/apps/clion-2018.2.1/bin/cmake/linux/bin/cmake --build /home/fabrice/projects/snmp-daemon/cmake-build-debug --target snmp_daemon -- -j 2
[ 25%] Linking C static library libtfsnmpset.a
[ 50%] Built target tfsnmpset
[ 75%] Linking C executable snmp_daemon
libtfsnmpset.a(tfsnmp.c.o): In function `tfsnmpset':
/home/user/projects/snmp-daemon/tfsnmp.c:121: undefined reference to `snmp_parse_args'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `snmp_get_do_debugging'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsgtoken'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsg'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsgtoken'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsg'
/home/user/projects/snmp-daemon/tfsnmp.c:194: undefined reference to `snmp_open'
/home/user/projects/snmp-daemon/tfsnmp.c:199: undefined reference to `snmp_sess_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:207: undefined reference to `snmp_pdu_create'
/home/user/projects/snmp-daemon/tfsnmp.c:210: undefined reference to `snmp_parse_oid'
/home/user/projects/snmp-daemon/tfsnmp.c:211: undefined reference to `snmp_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:214: undefined reference to `snmp_add_var'
/home/user/projects/snmp-daemon/tfsnmp.c:216: undefined reference to `snmp_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:222: undefined reference to `snmp_close'
/home/user/projects/snmp-daemon/tfsnmp.c:230: undefined reference to `snmp_synch_response'
/home/user/projects/snmp-daemon/tfsnmp.c:236: undefined reference to `print_variable'
/home/user/projects/snmp-daemon/tfsnmp.c:239: undefined reference to `snmp_errstring'
/home/user/projects/snmp-daemon/tfsnmp.c:247: undefined reference to `fprint_objid'
/home/user/projects/snmp-daemon/tfsnmp.c:257: undefined reference to `snmp_sess_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:262: undefined reference to `snmp_free_pdu'
/home/user/projects/snmp-daemon/tfsnmp.c:263: undefined reference to `snmp_close'
collect2: error: ld returned 1 exit status
CMakeFiles/snmp_daemon.dir/build.make:84: recipe for target 'snmp_daemon' failed
make[3]: *** [snmp_daemon] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/snmp_daemon.dir/all' failed
make[2]: *** [CMakeFiles/snmp_daemon.dir/all] Error 2
CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/snmp_daemon.dir/rule' failed
make[1]: *** [CMakeFiles/snmp_daemon.dir/rule] Error 2
Makefile:118: recipe for target 'snmp_daemon' failed
make: *** [snmp_daemon] Error 2
You should link to snmp libraries
find_library(NETSNMPAGENT "netsnmpagent")
find_library(NETSNMPMIBS "netsnmpmibs")
find_library(NETSNMP "netsnmp")
target_link_libraries(snmp_daemon tfsnmpset ${NETSNMPAGENT} ${NETSNMPMIBS} ${NETSNMP})

scalasca cube linking error

I'm trying to install cube library,required for installing SCALASCA.I've installed already PAPI,OPARI and Qt.I also installed zlib both from source and by apt-get.But during cube linking(make command) an error occurs refering to some classes of zlib.
This is the configuration command i use:
./configure --prefix=/opt/cube-4.2.2 --with-qt=/opt/Qt --with-frontend-zlib=/usr/include/i386-linux-gnu --with-compression=full
this is the output from configuration: cube lib configuration output
and this is the make output: cube lib make command output
The error:
./.libs/libcube4.so: undefined reference to `gzofstream::gzofstream()'
./.libs/libcube4.so: undefined reference to `gzifstream::gzifstream(int, std::_Ios_Openmode)'
./.libs/libcube4.so: undefined reference to `gzifstream::gzifstream()'
./.libs/libcube4.so: undefined reference to `gzfilebuf::~gzfilebuf()'
./.libs/libcube4.so: undefined reference to `gzifstream::open(char const*, std::_Ios_Openmode)'
./.libs/libcube4.so: undefined reference to `gzofstream::close()'
./.libs/libcube4.so: undefined reference to `gzofstream::open(char const*, std::_Ios_Openmode)'
./.libs/libcube4.so: undefined reference to `gzifstream::close()'
collect2: error: ld returned 1 exit status
I'm using xubuntu 14.04 on vmware

Suricata luajit compilation error

I'm currently trying to compile suricata (http://suricata-ids.org/) with luajit support on my arch linux distribution with these commands:
./configure --enable-luajit --with-libpcap-includes=/usr/local/pfring/include \
--with-libpcap-libraries=/usr/local/pfring/lib --with-libnss-libraries=/usr/lib \
--with-libnss-includes=/usr/include/nss/ --with-libnspr-libraries=/usr/lib \
--with-libnspr-includes=/usr/include/nspr \
--with-libluajit-includes=/usr/local/include/luajit-2.0/ \
--with-libluajit-libraries=/usr/lib/
then:
make
but I get the following errors when I make the project:
detect-luajit.o: In function `LuaDumpStack':
detect-luajit.c:(.text+0x46e): undefined reference to `lua_tonumberx'
detect-luajit.o: In function `DetectLuajitMatchBuffer':
detect-luajit.c:(.text+0x5d6): undefined reference to `lua_getglobal'
detect-luajit.c:(.text+0x6b9): undefined reference to `lua_pcallk'
detect-luajit.c:(.text+0x7d5): undefined reference to `lua_tonumberx'
detect-luajit.o: In function `DetectLuajitMatch':
detect-luajit.c:(.text+0xaac): undefined reference to `lua_getglobal'
detect-luajit.c:(.text+0xde4): undefined reference to `lua_pcallk'
detect-luajit.c:(.text+0xf00): undefined reference to `lua_tonumberx'
detect-luajit.o: In function `DetectLuajitThreadInit':
detect-luajit.c:(.text+0x1864): undefined reference to `lua_pcallk'
detect-luajit.o: In function `DetectLuaSetupPrime':
detect-luajit.c:(.text+0x1fe7): undefined reference to `lua_pcallk'
detect-luajit.c:(.text+0x2167): undefined reference to `lua_getglobal'
detect-luajit.c:(.text+0x24bf): undefined reference to `lua_pcallk'
collect2: error: ld returned 1 exit status
make[2]: *** [suricata] Error 1
I first though it was an issue coming from the lua version. So I tried to install both the lua 5.1.5 and 5.2.2, remaking the library and symbolic links as well, and nothing worked.
Thanks for your help
In Debian and Ubuntu, the library files are installed into /usr/lib/x86_64-linux-gnu/. If arch does the same, your configure line should include: --with-libluajit-libraries=/usr/lib/x86_64-linux-gnu/

Resources