Project

General

Profile

Linking with Cygwin and Qt issue

Added by Dominik Pietrzak about 9 years ago

Dear all,

Is it possible to link Exiv2 library with Qt under Cygwin
I have read the following manual:
http://clanmills.com/exiv2/cygwin.shtml
It describes building under Cygwin. Now it would be very nice if we could link against Qt...
Did anyone tried/managed to do this?

Maybe you could give me some advices how should I proceed in order to obtain such operation?

Even better, is it possible to build static library under Windows so we could have exiv2.lib file? (that would solve most of the painful linking problems, I guess)


Replies (4)

RE: Linking with Cygwin and Qt issue - Added by Robin Mills about 9 years ago

Dominick

I wrote an article about this a couple of years ago:
http://clanmills.com/exiv2/qt.shtml

I could only get this to work using MinGW. I said:

_Mac and Linux will link "out of the box". Windows appears to require the MinGW build. Cygwin does not seem to work. Cygwin will successfully link, however your executable will be unable to open any image in the exiv2 library thus rendering your executable impotent.

_

Recently, somebody post the following "Success: sharing the process of compiling the latest Exiv2 on Win7 (MinGW) + linking from Qt" on the Forum:
http://dev.exiv2.org/boards/3/topics/1259

I successfully used the Qt DevStudio Plugin on a project that didn't use exiv2. I don't see any reason why you can't link Qt/Exiv2 with DevStudio. You will have to build exiv2 with DevStudio.

I think you should be able to define the GCC toolchain correctly in Qt/Creator and link the cygwin built libexiv2.a. Just because I gave up on this doesn't mean it is impossible. I successfully adopted the MinGW road. However given more tenacity, it should work. It might be that something simple like linking cygwin1.dll is required. You could ask on a Qt Forum about linking with libraries built with Cygwin built libraries.

Robin

RE: Linking with Cygwin and Qt issue - Added by Robin Mills about 9 years ago

Dominik

You can build and link static exiv2 libraries as follows:

$ cd <exiv2dir>
$ make config 
$ ./configure --disable-shared --enable-static  
$ make
$ find . -name "*.a" -exec ls -alt {} \;
-rw-r--r-- 1 rmills Domain Users 4851224 Nov  5 11:29 ./src/.libs/libexiv2.a          <--- Here's your library
-rw-r--r-- 1 rmills Domain Users 531236 Nov  5 11:28 ./xmpsdk/src/.libs/libxmpsdk.a

$ find . -name exiv2.exe -exec ls -alt {} \;
-rwxr-xr-x 1 rmills None 3650263 Nov  5 11:29 ./bin/exiv2.exe  <--- here's exiv2.exe statically linked

This will use the shared library version of expat, zlib and some other libraries. You can see this in a couple of ways:

$ bin/exiv2.exe -v -V # --verbose --Version
... will list build information and show you the libraries loaded in memory
exiv2 -v -V option is new for 0.24, so is only available at present by building from the the trunk.

$ cygcheck bin/exiv2
... will reveal information about cygwin's view of your executable

If you want to link with static versions of expat and zlib, you can build those from source and exiv2.exe will link them. However I've never been suspicious of linking with the shared versions of expat and zlib which are installed by cygwin.

$ bin/exiv2.exe -v -V
exiv2 0.23 001700 (32 bit build)
...
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\Users\rmills\gnu\exiv2\test.cmake\bin\exiv2.exe
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\Windows\SysWOW64\ntdll.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\Windows\syswow64\kernel32.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\Windows\syswow64\KERNELBASE.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\cygwin\bin\cygwin1.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\cygwin\bin\cyggcc_s-1.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\cygwin\bin\cygstdc++-6.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\Windows\syswow64\PSAPI.DLL
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\cygwin\usr\local\bin\cygexpat-1.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\cygwin\usr\local\bin\cygiconv-2.dll
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: module=C:\cygwin\usr\local\bin\cygintl-8.dll
builder=GCC=4.5.3,DEBUG=0,DLL=0,Bits=4:
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: executable=C:\Users\rmills\gnu\exiv2\test.cmake\bin\exiv2.exe
GCC=4.5.3,DEBUG=0,DLL=0,Bits=4: date="Nov  5 2012",time=11:29:14

$ cygcheck bin/exiv2.exe
C:\Users\rmills\gnu\exiv2\test.cmake\bin\exiv2.exe
  C:\cygwin\bin\cygwin1.dll
    C:\Windows\system32\KERNEL32.dll
      C:\Windows\system32\API-MS-Win-Core-RtlSupport-L1-1-0.dll
      C:\Windows\system32\ntdll.dll
      C:\Windows\system32\KERNELBASE.dll
      C:\Windows\system32\API-MS-Win-Core-ProcessThreads-L1-1-0.dll
      ...
  C:\cygwin\bin\cyggcc_s-1.dll
  C:\cygwin\bin\cygstdc++-6.dll
  C:\Windows\system32\PSAPI.DLL
  C:\cygwin\usr\local\bin\cygexpat-1.dll
  C:\cygwin\usr\local\bin\cygiconv-2.dll
  C:\cygwin\usr\local\bin\cygintl-8.dll
$

RE: Linking with Cygwin and Qt issue - Added by Robin Mills about 9 years ago

Dominik

I was a little bored at work today while waiting for builds and went to look at the Qt Website. Qt appear to provide Windows support with DevStudio (various editions) and MinGW. They don't appear to offer Cygwin support. The exiv2 library (and sample applications) are supported on MingW/Linux/MSVC/Cygwin (and more platforms using CMake).

So, I'm puzzled. Qt/MinGW/exiv2 and Qt/MSVC/exiv2 work, supported and are documented. Why are you asking about exiv2/qt/cygwin support when the obstacle is Qt and not exiv2?

Robin

RE: Linking with Cygwin and Qt issue - Added by Dominik Pietrzak about 9 years ago

Dear Robin,
thank you again for the involvement.
You are totally right it is a problem Qt and Cygwin, NOT Exiv2 and Cygwin :)
Sorry for bothering.

    (1-4/4)