Exiv2 / exiv2

Image metadata library and tools
http://www.exiv2.org/
Other
893 stars 279 forks source link

Compilation error on Windows when UNICODE support is enabled #10

Closed piponazo closed 7 years ago

piponazo commented 7 years ago

Hi,

I am writing a conan recipe for your project and I found out that there is an compilation error on Windows when the UNICODE support is enabled. Note that I am using the v0.26 tag.

This is the error: C:\Users\luis\.conan\data\Exiv2\0.26-0\pix4d\stable\build\64046ffd699a91c9898304651b021d7e7eebc274\exiv2\src\actions.cpp(2121): error C2664: 'std::string Exiv2::ws2s(const std::wstring &)' : cannot convert argument 1 from 'std::string ' to 'const std::wstring &' [C:\Users\luis\.conan\data\Exiv2\0.26-0\pix4d\stable\build\64046ffd699a91c9898304651b021d7e7eebc274\build\src\exiv2.vcxproj]

These are the CMake variables that I used:

        cmake_args = {'EXIV2_ENABLE_NLS' : 'OFF',
                      'EXIV2_ENABLE_LENSDATA' : 'OFF',
                      'EXIV2_ENABLE_COMMERCIAL' : 'OFF',
                      'EXIV2_ENABLE_VIDEO' : 'OFF',
                      'EXIV2_ENABLE_WEBREADY' : 'OFF',
                      'EXIV2_ENABLE_CURL' : 'OFF',
                      'EXIV2_ENABLE_SSH' : 'OFF',
                      'EXIV2_ENABLE_BUILD_SAMPLES' : 'OFF',
                      'EXIV2_ENABLE_BUILD_PO' : 'OFF',
                      'EXIV2_ENABLE_SHARED' : 'ON',
                      'EXIV2_ENABLE_XMP' : 'ON',
                      'EXIV2_ENABLE_PNG' : 'ON',
                      'CMAKE_INSTALL_PREFIX' : self.package_folder,
                      'CMAKE_BUILD_TYPE' : self.settings.build_type,
                     }
        if self.settings.os == 'Windows':
            cmake_args['EXIV2_ENABLE_WIN_UNICODE'] = 'ON'
            cmake_args['EXIV2_ENABLE_LIBXMP'] = 'ON'

            cmake_args['EXPAT_INCLUDE_DIR'] = expat_include_dir
            cmake_args['EXPAT_LIBRARY'] = expat_library
            cmake_args['ZLIB_INCLUDE_DIR'] = zlib_include_dir
            cmake_args['ZLIB_LIBRARY'] = zlib_library

When I disable the EXIV2_ENABLE_WIN_UNICODE the compilation finishes properly.

Are you aware of this problem?

piponazo commented 7 years ago

It seems that the function static std::string temporaryPath() should return std::string or std::wstring depending on the value of EXIV2_ENABLE_WIN_UNICODE.

If you give me some guidance I am happy to contribute in the fix.

clanmills commented 7 years ago

Remarkably, Ben (an Exiv2 Team Member) emailed me about this last night. Thanks for offering to help. I will submit a fix in the next few hours.

piponazo commented 7 years ago

I was wondering if this commit could be backported to the version v0.26 and create a new tag (something like v0.26.1).

In our case is very important to use always the same version of libraries and it is easier to keep track of the changes having version tags than referring to commits

clanmills commented 7 years ago

I will discuss this with Ben (another member of Team Exiv2). Ben has proposed other changes to actions.cpp. I'm willing to consider tagging both Ben's and this change in GitHub.

I cannot publish Exiv2 v0.26.1 on exiv2.org at this time. With v0.26, we moved the code base from SVN to GIT. The work to get the buildserver to use git has not been done. Our release scripts publish builds from the buildserver. I will be work on the buildserver/git later in the year.

Conclusion: Yes, I'm willing to consider tagging this fix (and possibly Ben's proposed changes) in GitHub. However I cannot publish 0.26.1 on exiv2.org at the moment.

piponazo commented 7 years ago

Thanks for you answer, I totally understand the situation.

clanmills commented 7 years ago

I'm going to give priority to getting our buildserver working with GIT. When I'm confident that Exiv2 is building correctly on all supported platforms, I'll tag v0.26.1. I'll reopen this issue for now and let you know when the work is complete. I'm hoping it will be early next week (about July 4). We won't be folding Ben's changes to actions.cpp into v0.26.1.