-
Notifications
You must be signed in to change notification settings - Fork 281
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
'cmake' command fails when Exiv2 built as static #1230
Comments
I'll look at this when I get up in the morning. From the transcript, it appears that libiconv is built into libc on your platform. Can you clarify if you are building a static or shared library? |
I've loaded a nice new debian 9.3 VM on my MacMini and can build both static and shared with 0.27.2 with GCC 6.3.0
I installed all the dependencies as documented in README.md:
The reason I asked for clarification is because you said:
Here's my history. Everything build normally. Nothing unusual.
|
Oh, something I forgot to ask:
I think that's something in your src/CMakeLists.txt. Exiv2 has:
My suspicion is that you have something in your src/CMakeLists.txt file that's linking Iconv and expecting it to be in an external package. On the debian platform, it's in libc. I'm not an expert on CMake, however we have the code:
Unless you are using Iconv directly in your code, you don't need to think about Iconv as it will be linked into libexiv2 on your behalf. In the case of the static library, it'll be 100% invisible inside libexiv2.a:
|
Thank you for your help. FYI, I'm building a static library (i.e., libsimphoniz-api.a). The Exiv2 library is statically linked into it. And it seems to be a problem since Iconv is linked into Exiv2 as PRIVATE. I found this explanation here: "If, however, A is a static library, the situation changes. Static libraries do not carry So, I should probably also link Iconv into my static library in addition to Exiv2. |
Ok, so I called the command |
@SPlesskin Thank You for updating this issue. I'm pleased that this issue can be closed. I'm going to ask @piponazo to comment as he is the Team Exiv2 CMake Magician! I personally don't like static libraries. DLLs/shared objects are a much more "democratic" as the libraries and executables dance together. |
Hi @SPlesskin , and thanks for reporting this. The link from where you extracted the explanation about static libraries is correct. I had to do the same thing (include the call to Luckily CMake identifies the situation and the warning which is throwing you is quite clear:
If there is a clan way to prevent this situation I would be happy to include it in our CMake code. However, I think there is not such approach and it is something that needs to be handled by the projects consuming exvi2 statically. |
Thanks for looking into this, @piponazo. If you think I should add something in README.md about this, could you reopen the issue and set the milestone to v0.27.3. I think we'll need a new section in README.md. Currently, building shared and static is mentioned in 2.3 Build Options. I think we add a new section 2.18 Building Shared and Static Libraries. I might need a little help to explain this, however if we go down this road, you can review my PR with the changes to README.md |
Sure @clanmills, You can create a branch a give the structure to the README.md you have in your mind and I can add the CMake details later there ;) |
Yes. Thank You @piponazo. I will add submit a PR tomorrow. I'm happy for this to go into 0.27.3 GM as it's only a change to the documentation. |
@SPlesskin Thanks for bring up this topic. We've updated README.md in branch 0.27-maintenance with a new section concerning static and shared libraries. This issue report is referenced in the modified documentation. #1232. Exiv2 v0.27.3 is on-track to ship on 2020-06-30 and will include the modified README.md. I'm going to close this issue. If you wish further discussion about this matter, please update this issue and it'll be re-opened. |
I also get errors with XMP and inih.
Should I file a new issue? |
I'm developing a Qt 5.7 application on Linux Debian 9 and which uses Exiv2 0.27.2. When I run the
cmake
command to generate the makefile, I get the following error(s):CMake Error at src/CMakeLists.txt:30 (add_library):
Target "simphoniz-api" links to target "Iconv::Iconv" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
When I successfully compiled Exiv2 as a static library, I get the following messages:
-- The CXX compiler identification is GNU 6.3.0
-- The C compiler identification is GNU 6.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Success
-- Found Iconv: /usr/lib/x86_64-linux-gnu/libc.so
-- ICONV_INCLUDE_DIR :
-- ICONV_LIBRARIES : /usr/lib/x86_64-linux-gnu/libc.so
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for munmap
-- Looking for munmap - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Performing Test EXV_STRERROR_R_CHAR_P
-- Performing Test EXV_STRERROR_R_CHAR_P - Success
-- Looking for C++ include memory.h
-- Looking for C++ include memory.h - found
-- Looking for C++ include process.h
-- Looking for C++ include process.h - not found
-- Looking for C++ include stdbool.h
-- Looking for C++ include stdbool.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include strings.h
-- Looking for C++ include strings.h - found
-- Looking for C++ include sys/stat.h
-- Looking for C++ include sys/stat.h - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include inttypes.h
-- Looking for C++ include inttypes.h - found
-- Looking for C++ include unistd.h
-- Looking for C++ include unistd.h - found
-- Looking for C++ include sys/mman.h
-- Looking for C++ include sys/mman.h - found
-- Looking for C++ include regex.h
-- Looking for C++ include regex.h - found
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Install prefix: /home/erwan/git/simphoniz/external/build/external
...
-- Compiler info: GNU (/usr/bin/c++) ; version: 6.3.0
-- Building shared library: NO
-- Building PNG support: NO
-- XMP metadata support: NO
-- Native language support: NO
-- Conversion of Windows XP tags: YES
-- Nikon lens database: YES
-- Building video support: NO
-- Building webready support: NO
-- Building exiv2 command: YES
-- Building samples: NO
-- Building PO files: NO
-- Building unit tests: NO
-- Building doc: NO
-- Building with coverage flags: NO
-- Using ccache: NO
It seems that the problem comes from the libiconv library but I don't see why... Please, can you tell me what can be wrong with my configuration ? Thank you very much for your help.
The text was updated successfully, but these errors were encountered: