Skip to content

GET_RUNTIME_DEPENDENCIES broken for cross-compiling

I'm cross-compiling from Linux to Windows and I noticed a number of issues with file(GET_RUNTIME_DEPENDENCIES) in this scenario. The "visible" result is that it doesn't produce any dependencies (neither resolved nor unresolved!), even though the tools are there.

  1. I noticed the implementation uses CMAKE_HOST_SYSTEM_NAME to select the platform. In my scenario the host system is "Linux", meaning the chosen platform is "linux+elf", even though "windows+pe" would be correct. Workaround: manually set CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM.
  2. The wrong 'objdump' was used, the 'native' /bin/objdump instead of the cross-building objdump. Workaround: manually setting CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND, CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL. (But I believe this is fixed in master now.)
  3. The interpretation of the objdump output expects a CR at the end of a line. This is not present on Linux. Workaround: employing a wrapper script that pipes the objdump output through unix2dos.
  4. Library name case mismatches. Yeah, this is tricky. In my case I want Qt DLLs, and for them returning the "resolved" dependencies unchanged would be fine, but that's not a general case. Workaround: Attempting a "case-insensitive" search for the library name (i.e., scanning directories and comparing each file name) and recursively feeding those to file(GET_RUNTIME_DEPENDENCIES) again, all with CMake scripting. Kludgy, but works for now.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information