Hi Roman,
you approach ("<CMAKE_XL_CreateExportList_FLAGS> right after ${CMAKE_XL_CreateExportList} in XL.cmake and then add -X32/-X64 into CMAKE_XL_CreateExportList_FLAGS in your CMakeLists.txt") did not work. It generated the attached link.txt, where it did not replace <CMAKE_XL_CreateExportList_FLAGS> with "-X64" (I set it with "set( CMAKE_XL_CreateExportList_FLAGS -X64 )" in the CMakeLists.txt).

Furthermore, I think the whole handling of 64bit builds on AIX is broken in cmake. Other tools dealing with object files like ar, nm, and ranlib also need a "-X64" flag when dealing with 64bit object files. cmake does not set them itself when CMAKE_SIZEOF_VOID_P indicates a 64bit build and also does not have CMAKE_${tool}_FLAGS variables to be able to set these flags manually in a CMakeLists.txt.

Regards,
    Michael.

On 02/24/2015 06:57 AM, Roman Bolshakov wrote:
Hi Michael,

Gotcha, thanks for explanation. Right, there should be a way to pass
-X32/-X64 for CreateExportList right prior to
<OBJECT_DIR>/objects.exp. Current definition in
Modules/Compiler/XL.cmake doesn't have a spot for that:
        set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
       "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>
       "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS>
<LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS>
<CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS>
-Wl,-bE:<OBJECT_DIR>/objects.exp <SONAME_FLAG><TARGET_SONAME> -o
<TARGET> <OBJECTS> <LINK_LIBRARIES>"
       )

I think it's worth a bug report/contribution. Not sure if it'd work
but if you might try to modify your local installation of CMake and
add something like <CMAKE_XL_CreateExportList_FLAGS> right after
${CMAKE_XL_CreateExportList} in XL.cmake and then add -X32/-X64 into
CMAKE_XL_CreateExportLists_FLAGS in your CMakeLists.txt

Roman

--
Michael Hufer
Senior Software Developer
-------------------------------
Dion Global Solutions GmbH
Mainzer Landstr. 199  I  60322 Frankfurt am Main  I  Germany
phone: +49 69 50952 241
email:[email protected] | web: www.dionglobal.com/de
HRB-Nr./Commercial Register No. 83397
Geschäftsführer / Managing Directors: Ralph James Horne, Joseph Nash

/usr/vacpp/bin/CreateExportList CMAKE_XL_CreateExportList_FLAGS 
CMakeFiles/xmq_s.dir/objects.exp CMakeFiles/xmq_s.dir/Xmq.cpp.o 
CMakeFiles/xmq_s.dir/XmqMsgDump.cpp.o CMakeFiles/xmq_s.dir/xmq_s_version.cpp.o
/usr/vacpp/bin/xlC_r    -q64 -qthreaded -qalias=noansi -qhalt=e -qtwolink 
-qrtti=all -qinlglue -qnotemplateregistry -qnotempinc -qlanglvl=newexcp -g 
-L/home/xgbuild/xgen-trunk/lib/AIX_p64 
-L/home/xgbuild/xgen-trunk/external/AIX_p64/libs/mqs-6.0/lib 
-qexpfile=export.symbols -q64 -bh:5 -lc -lm -G -Wl,-bnoipath 
-Wl,-bE:CMakeFiles/xmq_s.dir/objects.exp  -o libxmq_s.so 
CMakeFiles/xmq_s.dir/Xmq.cpp.o CMakeFiles/xmq_s.dir/XmqMsgDump.cpp.o 
CMakeFiles/xmq_s.dir/xmq_s_version.cpp.o  
-L/home/xgbuild/xgen-trunk/lib/AIX_p64 ../libxgencore/libxgencore.so -lmqm_r 
-lmqmxa64_r -lACE -lexpat -lpcre 
-Wl,-blibpath:/home/xgbuild/xgen-trunk/build/pitbull/src/libxgencore:/home/xgbuild/xgen-trunk/lib/AIX_p64:/usr/lib:/lib
 
#=============================================================================
# Copyright 2002-2011 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)

# This module is shared by multiple languages; use include blocker.
if(__COMPILER_XL)
  return()
endif()
set(__COMPILER_XL 1)

# Find the CreateExportList program that comes with this toolchain.
find_program(CMAKE_XL_CreateExportList
  NAMES CreateExportList
  DOC "IBM XL CreateExportList tool"
  )

macro(__compiler_xl lang)
  # Feature flags.
  set(CMAKE_${lang}_VERBOSE_FLAG "-V")
  set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")

  set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
  set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O")
  set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O")
  set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g")
  set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
  set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE     "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")

  # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
  # If we found the tool, we'll use it to create exports, otherwise stick with the regular
  # create shared library compile line.
  if (CMAKE_XL_CreateExportList)
    # The compiler front-end passes all object files, archive files, and shared
    # library files named on the command line to CreateExportList to create a
    # list of all symbols to be exported from the shared library.  This causes
    # all archive members to be copied into the shared library whether they are
    # needed or not.  Instead we run the tool ourselves to pass only the object
    # files so that we export only the symbols actually provided by the sources.
    set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
      "${CMAKE_XL_CreateExportList} <CMAKE_XL_CreateExportList_FLAGS> <OBJECT_DIR>/objects.exp <OBJECTS>"
      "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
      )
  endif()
endmacro()
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to