CMake Platform Dependent Issues: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
Line 15: Line 15:


* [[CMake Wacom Compiler Issues|Wacom Compiler Issues]]
* [[CMake Wacom Compiler Issues|Wacom Compiler Issues]]
== OS Specific Programs ==
{| border="1"
|- bgcolor="#abcdef"
! Platform !! System Info !! OS Distribution Version
|-
| Linux || uname -a ||
|-
| HP-UX || uname -a ||
|-
| AIX || uname -a ||
|-
| SunOS || uname -a ||
|-
| IRIX || hinv, uname -a ||
|-
| Max OSX / Darwin || system_profiler, uname -a || About This Mac, /usr/bin/sw_ver
|-
| Cygwin || uname -a ||
|-
|rowspan=3| Windows || ver || ver
|}


== The Platforms / Compilers Table ==
== The Platforms / Compilers Table ==
Line 20: Line 44:
{| border="1"
{| border="1"
|- bgcolor="#abcdef"
|- bgcolor="#abcdef"
! Platform !! System Info !! Compilers !! Macros !! List Dependencies !! List Symbols !! Trace Syscal/Signal !! Runtime Library Path
! Platform !! Compilers !! Macros !! List Dependencies !! List Symbols !! Trace Syscal/Signal !! Runtime Library Path
|-
|-
| Linux || uname -a || gcc, g++, icc || __linux || ldd program || nm || strace || LD_LIBRARY_PATH
| Linux || gcc, g++, icc || __linux || ldd program || nm || strace || LD_LIBRARY_PATH
|-
|-
| HP-UX || uname -a || cc, [http://docs.hp.com/en/B3901-90019/index.html aCC] || __hpux || chatr program || nm || || SHLIB_PATH (32), LD_LIBRARY_PATH (64)
| HP-UX || cc, [http://docs.hp.com/en/B3901-90019/index.html aCC] || __hpux || chatr program || nm || || SHLIB_PATH (32), LD_LIBRARY_PATH (64)
|-
|-
| AIX || uname -a || xlc, xlC || _AIX || dump -H program || nm || || LIBPATH
| AIX || xlc, xlC || _AIX || dump -H program || nm || || LIBPATH
|-
|-
| SunOS || uname -a || cc, CC || __sparc || ldd program || nm || || LD_LIBRARY_PATH (32), LD_LIBRARY_PATH_64 (64)
| SunOS || cc, CC || __sparc || ldd program || nm || || LD_LIBRARY_PATH (32), LD_LIBRARY_PATH_64 (64)
|-
|-
| IRIX || hinv, uname -a || cc, CC || __sgi || ldd program || || || LD_LIBRARY_PATH (o32), LD_LIBRARYN32_PATH (n32), LD_LIBRARY64_PATH (64)
| IRIX || cc, CC || __sgi || ldd program || || || LD_LIBRARY_PATH (o32), LD_LIBRARYN32_PATH (n32), LD_LIBRARY64_PATH (64)
|-
|-
| Max OSX / Darwin || system_profiler, uname -a || gcc, g++ || __APPLE__ || otool -L program || nm || ktrace -f outfile program; kdump outfile || DYLD_LIBRARY_PATH
| Max OSX / Darwin || gcc, g++ || __APPLE__ || otool -L program || nm || ktrace -f outfile program; kdump outfile || DYLD_LIBRARY_PATH
|-
|-
| Cygwin || uname -a || gcc, g++ || __CYGWIN__, _WIN32 || depends program.exe || nm ||  || PATH
| Cygwin || gcc, g++ || __CYGWIN__, _WIN32 || depends program.exe || nm ||  || PATH
|-
|-
|rowspan=3| Windows ||rowspan=3| ver || Visual Studio 6, cl ||rowspan=3| _WIN32 || depends program.exe ||rowspan=3| dumpbin ||rowspan=3| ||rowspan=3| PATH
|rowspan=3| Windows || Visual Studio 6, cl ||rowspan=3| _WIN32 || depends program.exe ||rowspan=3| dumpbin ||rowspan=3| ||rowspan=3| PATH
|-
|-
|Visual Studio 7, cl || depends program.exe '''†'''
|Visual Studio 7, cl || depends program.exe '''†'''

Revision as of 21:07, 11 April 2007

Specific Platforms

Linux

Mac OSX

Windows

OS Specific Programs

Platform System Info OS Distribution Version
Linux uname -a
HP-UX uname -a
AIX uname -a
SunOS uname -a
IRIX hinv, uname -a
Max OSX / Darwin system_profiler, uname -a About This Mac, /usr/bin/sw_ver
Cygwin uname -a
Windows ver ver


The Platforms / Compilers Table

Platform Compilers Macros List Dependencies List Symbols Trace Syscal/Signal Runtime Library Path
Linux gcc, g++, icc __linux ldd program nm strace LD_LIBRARY_PATH
HP-UX cc, aCC __hpux chatr program nm SHLIB_PATH (32), LD_LIBRARY_PATH (64)
AIX xlc, xlC _AIX dump -H program nm LIBPATH
SunOS cc, CC __sparc ldd program nm LD_LIBRARY_PATH (32), LD_LIBRARY_PATH_64 (64)
IRIX cc, CC __sgi ldd program LD_LIBRARY_PATH (o32), LD_LIBRARYN32_PATH (n32), LD_LIBRARY64_PATH (64)
Max OSX / Darwin gcc, g++ __APPLE__ otool -L program nm ktrace -f outfile program; kdump outfile DYLD_LIBRARY_PATH
Cygwin gcc, g++ __CYGWIN__, _WIN32 depends program.exe nm PATH
Windows Visual Studio 6, cl _WIN32 depends program.exe dumpbin PATH
Visual Studio 7, cl depends program.exe
Visual Studio 7.1, cl depends program.exe

Architecture Modes

Compiler Command Languages Architecture Flags Macros
GNU gcc C __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
g++ C++
SGI MIPSpro cc C -o32, -n32, -64 _COMPILER_VERSION, _MIPS_SIM==_ABIO32 (o32), _MIPS_SIM==_ABIN32 (n32), _MIPS_SIM==_ABI64 (64)
CC C++
SunPro cc C -xarch=... __SUNPRO_C #include <sys/isa_defs.h>: _ILP32 (32), _LP64 (64)
CC C++ __SUNPRO_CC
HP cc C +DD64 __LP64__ (64)
aCC C++ __HP_aCC
IBM VisualAge xlc C -q32, -q64 __IBMC__
xlC C++ __IBMCPP__

Compiler Options and Flags

Compiler Full warnings Warnings as Errors Disabling a particular warning (#n)
gcc -W -Wall -Werror
MIPS Pro -fullwarn -w2
icc -Wall -w2 -Wcheck -Werror -wd(#n)
bcc32 -g1 -w-(#n)
xlC -qflag=w:w or -qlanglv=ansi
cl /W4 /WX /Wd(#n)
aCC +w +We +Warg1[,arg2,..argn]
  • More platform specific information can be found in ROSETTA STONE platforms table (Mostly for system administrators)

Debugging Tips

Using special debug libraries on various systems

Platform Operation
Debian GNU/Linux export LD_LIBRARY_PATH=/usr/lib/debug
Mac OS X export DYLD_IMAGE_SUFFIX=_debug

The gdbrun Script for UNIX-like Platforms

The following is an extremely useful script that will run any command line in a gdb debugger. Put this text in an executable file called "gdbrun":

#!/bin/sh

extra_text=""
if [ "$1" == "--break-main" ]; then
  extra_text="break main"
  shift
fi

EXEC="$1"

shift

run_text="run"
for a in "$@"; do
  run_text="${run_text} \"$a\""
done

TMPFILE=/tmp/gdbrun.$$.$#.tmp
cat > ${TMPFILE} <<EOF
${extra_text}
${run_text}
EOF

gdb -x ${TMPFILE} "${EXEC}"
rm -f "${TMPFILE}"

Then one may debug a test like this:

gdbrun /path/to/myexe --some-arg --some-other-arg

Notes about this script:

  • It supports spaces in argument names (note the for loop)
  • Takes extra argument --break-main, which causes the program to stop once all the libraries are loaded
  • It always run debugger, even when program exits normally
  • Cannot be used with MPI or any other system that runs your program from a shell script



CMake: [Welcome | Site Map]