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

Build is using incorrect include path #1516

Open
clanmills opened this issue Apr 3, 2021 · 6 comments
Open

Build is using incorrect include path #1516

clanmills opened this issue Apr 3, 2021 · 6 comments
Labels
testing Anything related to the tests and their infrastructure
Milestone

Comments

@clanmills
Copy link
Collaborator

clanmills commented Apr 3, 2021

I've been aware for some time that there's something wrong with the path to the include files. I first noticed it when I shipped v0.27.3. The following day somebody reported something similar #1240 I investigated without success.

The build uses /usr/local/include/exiv2/exiv2.hpp. It should use <builddir>/include/exiv2/exiv2.hpp

1371 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance/build $ args /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -Dexiv2lib_EXPORTS -I/Users/rmills/gnu/github/exiv2/0.27-maintenance/build -I/Users/rmills/gnu/github/exiv2/0.27-maintenance/build/src -I/Users/rmills/gnu/github/exiv2/0.27-maintenance/include/exiv2 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -fPIC -fstack-protector-strong -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W -o CMakeFiles/exiv2lib_int.dir/makernote_int.cpp.o -c /Users/rmills/gnu/github/exiv2/0.27-maintenance/src/makernote_int.cpp
1 : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
2 : -Dexiv2lib_EXPORTS
3 : -I/Users/rmills/gnu/github/exiv2/0.27-maintenance/build
4 : -I/Users/rmills/gnu/github/exiv2/0.27-maintenance/build/src
5 : -I/Users/rmills/gnu/github/exiv2/0.27-maintenance/include/exiv2 <--- This is wrong
6 : -arch
7 : arm64
8 : -isysroot
9 : /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
10: -fPIC
11: -fstack-protector-strong
12: -Wp,-D_GLIBCXX_ASSERTIONS
13: -Wall
14: -Wcast-align
15: -Wpointer-arith
16: -Wformat-security
17: -Wmissing-format-attribute
18: -Woverloaded-virtual
19: -W
20: -o
21: CMakeFiles/exiv2lib_int.dir/makernote_int.cpp.o
22: -c
23: /Users/rmills/gnu/github/exiv2/0.27-maintenance/src/makernote_int.cpp
1372 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance/build $ 
@clanmills clanmills added this to the v0.27.4 milestone Apr 3, 2021
@clanmills clanmills self-assigned this Apr 3, 2021
@clanmills clanmills changed the title Built is using incorrect include path Build is using incorrect include path Apr 3, 2021
@clanmills
Copy link
Collaborator Author

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8146ef7..d6930ee4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,7 +73,7 @@ endif()
 
 
 include_directories(${CMAKE_BINARY_DIR})  # Make the exv_conf.h file visible for the full project
-
+include_directories( BEFORE SYSTEM include) # for  #include <exiv2/exiv2>
 if( EXIV2_ENABLE_XMP )
     add_subdirectory( xmpsdk )
 endif()

@clanmills clanmills linked a pull request Apr 4, 2021 that will close this issue
@clanmills
Copy link
Collaborator Author

See discussion #1520 which I have closed. I have to find proof of a fault before submitting a PR for this.

@clanmills
Copy link
Collaborator Author

Compiling geotag.cpp reads /usr/local/include/exv_conf.h

1666 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance $ git checkout 0.27-maintenance ; git pull --rebase
Already on '0.27-maintenance'
Your branch is up to date with 'origin/0.27-maintenance'.
...
1667 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance $ cd build
1668 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance/build $ cd .. ; rm -rf build ; mkdir build ; cd build
1669 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance/build $ cmake .. '-DCMAKE_CXX_FLAGS=-H' ; make 2>&1 | grep exv_conf
-- The CXX compiler identification is AppleClang 12.0.0.12000032
...
-- CMAKE_CXX_STANDARD:
--  --- Compiler flags --- 
-- General:           -H
	 -fstack-protector-strong
	 -Wp,-D_GLIBCXX_ASSERTIONS
	 -Wall
	 -Wcast-align
	 -Wpointer-arith
	 -Wformat-security
	 -Wmissing-format-attribute
	 -Woverloaded-virtual
	 -W
-- Extra:              
...
-- Generating done
-- Build files have been written to: /Users/rmills/gnu/github/exiv2/0.27-maintenance/build
... /Users/rmills/gnu/github/exiv2/0.27-maintenance/build/exv_conf.h
... /Users/rmills/gnu/github/exiv2/0.27-maintenance/build/exv_conf.h
....
... /usr/local/include/exiv2/exv_conf.h
1670 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance/build $

