Skip to content
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

Exiv2 build error #9

Open
jnsh opened this issue Dec 17, 2023 · 3 comments
Open

Exiv2 build error #9

jnsh opened this issue Dec 17, 2023 · 3 comments

Comments

@jnsh
Copy link

jnsh commented Dec 17, 2023

Building vera (as submodule for glslviewer) fails with the following error:

[ 50%] Building CXX object deps/vera/src/CMakeFiles/vera.dir/gl/texture.cpp.o
/home/joonas/builds/glslviewer-git/src/glslviewer/deps/vera/src/gl/defines.cpp: In member function ‘virtual void vera::HaveDefines::addDefinesTo(const std::string&)’:
/home/joonas/builds/glslviewer-git/src/glslviewer/deps/vera/src/gl/defines.cpp:106:19: error: ‘AutoPtr’ is not a member of ‘Exiv2::Image’
  106 |     Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(_path);
      |                   ^~~~~~~
In file included from /usr/include/c++/13.2.1/cassert:44,
                 from /usr/include/exiv2/slice.hpp:6,
                 from /usr/include/exiv2/types.hpp:10,
                 from /usr/include/exiv2/basicio.hpp:11,
                 from /usr/include/exiv2/exiv2.hpp:8,
                 from /home/joonas/builds/glslviewer-git/src/glslviewer/deps/vera/src/gl/defines.cpp:5:
/home/joonas/builds/glslviewer-git/src/glslviewer/deps/vera/src/gl/defines.cpp:107:12: error: ‘image’ was not declared in this scope
  107 |     assert(image.get() != 0);
      |            ^~~~~
make[2]: *** [deps/vera/src/CMakeFiles/vera.dir/build.make:244: deps/vera/src/CMakeFiles/vera.dir/gl/defines.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:277: deps/vera/src/CMakeFiles/vera.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
make: Leaving directory '/home/joonas/builds/glslviewer-git/src/build'

This happens on Arch linux with exiv2-0.28.1.

@patriciogonzalezvivo
Copy link
Owner

Sorry for that, I'm commenting the inclusion of exiv2 in the CMakeLists file. If you figure any solution rather than it, please submit a PR

@jnsh
Copy link
Author

jnsh commented Dec 17, 2023

Looks like it's this change in exiv2 since 0.28.0 should be related: Exiv2/exiv2@0bbaa6e

Maybe simply replacing AutoPtr with UniquePtr when compiling against newer exiv2 could be enough? I don't have time to test it right now, and either way don't understand the code or the exiv2 change well enough to know for sure whether this would be the proper fix.

@jnsh
Copy link
Author

jnsh commented Jan 29, 2024

This fixes the defines.cpp compilation with exiv2 0.28.1:

--- a/src/gl/defines.cpp
+++ b/src/gl/defines.cpp
@@ -103,7 +103,7 @@ void HaveDefines::printDefines() {
 
 void HaveDefines::addDefinesTo( const std::string &_path ) {
 #if defined(SUPPORT_EXIV2)
-    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(_path);
+    Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(_path);
     assert(image.get() != 0);
     image->readMetadata();

However I think it would break building against exiv2 older than 0.28.0

Additionally I had to change this in src/CMakeLists.txt:

-- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -161,9 +161,9 @@ else()
     endif()
 endif()
 
-find_package(exiv2lib CONFIG NAMES exiv2)
+find_package(exiv2 CONFIG NAMES exiv2)
 if (exiv2lib_FOUND)
-    link_libraries(exiv2lib)
+    link_libraries(exiv2)
     target_compile_definitions(vera PUBLIC SUPPORT_EXIV2)
     target_link_libraries(vera PRIVATE exiv2lib)
     message(STATUS "EXIV2 FOUNDED")

Otherwise building glslViewer would fail in linking:

[100%] Linking CXX executable glslViewer
/usr/bin/ld: cannot find -lexiv2lib: No such file or directory
collect2: error: ld returned 1 exit status

The shared library file in my system is /usr/lib/libexiv2.so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants