Open sebastic opened 5 years ago
Hello Bas:
I have commented the line out of the Common. Will test the builds on CentOS and MAC.
Take care
Garrett
On Oct 17, 2018, at 9:19 AM, Bas Couwenberg <notifications@github.com mailto:notifications@github.com> wrote:
As reported by Helmut Grohne in Debian Bug #911233 https://bugs.debian.org/911233 ossim fails to cross build from source for two distinct reasons.
The immediate failure is a linker error. The format of libdl.so is not recognized. It turns out that find_library locates the build architecture libdl.so when building on amd64. The cause is a line in cmake/CMakeModules/OssimCommonVariables.cmake where it adds /usr/lib/x86_64-linux-gnu to CMAKE_LIBRARY_PATH. I don't quite understand why this is being done, but I can tell that doing so breaks cross compilation. Adding any of these paths is either wrong or redundant as they should be there by default already. I suggest removing the offending line, see attached upstream.patch.
The other issue is that ossim decides to install the library to /usr/lib64 (for 32bit architectures). Subsequently, dh_install complains about not finding the libraries in /usr/lib. It's not entirely clear why this happens. The relevant code resides in cmake/CMakeModules/OssimCommonVariables.cmake again. It checks the value of FIND_LIBRARY_USE_LIB64_PATHS. Apparently that turns out to be true for cross building. The documentation says that it is only relevant to 64bit builds, so using it for a 32bit build as ossim does is an error. In any case, it sets LIBSUFFIX to 64 there (again for cross builds only). Later INSTALL_LIBRARY_DIR is set to lib${LIBSUFFIX} causing the failure. Worse, INSTALL_LIBRARY_DIR is a path variable. More precisely, a relative path variable. Such a thing does not exist in CMake. All paths are absolute and if not, CMake canonicalizes them. Thus setting -DINSTALL_LIBRARY_DIR=lib results in the build path being embedded. That's another fault of OssimCommonVariables.cmake. It can be worked around by forcing it to be a string variable with -DINSTALL_LIBRARY_DIR:STRING=lib. My second patch, rules.patch, implements this, but this approach is only a workaround for multiple failures in OssimCommonVariables.cmake. I have no clue how to fix that. Maybe someone with more CMake knowledge can chime in.
In any case, the combination of upstream.patch and rules.patch make ossim cross buildable. Please do something useful with them.
upstream.patch https://bugs.debian.org/cgi-bin/bugreport.cgi?att=2;bug=911233;filename=upstream.patch;msg=5 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ossimlabs/ossim/issues/208, or mute the thread https://github.com/notifications/unsubscribe-auth/ACL9v7nTg6wQ0pVq67b-Aitu--0ufWqKks5uly5VgaJpZM4Xj5gA.
As reported by Helmut Grohne in Debian Bug #911233
upstream.patch