@clanmills
Copy link
Collaborator Author

The patch for geotag.cpp is:

From 89874638483f3d16e405df0ce355fafd3e36baa5 Mon Sep 17 00:00:00 2001
From: Robin Mills <robin@clanmills.com>
Date: Sun, 4 Apr 2021 19:49:07 +0100
Subject: [PATCH] geotag is incorrectly reading /usr/local/include/exiv2.hpp

---
 samples/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt
index 2639335264..b7b1cd7ec3 100644
--- a/samples/CMakeLists.txt
+++ b/samples/CMakeLists.txt
@@ -79,6 +79,8 @@ if( EXPAT_FOUND )
             exiv2-xmp
             ${EXPAT_LIBRARIES}
     )
+    target_include_directories(geotag PRIVATE ${CMAKE_BINARY_DIR})  # exv_conf.h 
+    target_include_directories(geotag PRIVATE include)              # for  #include <exiv2/exiv2.hpp>
     target_include_directories(geotag PRIVATE ${EXPAT_INCLUDE_DIR})
     target_include_directories(geotag PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find unused.h

I'm going to "let this go" and not submit a change.

@clanmills clanmills modified the milestones: v0.27.4, v1.00 Apr 7, 2021
@clanmills clanmills removed their assignment Apr 7, 2021
@clanmills
Copy link
Collaborator Author

clanmills commented Apr 7, 2021

There is something HORRIBLY WRONG when the machine isn't clean. The test suite can fail on Ubuntu. We can get linking errors. I'd like to see this totally understood and solved for v1.00.

@clanmills clanmills reopened this Apr 7, 2021
@clanmills
Copy link
Collaborator Author

The linkage error is at run-time concerning the symbol _ZN5Exiv217exposureBiasValueERKNS_8ExifDataE which is in the library:

541 rmills@rmillsmm-ubuntu:~/gnu/github/exiv2/0.27-maintenance/build $ c++filt _ZN5Exiv217exposureBiasValueERKNS_8ExifDataE
Exiv2::exposureBiasValue(Exiv2::ExifData const&)
542 rmills@rmillsmm-ubuntu:~/gnu/github/exiv2/0.27-maintenance/build $ nm lib/libexiv2.so.27 | grep _ZN5Exiv217exposureBiasValueERKNS_8ExifDataE
0000000000136596 T _ZN5Exiv217exposureBiasValueERKNS_8ExifDataE
543 rmills@rmillsmm-ubuntu:~/gnu/github/exiv2/0.27-maintenance/build $ 

The following is typical:

======================================================================
ERROR: crw_test (testcases.TestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rmills/gnu/github/exiv2/buildserver/tests/bash_tests/testcases.py", line 266, in crw_test
    out     += BT.Executer('exiv2 -v -pt           {crwfile}', vars())
  File "/home/rmills/gnu/github/exiv2/buildserver/tests/bash_tests/utils.py", line 471, in __init__
    self.run()
  File "/home/rmills/gnu/github/exiv2/buildserver/tests/bash_tests/utils.py", line 509, in run
    raise RuntimeError('\n' + log.to_str())
RuntimeError: 
[INFO] #1 Add and modify tags
[ERROR] Failed to execute: ['/home/rmills/gnu/github/exiv2/buildserver/build/bin/exiv2', '-v', '-pt', 'exiv2-canon-powershot-s40.crw']
[ERROR] The asserted return code is [0], but got 127
[INFO] OUTPUT:
/home/rmills/gnu/github/exiv2/buildserver/build/bin/exiv2: symbol lookup error: /home/rmills/gnu/github/exiv2/buildserver/build/bin/exiv2: undefined symbol: _ZN5Exiv217exposureBiasValueERKNS_8ExifDataE

There's something wrong. We're using the wrong library at run time or something like that.

@hassec hassec added the build label Apr 8, 2021
@clanmills clanmills self-assigned this Apr 11, 2021
@clanmills clanmills added testing Anything related to the tests and their infrastructure and removed build labels Apr 13, 2021
@clanmills clanmills removed their assignment Apr 19, 2021
@kevinbackhouse kevinbackhouse modified the milestones: v0.28.0, Backlog Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Anything related to the tests and their infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants