Patch #1192

Only link with libdl on gnu/linux

Added by Matthieu Volat over 5 years ago. Updated over 5 years ago.

Target version:
Start date:
13 Jun 2016
Due date:
% Done:


Estimated time:
3.00 h



At the end of the configure script, the LDFLAGS will be appended with -ldl on the condition "host_os != windows". This should be done only for gnu/linux (*BSD, (Mac)OSX, &co put the dlopen() family in libc, as defined in posix... while android provides a fake libdl).

Here's a patch that naively complete the case block. If one was overly prudent, maybe a libdl presence should be checked...

Thanks for your work,


configure_libdl.diff (459 Bytes) configure_libdl.diff Matthieu Volat, 13 Jun 2016 17:24
cmake_libdl.diff (911 Bytes) cmake_libdl.diff Matthieu Volat, 14 Jun 2016 07:43

Associated revisions

Revision 4325 (diff)
Added by Robin Mills over 5 years ago

#1192 Thank You, Matthieu for the patch.

Revision 4326 (diff)
Added by Robin Mills over 5 years ago

#1192. Correction to src/CMakeLists.txt. The CMake Language is a horrible mess. It's not even a language.



Updated by Robin Mills over 5 years ago

  • Status changed from New to Assigned
  • Target version set to 0.26
  • % Done changed from 0 to 50
  • Estimated time set to 2.00 h


I've submitted your patch: r4325. I've made an equivalent change in src/CMakeLists.txt. The buildserver has built/tested Mac/Linux/MinGW/Cygwin using ./configure Looks good. Thanks. Your patch is accepted for v0.26.

Overnight the buildserver will build/test using CMake. If the CMake build fails, I will revert my changes to src/CMakeLists.txt. I'm working to get finished on v0.26 in June and don't want to be side tracked by this. Linking dl has been in CMakeLists.txt for years without complaint or incident.

I am interested in your comments about Android which is one of the Features to be added for v0.27.

Thanks for saying "Thanks". Encouragement is very much appreciated. Thank You.


Updated by Matthieu Volat over 5 years ago

Ho thanks, I did not even thought of updating the CMake files!!

Great news about 0.26, then I won't try to push 0.25 yet to FreeBSD ports, but maybe I'll try to push an issue for another problem I'd really like to see solved in a stable version soon.

Regarding android, you can see bionic (android libc) source:

If that helps, comments from google engineers were that bionic was now almost vanilla openbsd libc ( ), so for the native code, so I don't think that will be hard.


Updated by Robin Mills over 5 years ago

My fix to CMake isn't correct. However, I think I've remedied it this morning: r4326

Don't hit me with anything heavy for v0.26. I'm very overloaded already with a major home remodelling project which we want to finish by July 10 for a family gathering to celebrate my wife's birthday, my 65th birthday and our retirement.

I downloaded Android Studio a couple of weeks ago and haven't had time to look at it. I believe it supports native C++ apps. So, I expect Exiv2/Android shouldn't be difficult. A couple of contributors sent iOS build code in 2013. Nobody on the team could get their contributions to build, so they were rejected. I don't believe iOS supports shared libraries. I hope it supports static libraries. Anyway, this misery awaits in v0.27.


Updated by Matthieu Volat over 5 years ago

Hum, in fact, I tested the cmake patch this morning, but it still confuse unix and linux, would the attached patch be acceptable? As is, I'm not sure it would set android apart (depending on what the custom toolchain will define), but that's not really a problem since they provide this fake libdl.


Updated by Matthieu Volat over 5 years ago

Oops, sorry, disregard previous comment.


Updated by Robin Mills over 5 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 50 to 100
  • Estimated time changed from 2.00 h to 3.00 h


Thanks for your second patch. I'm not going to spend more time on this. I also considered using STREQUAL as an alternative to the LINUX variable (which in my opinion should be defined by CMake). As you know there's more than one way to do everything. Fix r4326 has been successfully built and passed our test suite on all supported platforms using CMake. If r4326 doesn't work correctly on Android (or any other unsupported platform), it will be dealt with in v0.27.

I've still have 76 hours of work in June for v0.26 in addition to the house project (another 8 hours/day). Retirement? I've never worked harder!

Also available in: Atom PDF