-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot link exiv2 prebuilt binaries in Qt project #1101
Comments
Looks like you're building with C++11 or later as the symbol: 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 |
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. |
@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 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 Running |
So linking to exiv2 works fine but now I have a problem. When using
the program just crashs on startup, no message, nothing. My
|
Are you sure you have libexiv2.dll on the PATH? |
@clanmills I have the whole BIN folder in my PATH. So including |
@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, 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":
From README.md 5.3 MinGWPlease 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: #575 MinGW/msys2 64 bitInstall: 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 MinGW DependenciesInstall 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 Download exiv2 from github and build$ 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 MinGW and RegexThe exiv2 command line program provides an option $ exiv2 -vVg regex
exiv2 0.27.1
have_regex=1
$ |
Thanks a lot for your fast response. Then i add the include folder and libs to my Qt project:
After that i try to build my project and get the following error:
I also get a lot of deprecated warnings like:
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. Now i tried to build the current master branch. There i get an build error at 33%: 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:
|
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.
|
With build 0.27.2 and: Now i tried to build your fixed code. There i got a new error during configuration: 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: #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). #1101 (comment) 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 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. |
I think he was trying to build 0.27.2, so that we were overriding the value of @Simon-12 Try to checkout the latest version in the
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 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! |
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.
Build and Run
|
@Simon-12 I believe everything is now fixed. I've submitted 2 PRs #1198 Is the fix for 'master' to get futils.cpp to compile on MinGW 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. #1018 (comment) I think we'll decide to release v0.28 towards the end of 2020. |
@clanmills thanks for the update ;) |
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 For the Qt commandLineTool i changed the .pro file and add: During 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
But in my Qt creator project there is still no output. |
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 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!
I created a new console application in Then I put the C++ code (from above) into main.cpp and added (from above) So, I used msys2/bash:
I'd like to ask you to do a couple of things:
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 @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.
|
@piponazo We've headed into the long grass and started discussing how to build the program commandLine.cpp in The notes in I would appreciate @Simon-12 reviewing |
Hey guys. @clanmills described it wonderful in his poste: #1101 (comment) Now i tried the example
Using the command line (default cmd.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. |
@Simon-12 It's a clone of commandLine.pro. From bash:
|
@clanmills ye i saw this option in Qt Creator but i ignore it because i add 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! |
I summarize how i get this working:
That's all (hope there is nothing missed) |
@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)
The text was updated successfully, but these errors were encountered: