Closed moowgle closed 4 years ago
Looks like you're building with C++11 or later as the symbol: __imp__ZN5Exiv212ImageFactory4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
is the mangled version of __imp_Exiv2::ImageFactory::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
, which doesn't exist.
Please try to build it with C++98 instead.
@D4N I try out when I get back home. Is there no exiv2 c++11 version? I don't think that newer Qt version will ever target anything lower than c++11...
What I've found interesting is that if I install exiv2 over homebrew on my mac and build my application on this side with the same Qt version (only difference is that I am using clang there) anything works fine as I would expect...
@D4N I tried another Qt project from work to target with -std=c++98
but Qt instantly gives me the error that I atleast need to use c++11.
@D4N I try out when I get back home. Is there no exiv2 c++11 version?
Currently only the master branch unfortunately...
Is there any technical reason for that? I just tried on 0.27, other then spitting out a shitload of warnings, it's building fine.
@D4N then I‘ll need to try building it myself..
@phako did you also use the prebuilt binaries?
@dublin19 No I meant building exiv2 stable with c++11
@phako I'm going to try out. Is there any possible way to NOT use msys and use the shipped mingw with Qt? I have no experience with msys.
Looks like it worked! I test out and give feedback.
It doesn't sound as though you can use the pre-built MinGW/msys2 binary with Qt. The prebuilt binaries are tested with the test suite. And they are documented (and tested) to link a command-line program (exifprint.cpp). And it's all done with -std=c++98
I think you'll have to build the Exiv2 library with the compiler/linker supported by Qt. I seem to recall that Qt supports various compilers on Windows (various GCC and editions of MSVC). You cannot mix these platforms. I understand that name-mangling isn't part of the C++ standard, so you have to use a single set of tools to successfully link.
It worked fine with Qt's shipped mingw, I get a .dll.a
and .dll
output. Do I need to use something like cmake install
to get the include
folder filled? Inside this folder there are just some cmake files and no real usable output.
Running mingw32-make install
works just fine.
So linking to exiv2 works fine but now I have a problem. When using
Exiv2::Image::UniquePtr img = Exiv2::ImageFactory::open("D:/IRL/GE5A0435.CR2");
the program just crashs on startup, no message, nothing.
My .pro
file looks like this:
QT += core gui widgets multimedia sql
TARGET = RawImageDisplayer
TEMPLATE = app
CONFIG += c++11
SOURCES += main.cpp \
MainWindow.cpp \
EmbeddedImage.cpp \
exif.cpp \
imagepreview.cpp
HEADERS += MainWindow.h \
EmbeddedImage.h \
exif.h \
imagepreview.h
INCLUDEPATH += $$quote("C:/Program Files (x86)/exiv2/include")
LIBS += $$quote("C:/Program Files (x86)/exiv2/lib/libexiv2.dll.a")
Are you sure you have libexiv2.dll on the PATH?
@clanmills I have the whole BIN folder in my PATH. So including libexiv2.dll
.
@clanmills GENIUS! I investigated the PATH variable inside QtCreator and found it did not use the new changes stating back to my old folder. Resetting my Qt Creator PATH to the systems path and voilà, it works!
Hello, i have a question to setup Exiv2 with Qt. You just download the code for MinGW64 from the homepage and include it to your project? or you build Exiv2 from source? If you build it from source: how you do that?
Thanks a lot
There's a pre-release of Exiv2 v0.27.3 RC1 which was release yesterday at https://pre-release.exiv2.org
I believe the MinGW/msys2 build will link with Qt.
Have a read at README.md in the distribution bundle. In Section 5, I've included platform notes including what you'll need to install with pacman. I know the documentation is solid, because I use it when I need a new MinGW/msys machine set up.
Once you have the dependencies installed, it's a conventional "unix style build":
$ cd <exiv2dir>
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make install
From README.md
Please note that the platform MinGW/msys2 32 is obsolete and superceded by MinGW/msys2 64.
There is a discussion on the web about installing GTest: https://github.com/Exiv2/exiv2/issues/575
Install: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20190524.exe
I use the following batch file to start the MinGW/msys2 64 bit bash shell from the Dos Command Prompt (cmd.exe)
@echo off
setlocal
set "PS1=\! MSYS64:\u@\h:\w \$ "
set PATH="/usr/local/bin/:/usr/bin:/mingw64/bin:/bin:/usr/sbin:/sbin"
set "HOME=c:\msys64\home\%USERNAME%"
if NOT EXIST %HOME% mkdir %HOME%
cd %HOME%
c:\msys64\usr\bin\bash.exe -norc
endlocal
Install tools and dependencies:
$ for i in base-devel git cmake coreutils python3 man gcc gdb make dos2unix diffutils zlib-devel libexpat-devel libiconv-devel gettext-devel; do (echo y|pacman -S $i); done
$ mkdir -p ~/gnu/github/exiv2
$ cd ~/gnu/github/exiv2
$ git clone https://github.com/exiv2/exiv2
$ cd exiv2
$ mkdir build ; cd build ;
$ cmake .. -G "Unix Makefiles"
$ make
The exiv2 command line program provides an option --grep
to filter output. The implementation requires the header file <regex.h>
and supporting library to be available during the build. When not available, the option --grep
degrades to a substring match. Because there are several versions of <regex.h>
available on the MinGW platform, detection of regex is always disabled on this platform and uses substring match. The following command reveals if regex is included in your build:
$ exiv2 -vVg regex
exiv2 0.27.1
have_regex=1
$
Thanks a lot for your fast response. I followed the instructions and got a good build.
Then i add the include folder and libs to my Qt project:
INCLUDEPATH += $$quote("E:/msys64/usr/local/include")
LIBS += $$quote("E:/msys64/usr/local/lib/libexiv2.dll.a")
After that i try to build my project and get the following error:
undefined reference to `__imp__ZN5Exiv212ImageFactory4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb'
I also get a lot of deprecated warnings like:
Warnung: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
What did i missed?
Are you building 0.27.2 or 0.27.3?
With 0.27.3 you'll get 2305 of those warnings! Our C++11 support is in 'master'. 0.27 is our "legacy code" and the dots (0.27.1, 0.27.2 and now 0.27.3) are "maintenance releases". I've been talking to the Team this morning about adding C++11 support to 0.27.3 (or more likely 0.27.4)
Relax. I'll help you. You'll be up and running today.
Thanks again fort he fast response. I tried different versions: 0.27.3.1, 0.27.2 and 0.27. Error is always the same.
Now i tried to build the current master branch. There i get an build error at 33%:
futils.cpp: In function 'std::vector<std::basic_string<char> > Exiv2::getLoadedLibraries()': futils.cpp:530:29: error: '_MAX_PATH' was not declared in this scope char szFilename[_MAX_PATH];
Thanks for the support
I'll have a look at master, Simon. I don't work on the project on 'master' (0.28).
I've done a lot of work today on C++11 for v0.27.3 RC2 which is scheduled for 2020-05-31 and I'm the release engineer for that.
To build 0.27.2, can you try:
$ cd <exiv2dir>
$ rm -rf build
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated`
$ make
Here's the patch for 'master'. I also fix a compiler warning in src/types.cpp. I'll submit a PR for this when we're done and you're up-and-running.
This is curious discovery about _MAX_PATH and src/futils.cpp. I wrote that code and have never seen that error.
514 MSYS rmills@rmillsmm-w10:~/gnu/github/exiv2/master/build $ git diff
diff --git a/src/futils.cpp b/src/futils.cpp
index 9b8d3478..14377d6d 100644
--- a/src/futils.cpp
+++ b/src/futils.cpp
@@ -68,6 +68,10 @@
# include <libprocstat.h>
#endif
+#ifndef _MAX_PATH
+#define _MAX_PATH 1024
+#endif
+
namespace Exiv2 {
const char* ENVARDEF[] = {"/exiv2.php", "40"}; //!< @brief default URL for http exiv2 handler and time-out
const char* ENVARKEY[] = {"EXIV2_HTTP_POST", "EXIV2_TIMEOUT"}; //!< @brief request keys for http exiv2 handler and time-out
diff --git a/src/types.cpp b/src/types.cpp
index 72df2a3d..961ffb9f 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -612,7 +612,7 @@ namespace Exiv2 {
const int len = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), slength, 0, 0, 0, 0);
// conversion failed => return an empty string
- if (len == static_cast<std::size_t>(-1)) {
+ if (len == -1) {
return std::string("");
}
char* buf = new char[len];
515 MSYS rmills@rmillsmm-w10:~/gnu/github/exiv2/master/build $
With build 0.27.2 and:
$ cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated
I got a good build but the same error in my Qt project...
Now i tried to build your fixed code. There i got a new error during configuration:
CMake Error at /usr/share/cmake-3.14.3/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) Call Stack (most recent call first): /usr/share/cmake-3.14.3/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.14.3/Modules/FindGTest.cmake:197 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) unitTests/CMakeLists.txt:1 (find_package)
Tomorrow i will have a new try. Have a nice evening and thanks a lot for your help ;)
Relax. You're home. You have to install gtest. Read this: https://github.com/Exiv2/exiv2/issues/575
Download and install gtest 1.8.0. I mentioned this above. Build Engineering is tough. You have my sympathy (I suffer with and for you). https://github.com/Exiv2/exiv2/issues/1101#issuecomment-622492441
I'm happy to help you because you're polite. Many users are not!
When you say "Now i tried to build your fixed code.". Which version are you using?
A user was shouting at me on Friday because the default for -DEXIV2_BUILD_UNIT_TESTS=0
, so I changed it on 0.27-maintenance. On Saturday, I changed my mind. The decision that the default for UNIT_TESTS
should be OFF as most users don't want the inconvenience of installing gtest. Our unit_tests are about 1% of our test suite. I'm not sure I've ever seen any of them fail!
Bottom line: I'm surprised CMAKE is search for gtest. I only made that the default on 0.27-maintenance for a few hours on Saturday.
With build 0.27.2 and: $ cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated I got a good build but the same error in my Qt project...
I think he was trying to build 0.27.2, so that we were overriding the value of CMAKE_CXX_STANDARD
there in our CMake code.
@Simon-12 Try to checkout the latest version in the 0.27-maintenance
branch and configure the project with:
cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated -DEXIV2_BUILD_UNIT_TESTS=OFF
In that case, the Unit Tests should be disabled and CMake should not try to find the GTest library.
@clanmills thank you for the nice words. Iam curious to learn this and want this running. I downloaded the code yesterday. Maybe exactly at the same time you changed something ;)
Today for the new try i downloaded from the 0.27-maintenance branch and used the configuration from @piponazo There i got a good build but still the same error in my Qt project...
Maybe i missed something in Qt? Or the version are incompatible? I will doing some researches...
@Simon-12 I'm going to set up Qt and see if I can reproduce your troubles. Which version of Qt are you using?
It has been very helpful to work with you. I knew there was something incorrect in the build concerning C++11. We took the decision (2 years ago) to support C++11 in v0.28 and v0.27 would remain C++98. I think @piponazo and I fixed v0.27/C++11 yesterday. 0.27-maintenance still has the default of EXIV2_BUILD_UNIT_TESTS=On
. I will revert that to Off.
A few years ago (for v0.25, I think), I was building Exiv2 for MinGW (not msys2) and had a Qt .pro file to compile and link samples/exifprint in the build script. Maybe I should consider bringing that back to life. I removed that because I announced that Exiv2/MinGW support was being dropped. Then msys2 came along and darktable asked me to support that. I haven't looked at Qt for years. Time for a trip down that road.
That's sounds great!
I use: Qt 5.14.0 MinGW 64-bit (MinGW 7.3 64-bit got installed with Qt)
Right. It's busy pulling down 5.14 with GCC 8.1/64. Close enough. I want to look at 8.1. There was a problem with GCC 8.2 building the Exiv2 dll. I'll update you later.
It's been a while since I used Qt. I know I liked it. Friends of mine in California rewrote Qt in C++ (to avoid mock) and use C++ object references everywhere. It's called CopperSpice.
No problem. It's working. I'll restore contrib/Qt into 0.27-maintenance. Give this a shot and we'll talk later. There are three files.
contrib/Qt/commandLineTool.pro
QT += core
QT -= gui
TARGET = commandLineTool
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
win32 {
INCLUDEPATH += $$quote(c:/Qt/5.14.2/mingw73_64/include)
INCLUDEPATH += /usr/local/include
LIBS += -L$$quote(c:/Qt/5.14.2/mingw73_64/include) -L/usr/local/lib -lexiv2
}
contrib/Qt/main.cpp
#include <QCoreApplication>
#include <exiv2/exiv2.hpp>
#include <iostream>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
exv_grep_keys_t keys;
Exiv2::dumpLibraryInfo(std::cout,keys);
return 0;
// return a.exec();
}
Build and Run
543 MSYS rmills@rmillsmm-w10:~/gnu/github/exiv2/0.27-maintenance/contrib/Qt $ qmake ; make -B
C:/Qt/5.14.2/mingw73_64/bin/qmake.exe -o Makefile commandLineTool.pro
make -f Makefile.Release
make[1]: Entering directory '/home/rmills/gnu/github/exiv2/0.27-maintenance/contrib/Qt'
g++ -c -fno-keep-inline-dllexport -O2 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_CORE_LIB -I. -Ic:/Qt/5.14.2/mingw73_64/include -isystem /usr/local/include -IC:/Qt/5.14.2/mingw73_64/include -IC:/Qt/5.14.2/mingw73_64/include/QtCore -Irelease -IC:/Qt/5.14.2/mingw73_64/mkspecs/win32-g++ -o release/main.o main.cpp
g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release/commandLineTool.exe release/main.o -Lc:/Qt/5.14.2/mingw73_64/include -L/usr/local/lib -lexiv2 C:/Qt/5.14.2/mingw73_64/lib/libQt5Core.a
make[1]: Leaving directory '/home/rmills/gnu/github/exiv2/0.27-maintenance/contrib/Qt'
544 MSYS rmills@rmillsmm-w10:~/gnu/github/exiv2/0.27-maintenance/contrib/Qt $ ./commandLineTool.exe
exiv2=0.27.3
platform=msys
compiler=G++
bits=64
dll=1
debug=1
cplusplus=201103
version=7.4.0
date=May 3 2020
time=17:16:30
processpath=/home/rmills/gnu/github/exiv2/0.27-maintenance/contrib/Qt
package_name=exiv2
curl=0
executable=C:\msys64\home\rmills\gnu\github\exiv2\0.27-maintenance\contrib\Qt\commandLineTool.exe
library=C:\WINDOWS\SYSTEM32\ntdll.dll
library=C:\WINDOWS\System32\KERNEL32.DLL
library=C:\WINDOWS\System32\KERNELBASE.dll
library=C:\msys64\usr\bin\msys-2.0.dll
library=C:\msys64\usr\bin\msys-stdc++-6.dll
library=C:\msys64\usr\local\bin\msys-exiv2-27.dll <-- Exiv2 is in memory
library=C:\Qt\5.14.2\mingw73_64\bin\Qt5Core.dll <-- Qt5Core is in memory
library=C:\WINDOWS\System32\ADVAPI32.dll
library=C:\WINDOWS\System32\WS2_32.dll
library=C:\WINDOWS\System32\msvcrt.dll
library=C:\WINDOWS\System32\RPCRT4.dll
library=C:\WINDOWS\System32\sechost.dll
library=C:\WINDOWS\System32\ole32.dll
library=C:\WINDOWS\System32\combase.dll
library=C:\WINDOWS\System32\ucrtbase.dll
library=C:\msys64\usr\bin\msys-gcc_s-seh-1.dll
library=C:\WINDOWS\System32\bcryptPrimitives.dll
library=C:\WINDOWS\System32\GDI32.dll
library=C:\WINDOWS\System32\win32u.dll
library=C:\WINDOWS\System32\gdi32full.dll
library=C:\WINDOWS\System32\msvcp_win.dll
library=C:\WINDOWS\System32\USER32.dll
library=C:\msys64\usr\bin\msys-expat-1.dll
library=C:\WINDOWS\System32\SHELL32.dll
have_strerror_r=1
... stuff deleted ...
xmlns=xmpidq:http://ns.adobe.com/xmp/Identifier/qual/1.0/
545 MSYS rmills@rmillsmm-w10:~/gnu/github/exiv2/0.27-maintenance/contrib/Qt $
contrib/Qt/ReadMe.txt
contrib/Qt/ReadMe.txt
---------------------
Exiv2 works well with Qt.
Qt requires C++11 libraries which are the default for Exiv2 v0.28 and later.
Exiv2 v0.27 default build (and pre-built binaries) are for C++98
You will have to build Exiv2 v0.27 from source with C++11 for Qt.
To build and run commandLineTool
--------------------------------
1) Windows Users should install MinGW/msys2 as documented in README.md
2) All users should build Exiv2 with C++11 support as documented in README.md
3) Generate Makefile
Caution: You will have to modify commandLineTool.pro to fit your environment.
$ cd <exiv2dir>
$ cd contrib/Qt
$ qmake commandLinePro.pro
4) Build commandLineTool.cpp
$ make
5) Run commandLineTool.exe
$ commandLineTool.exe
UNICODE_PATH on Windows
-----------------------
Windows users may prefer to build Exiv2 to support UNICODE_PATH.
The sample application samples/exifprint.cpp works with UNICODE_PATH.
The cmake option -DEXIV2_ENABLE_WIN_UNICODE=ON is documented in README.md
Searching for more information about Qt, MinGW and UNICODE_PATH
---------------------------------------------------------------
These matters are occasionally discussed on the forum. Please search to read discussions.
https://github.com/Exiv2/exiv2/issues/1101#issuecomment-623141576
http://dev.exiv2.org/boards/3/topics/2311?r=2312#message-2312
http://dev.exiv2.org/issues/1169
http://dev.exiv2.org/boards/3/topics/2705
Robin Mills
http://clanmills.com
2020-05-04
@Simon-12 I believe everything is now fixed. I've submitted 2 PRs
I would appreciate your review of these. In particular please review contrib/Qt on branch 0.27-maintenance.
As you can see in #1197, I've decided against building C++11 binaries for 0.27.3, so you'll have to build from source. I've discussed with @piponazo having a release of Exiv2 v0.28 later this year and that will include C++11 binaries. Making a release is quite a lot of work (100s of hours of effort) and I'm currently working on v0.27.3. https://github.com/Exiv2/exiv2/issues/1018#issuecomment-604539346 I think we'll decide to release v0.28 towards the end of 2020.
@clanmills thanks for the update ;) Work week has started again. I will check this out during this week and post a feedback here.
Righty, oh. That'll be fine. @piponazo has provided helpful feedback as always. We'll merge #1198 immediately because the 'master' build is broken on MinGW. Rather astonished to discover this because the CI builds on about 20 platforms. I build 0.27-maintenance at home on 9 platforms.
However, I'll wait for your comments on #1197. Support for C++11/14 is a "bonus" feature for v0.27.3.
@clanmills i found some time to test it.
I used the exiv2-add_c-11_support_0.27
branch, followed the instructions and got a good build.
For the Qt commandLineTool i changed the .pro file and add:
INCLUDEPATH += $$quote("E:/msys64/usr/local/include")
LIBS += $$quote("E:/msys64/usr/local/bin/msys-exiv2-27.dll")
During make
i only got some deprecated warnings but finally a good build.
Then i tried to run the commandLineTool.exe. There i is no output, not even an error message just nothing:
Same problem is inside my Qt creator project (good build but no output after execution). After a system restart i tried again. There i got no warnings during make
and after run the commandLineTool.exe eh voilà i got the same output like you:
library=C:\Windows\SYSTEM32\ntdll.dll library=C:\Windows\System32\KERNEL32.DLL library=C:\Windows\System32\KERNELBASE.dll library=E:\msys64\usr\bin\msys-gcc_s-seh-1.dll library=E:\msys64\usr\bin\msys-2.0.dll library=E:\msys64\usr\bin\msys-stdc++-6.dll library=E:\msys64\usr\local\bin\msys-exiv2-27.dll library=C:\Windows\System32\WS2_32.dll library=C:\Windows\System32\RPCRT4.dll library=E:\Qt\5.14.0\mingw73_64\bin\Qt5Core.dll library=C:\Windows\System32\ADVAPI32.dll library=E:\msys64\usr\bin\msys-expat-1.dll library=C:\Windows\System32\msvcrt.dll library=C:\Windows\System32\sechost.dll library=E:\msys64\usr\bin\msys-iconv-2.dll library=C:\Windows\System32\ole32.dll library=C:\Windows\System32\combase.dll library=C:\Windows\System32\ucrtbase.dll library=E:\msys64\usr\bin\msys-z.dll library=C:\Windows\System32\bcryptPrimitives.dll library=C:\Windows\System32\GDI32.dll library=C:\Windows\System32\win32u.dll library=C:\Windows\System32\gdi32full.dll library=C:\Windows\System32\msvcp_win.dll ...
But in my Qt creator project there is still no output. What the hack is going on? I will investigate this further.
You will get deprecation warnings from the build about SSH, EPS and Video. This is intentional. These features are being dropped in v0.28.
However you should not see 2305 warnings about auto_ptr!
What's wrong in QtCreator? It's almost certainly your PATH! You'll have to ensure that the directory with msys-exiv2-27.dll
is on the PATH in Qt Creator!
If it's working from the command-line, it'll work in QtCreator when you get QtCreator to cooperate. There's probably a Preference somewhere. I haven't used that for about 10 years (although I liked it when I did a project in 2010 with it).
I don't know how to use QtCreator. Like all unfamiliar tools, it feels hostile.
Caution: After you built exiv2, you must install it!
$ cd <exiv2dir>
$ mkdir build ; cd build
$ cmake .. -DCMAKE_CXX_STANDARD=11 DCMAKE_CXX_FLAGS=-Wno-deprecated
$ make
$ make tests
$ make install
I created a new console application in c:\Users\rmills\Documents\commandLine
added #include <iostream>..... std::out << "hello world\n"; return 0;
and built/ran that.
Then I put the C++ code (from above) into main.cpp and added (from above) win32 {...}
to commandLine.pro. QtCreator didn't understand anything and complained about #include <exiv2/exiv2>
I used Build/Run qmake. Pressed that. Nothing seems to happen!
So, I used msys2/bash:
$ cd /c/Users/rmills/Documents/commandLine
$ PATH=/c/Qt/5.14.2/mingw73_64/bin:$PATH
$ qmake
$ make
$ release/commandLine
..... happiness ......
I'd like to ask you to do a couple of things:
contrib\Qt\
to your happiness. Especially ReadMe.txt. I'll review and update add_c++11_support_0.27
I'm sure my smart friend @piponazo will have something clever to say when he reviews/approves the PR. I hope we'll be done on this over the weekend.
Hi guys. I am a bit lost with the current status of the conversation. If I understood correctly, @Simon-12 is trying to generate a successful build from exiv2-add_c-11_support_0.27
on Windows + MinGW + QtCreator ?
@Simon-12 Would you mind to give me more details about what you are trying and the platform + tools + version you are using ? I use daily QtCreator and I might help you. However, it has been a while since I use MinGW.
I got it to run from QtCreator.
1) I changed the project setup (in spanner/Projects) a) set PATH c:\msys64\usr\bin;c:\msys64\usr\local\bin; b) made the build steps i) qmake ii) make
2) I built (pressed the hammer) 3) Run (green >)
@piponazo We've headed into the long grass and started discussing how to build the program commandLine.cpp in contrib\Qt
from QtCreator. I've got it to work.
The notes in contrib\Qt\ReadMe.txt
have details about how to build from the command-line. I don't think we should discuss QtCreator in ReadMe.txt as it has nothing to do with Exiv2. No doubt QtCreator has lovers and haters and I don't want to get involved.
I would appreciate @Simon-12 reviewing contrib/Qt/*
and the modified README.md and anything else he believes to be important.
Hey guys.
@clanmills described it wonderful in his poste: https://github.com/Exiv2/exiv2/issues/1101#issuecomment-625111969
I followed the instructions and yes with make install
:)
Now i tried the example exifprint.cpp
in Qt Creator but there errors like in my first post:
undefined reference to __imp__ZN5Exiv212ImageFactory4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
Using the command line (default cmd.exe):
$ cd <dir>
$ qmake
$ make
$ exifprint.exe
The application works as expected! :)
@piponazo my system:
I just discovered that it is possible to create a cmake project in Qt Creator instead of qmake project. -> i will check this out!
@Simon-12 It's a clone of commandLine.pro. From bash:
$ cd <exiv2dir>
$ mkdir exifprint ; cd exifprint
$ cp ../contrib/Qt/commandLine.pro exifprint.pro
...... edit exifprint.pro
1) the code from ../samples/exifprint.cpp
2) change TARGET =
$ qmake
$ make
$ release/exifprint.exe
I got it to run from QtCreator.
- I changed the project setup (in spanner/Projects) a) set PATH c:\msys64\usr\bin;c:\msys64\usr\local\bin; b) made the build steps i) qmake ii) make
- I built (pressed the hammer)
- Run (green >)
@clanmills ye i saw this option in Qt Creator but i ignore it because i add
c:\msys64\usr\bin;c:\msys64\usr\local\bin;
already to my system PATH.
Now i add it manually (like you) to the Qt Creator and the line shine blue:
Click build (hammer) and Run (play button) ---> MAGIC! It works inside Qt Creator! No clue why the build process ignore the system PATH befor...
I summarize how i get this working:
Install MinGW/msys2 64 bit: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20190524.exe
Use the following batch file to start the MinGW/msys2 64 bit bash shell from the Dos Command Prompt (cmd.exe):
@echo off
setlocal
set "PS1=\! MSYS64:\u@\h:\w \$ "
set PATH="/usr/local/bin/:/usr/bin:/mingw64/bin:/bin:/usr/sbin:/sbin"
set "HOME=c:\msys64\home\%USERNAME%"
if NOT EXIST %HOME% mkdir %HOME%
cd %HOME%
c:\msys64\usr\bin\bash.exe -norc
endlocal
Install MinGW Dependencies:
$ for i in base-devel git cmake coreutils python3 man gcc gdb make dos2unix diffutils zlib-devel libexpat-devel libiconv-devel gettext-devel; do (echo y|pacman -S $i); done
Download and extract the code from branch: exiv2-add_c-11_support_0.27
Build and install:
$ cd <exiv2dir>
$ mkdir build ; cd build ;
$ cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated
$ make
$ make install
Add to system PATH:
E:\msys64\usr\local\bin
E:\msys64\usr\bin
E:\Qt\5.14.0\mingw73_64\bin
For the Qt example in: <exiv2dir/contrib/Qt>
1) Edit the .pro file and add:
INCLUDEPATH += $$quote("E:/msys64/usr/local/include")
LIBS += $$quote("E:/msys64/usr/local/bin/msys-exiv2-27.dll")
2) Start command prompt (cmd.exe)
3) Generate Makefile $ cd <exiv2dir/contrib/Qt> $ qmake commandLinePro.pro
4) Build commandLineTool.cpp $ make
5) Run commandLineTool.exe $ commandLineTool.exe
That's all (hope there is nothing missed)
Cheers
Right. As they say in the movies "we have a wrap". Luis has approved the PR #1197. I'm fiddling with the build scripts for #1200. We'll merge #1197 today, close #1200 and close this issue. Exiv2 v0.27.3 will be 97% complete.
@clanmills Thanks for the support. Keep the good work up!
See you
And thanks to @piponazo for working on this.
Now @Simon-12 here is the bill. Please visit OpenHub and give kudos and other kindness such as a review or 5 star rating. https://www.openhub.net/p?ref=homepage&query=Exiv2
I try to integrate the exiv2 prebuilt binary from website (MINGW64 shared binaries) into a Qt project. So I unpacked the archive added the BIN directory to my Systems PATH and added it to my
.pro
-file like this:When I then try to build my app I get the following error:
What do I do wrong? I've read that exiv2 is built with c++98, probably something todo with that?
Desktop (please complete the following information):
gcc version 7.3.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)