MantisBT - CMake
View Issue Details
0015002CMakeCMakepublic2014-07-02 12:382016-06-10 14:31
Olivier Trichet 
Kitware Robot 
lowminoralways
closedmoved 
CMake 2.8.12.1 
 
0015002: GetPrerequisites : fix objdump usage under non english locale
While cross-compile from linux to win32, objdump is used by GetPrerequisites to find dependency dll.
It runs : objdump -p some.exe | grep 'DLL Name:'

Under non English locale, the output of objdump can be translated. Thus the matching on 'DLL Name:' does not work.

The attached patch fix this issue.
1) Create the CMakeLists.txt file with :
   include(GetPrerequisites)
   # Force the function 'get_prerequisites' to use objdump
   # (Avoid to setup a crosscompiling env unix -> win32)
   set(gp_tool "objdump")
   get_prerequisites("cmake-3.0.0-win32-x86.exe" DEPENDENCIES 0 1 "" "")
   message("Some dependencies should have been found: ${DEPENDENCIES}")

2) wget http://www.cmake.org/files/v3.0/cmake-3.0.0-win32-x86.exe [^]
3) Choose a non english locale from "locale -a" to to setup the variable LC_ALL
4) "LC_ALL=fr cmake ." => dependency dll not found without patch
   "LC_ALL=C cmake ." => dependency found

No tags attached.
patch 0001-GetPrerequisites-ensure-objdump-output-is-not-locale.patch (1,564) 2014-07-02 12:38
https://public.kitware.com/Bug/file/5183/0001-GetPrerequisites-ensure-objdump-output-is-not-locale.patch
Issue History
2014-07-02 12:38Olivier TrichetNew Issue
2014-07-02 12:38Olivier TrichetFile Added: 0001-GetPrerequisites-ensure-objdump-output-is-not-locale.patch
2014-07-02 14:16Brad KingNote Added: 0036310
2014-07-02 14:22Brad KingNote Added: 0036311
2016-06-10 14:29Kitware RobotNote Added: 0042577
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0036310)
Brad King   
2014-07-02 14:16   
Recently in the CMake Git 'master' branch we've added a "cmake -E env" command. That could be used to run:

 ${CMAKE_COMMAND} -E env LC_ALL=C objdump ...
(0036311)
Brad King   
2014-07-02 14:22   
Re 0015002:0036310: On second thought, I see the set-new/set-old pair is already used for LD_LIBRARY_PATH and that a bit of other refactoring would be needed to wrap the call in "cmake -E env". I think the proposed patch's approach is good enough for now.

grep the Modules directory for "SAVED_LC_ALL" to see the convention used elsewhere for this. Also I do not think this needs to be conditional on the gp_tool because it won't hurt to set it for all tools.
(0042577)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.