Changes between Version 1 and Version 2 of Scripts/Point_Cloud_Library_1.5.1_script


Ignore:
Timestamp:
May 23, 2012, 3:37:13 PM (13 years ago)
Author:
kato23@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Scripts/Point_Cloud_Library_1.5.1_script

    v1 v2  
    22
    33The required dependencies will be built with the MacPorts system and {{{clang-3.2}}} whenever possible.
     4
     5
     6{{{
     7
     8
     9sudo -H -i
     10
     11# cf. https://trac.macports.org/wiki/Scripts/testport_script
     12/usr/local/bin/testport -p -l /opt/macports-test-universal
     13export PATH="/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
     14alias testport='/usr/local/bin/testport'
     15
     16export LC_ALL=C
     17
     18# clang-3.2 +universal
     19testport -l /opt/macports-test-universal clang-3.2 +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2'
     20
     21
     22# MacPorts: tar: Write error: Broken pipe
     23# --->  Installing llvm-3.0 @3.0_4+universal
     24# Error: Target org.macports.install returned: shell command failed (see log for details)
     25# Error: Failed to install llvm-3.0
     26# Log for llvm-3.0 is at: /opt/macports-test-universal/var/macports/logs/_opt_macports-test-universal_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.0/llvm-3.0/main.log
     27#
     28# port log llvm-3.0
     29#    ...
     30#    :info:install bzip2/libbzip2: internal error number 1007.
     31#    ...
     32#    :info:install *** A special note about internal error number 1007 ***
     33#    ...
     34#    :info:install tar: Write error: Broken pipe
     35#    :info:install shell command " cd "/opt/macports-test-universal/var/macports/build/_opt_macports-test-universal_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.0/llvm-3.0/work/destroot" && /usr/bin/tar -cvf - . | /usr/bin/bzip2 -c9 > /opt/macports-test-universal/var/macports/software/llvm-3.0/llvm-3.0-3.0_4+universal.darwin_10.i386-x86_64.tbz2 " returned error 3
     36#    :error:install Target org.macports.install returned: shell command failed (see log for details)
     37#    ...
     38
     39cd "$(port dir llvm-3.0)"/work/destroot
     40/usr/bin/tar -cvf - . | /usr/bin/bzip2 -c9 > /opt/macports-test-universal/var/macports/software/llvm-3.0/llvm-3.0-3.0_4+universal.darwin_10.i386-x86_64.tbz2
     41
     42# redo: clang-3.2 +universal
     43testport -l /opt/macports-test-universal clang-3.2 +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2'
     44
     45
     46
     47# glib2 +universal
     48testport -l /opt/macports-test-universal glib2 +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2'
     49
     50
     51# apple-gcc42 +universal
     52# gcc47 +universal
     53# gcc48 +universal
     54[[ -L '/usr/include/malloc.h' ]] && sudo mv -iv /usr/include/malloc.h /usr/include/malloc.h.moved
     55testport -l /opt/macports-test-universal apple-gcc42 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     56testport -l /opt/macports-test-universal gcc47 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     57testport -l /opt/macports-test-universal gcc48 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     58
     59
     60
     61# cmake +universal
     62testport -l /opt/macports-test-universal cmake +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     63
     64# boost +universal
     65testport -l /opt/macports-test-universal boost +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     66
     67
     68# doxygen +universal
     69testport -l /opt/macports-test-universal doxygen +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     70
     71
     72# Error: You cannot install gd2 for the architecture(s) x86_64 i386 because
     73# Error: its dependency fontconfig only contains the architecture(s) x86_64.
     74# cf. "Error: Failed to install fontconfig", https://trac.macports.org/ticket/30329
     75# Non-fat file: /opt/macports-test-universal/lib/libfontconfig.dylib is architecture: x86_64
     76# Architectures in the fat file: /opt/macports-test-universal/lib/libfontconfig.dylib are: i386 x86_64
     77# lipo -info /opt/macports-test-universal/lib/*.dylib | grep -i 'Non-fat file'
     78port -v installed pkgconfig libiconv expat freetype libiconv fontconfig
     79lipo -info /opt/macports-test-universal/lib/libfontconfig.dylib
     80port -n upgrade --force fontconfig +universal
     81
     82
     83# gd2 +universal
     84port clean --all gd2
     85testport -l /opt/macports-test-universal gd2 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     86
     87# netpbm +universal
     88testport -l /opt/macports-test-universal netpbm +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2'
     89
     90# graphviz +universal
     91port clean --all graphviz
     92testport -l /opt/macports-test-universal graphviz +universal configure.cc='/usr/bin/gcc-4.2' configure.cxx='/usr/bin/g++-4.2'
     93
     94
     95# redo: doxygen +universal
     96#testport -c -l /opt/macports-test-universal doxygen +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     97testport -l /opt/macports-test-universal doxygen +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2'
     98
     99
     100
     101# flann (not universal!)
     102testport -l /opt/macports-test-universal  flann  configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     103
     104
     105# py27-sphinx +universal
     106testport -l /opt/macports-test-universal  py27-sphinx +universal  configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     107
     108
     109# google-test +universal
     110# port info google-test
     111# google-test @1.5.0 (devel) (May 2012)
     112# googletest version >= 1.6.0 (http://code.google.com/p/googletest/)
     113# Google's framework for writing C++ tests on a variety of platforms. Used to build test units.
     114# testport -l /opt/macports-test-universal  google-test +universal  configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     115
     116
     117# eigen3 +universal
     118# qhull +universal
     119# libusb-devel +universal
     120
     121export IFS=$' \t\n'
     122for portname in eigen3 qhull libusb-devel; do
     123   printf '\n\n%s\n\n' "testport -l /opt/macports-test-universal  ${portname} +universal  configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'"
     124   testport -l /opt/macports-test-universal  "${portname}" +universal  configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     125done
     126
     127
     128
     129# vtk5 +universal+x11
     130port variants vtk5
     131testport -l /opt/macports-test-universal  vtk5 +universal+x11  configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     132
     133# sudo port select --set python python27
     134# sudo port load rsync
     135
     136
     137
     138# opencv +universal+python27
     139testport -l /opt/macports-test-universal opencv +universal+python27 configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'
     140
     141
     142
     143# OpenNI
     144# install OpenNI in /usr/local-pcl
     145# https://github.com/OpenNI/OpenNI/
     146
     147export PATH="/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
     148cd /Users/${SUDO_USER}/Downloads || exit
     149[[ ! -f OpenNI.zip ]] && { curl -L -o OpenNI.zip https://github.com/OpenNI/OpenNI/zipball/master || exit; }
     150rm -rf *OpenNI-*
     151unzip -qq OpenNI.zip
     152cd *OpenNI-*/Platform/Linux*/CreateRedist/
     153chmod +x RedistMaker
     154export CC='/opt/macports-test-universal/bin/clang-mp-3.2' CXX='/opt/macports-test-universal/bin/clang++-mp-3.2'
     155export CFLAGS='-I/opt/macports-test-universal/include' LDFLAGS='-L/opt/macports-test-universal/lib' 
     156./RedistMaker
     157cd ../Redist/OpenNI*
     158export X86_CXX=/opt/macports-test-universal/bin/clang++-mp-3.2
     159export X86_STAGING=/usr/local-pcl
     160chmod +x install.sh
     161
     162cat <<-'EOF' | ed -s install.sh
     163H
     164/printf "copying shared libraries..."/a
     165mkdir -p $INSTALL_LIB
     166.
     167/printf "copying executables..."/a
     168mkdir -p $INSTALL_BIN
     169.
     170wq
     171EOF
     172
     173./install.sh -c "${X86_STAGING}"
     174
     175
     176# sanitize .dylib install names
     177otool -L /usr/local-pcl/usr/lib/*
     178find /usr/local-pcl -type f -name "*.dylib" -print0 | while IFS="" read -r -d "" dylibpath; do
     179   echo install_name_tool -id "$dylibpath" "$dylibpath"
     180   install_name_tool -id "$dylibpath" "$dylibpath"
     181done | nl
     182
     183
     184otool -L /usr/local-pcl/usr/bin/* /usr/local-pcl/usr/lib/*
     185find /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib -type f -print0 | xargs -0 otool -L | grep '\.\./\.\./' | sort -u
     186
     187find /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib -type f -print0 | while IFS="" read -r -d "" file; do
     188   old='../../Bin/x64-Release/libOpenNI.dylib'
     189   new='/usr/local-pcl/usr/lib/libOpenNI.dylib'
     190   sudo install_name_tool -change "$old" "$new" "$file"
     191done
     192
     193
     194
     195dos2unixdir() {
     196
     197crchar="$(printf "\r")"
     198grep -Ilsr -m 1 -Z -e "${crchar}" . |
     199   xargs -0 -n 1 /bin/sh -c '
     200      crchar="$(printf "\r")"
     201      echo "crchar: ${1}"
     202      printf "%s\n" H ",g/${crchar}*$/s///g" wq | /bin/ed -s "${1}"
     203   ' argv0
     204
     205return 0
     206
     207}
     208
     209
     210# Sensor
     211# PrimeSensor Modules for OpenNI
     212# https://github.com/PrimeSense/Sensor
     213
     214export PATH='/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/local-pcl/bin:/usr/bin:/bin:/usr/sbin:/sbin'
     215
     216cd /Users/${SUDO_USER}/Downloads || exit
     217[[ ! -f Sensor.zip ]] && { curl -L -o Sensor.zip https://github.com/PrimeSense/Sensor/zipball/master || exit; }
     218rm -rf *Sensor-*
     219unzip -qq Sensor.zip
     220cd PrimeSense-Sensor-*
     221dos2unixdir
     222cd ../PrimeSense-Sensor-*/Platform/Linux/CreateRedist
     223export CC='/opt/macports-test-universal/bin/clang-mp-3.2' CXX='/opt/macports-test-universal/bin/clang++-mp-3.2'
     224export CFLAGS='-I/usr/include -I/opt/macports-test-universal/include -I/usr/local-pcl/usr/include -I/usr/local-pcl/usr/include/ni' LDFLAGS='-L/opt/macports-test-universal/lib -L/usr/local-pcl/usr/lib' 
     225xattr -d com.apple.quarantine RedistMaker
     226
     227# remove -j option to make command in RedistMaker file
     228printf '%s\n' H '/-j$(calc_jobs_number)/s///' wq | ed -s RedistMaker
     229
     230./RedistMaker
     231
     232cd ../Redist/Sensor-Bin-MacOSX-*
     233export X86_CXX=/opt/macports-test-universal/bin/clang++-mp-3.2
     234export X86_STAGING=/usr/local-pcl
     235chmod +x install.sh
     236./install.sh -c "${X86_STAGING}"
     237
     238
     239# sanitize .dylib install names
     240
     241otool -L /usr/local-pcl/usr/bin/* /usr/local-pcl/usr/lib/*
     242find /usr/local-pcl/usr/lib /usr/local-pcl/usr/bin -type f -print0 | xargs -0 otool -L | grep '\.\./\.\./' | sort -u
     243
     244find /usr/local-pcl/usr/lib /usr/local-pcl/usr/bin -type f -print0 | while IFS="" read -r -d "" file; do
     245
     246   old1='../../Bin/x64-Release/libOpenNI.dylib'
     247   new1='/usr/local-pcl/usr/lib/libOpenNI.dylib'
     248
     249   old2='../../Bin/x64-Release/libXnCore.dylib'
     250   new2='/usr/local-pcl/usr/lib/libXnCore.dylib'
     251
     252   old3='../../Bin/x64-Release/libXnDDK.dylib'
     253   new3='/usr/local-pcl/usr/lib/libXnDDK.dylib'
     254
     255   old4='../../Bin/x64-Release/libXnDeviceFile.dylib'
     256   new4='/usr/local-pcl/usr/lib/libXnDeviceFile.dylib'
     257
     258   old5='../../Bin/x64-Release/libXnDeviceSensorV2.dylib'
     259   new5='/usr/local-pcl/usr/lib/libXnDeviceSensorV2.dylib'
     260
     261   old6='../../Bin/x64-Release/libXnFormats.dylib'
     262   new6='/usr/local-pcl/usr/lib/libXnFormats.dylib'
     263
     264   sudo install_name_tool -change "$old1" "$new1" -change "$old2" "$new2" -change "$old3" "$new3" -change "$old4" "$new4" -change "$old5" "$new5" -change "$old6" "$new6" "$file"
     265
     266done
     267
     268
     269# sanitize .dylib install names
     270find /usr/local-pcl -type f -name "*.dylib" -print0 | while IFS="" read -r -d "" dylibpath; do
     271   echo install_name_tool -id "$dylibpath" "$dylibpath"
     272   install_name_tool -id "$dylibpath" "$dylibpath"
     273done | nl
     274
     275
     276otool -L /usr/local-pcl/usr/bin/* /usr/local-pcl/usr/lib/*
     277
     278
     279# not needed anymore
     280# cminpack 1.2.2 (in /usr/local-pcl)
     281# http://devernay.free.fr/hacks/cminpack/index.html
     282curl -L -O http://devernay.free.fr/hacks/cminpack/cminpack-1.2.2.tar.gz
     283rm -rf cminpack-1.2.2
     284tar -xf cminpack-1.2.2.tar.gz
     285cd cminpack-1.2.2
     286mkdir build
     287cd build
     288cmake -DUSE_FPIC=ON -DSHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr/local-pcl ..
     289make
     290sudo make install
     291otool -L /usr/local-pcl/lib/libcminpack.dylib
     292sudo install_name_tool -id /usr/local-pcl/lib/libcminpack.1.0.90.dylib /usr/local-pcl/lib/libcminpack.1.0.90.dylib
     293
     294
     295# PCL 1.5.1 (2012.02.22)
     296# http://www.pointclouds.org/downloads/
     297cd /Users/${SUDO_USER}/Downloads
     298[[ ! -f 'PCL-1.5.1-Source.tar.bz2' ]] && curl -L -O http://www.pointclouds.org/assets/files/1.5.1/PCL-1.5.1-Source.tar.bz2
     299rm -rf PCL-1.5.1-Source
     300tar -xf PCL-1.5.1-Source.tar.bz2
     301cd PCL-1.5.1-Source
     302#dos2unixdir
     303export PATH='/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/local-pcl/bin:/usr/local-pcl/sbin:/usr/bin:/bin:/usr/sbin:/sbin'
     304mkdir build
     305cd build
     306
     307# all three variants below did cause build / compiler (gcc) errors in the make build phase on Mac OS X 10.6.8
     308###env CC=/opt/macports-test-universal/bin/clang-mp-3.2 CXX=/opt/macports-test-universal/bin/clang++-mp-3.2 \
     309###env CC=/opt/macports-test-universal/bin/gcc-mp-4.7 CXX=/opt/macports-test-universal/bin/g++-mp-4.7 \
     310###env CC=/opt/macports-test-universal/bin/gcc-mp-4.8 CXX=/opt/macports-test-universal/bin/g++-mp-4.8 \
     311
     312#env CC=/usr/bin/gcc-4.2 CXX=/usr/bin/g++-4.2 \
     313env CC=/opt/macports-test-universal/bin/gcc-apple-4.2 CXX=/opt/macports-test-universal/bin/g++-apple-4.2 \
     314  cmake -DCMAKE_PREFIX_PATH='/opt/macports-test-universal:/usr/local-pcl/usr' -DOPENNI_INCLUDE_DIR=/usr/local-pcl/usr/include/ni \
     315         -DOPENNI_LIBRARY=/usr/local-pcl/usr/lib/libOpenNI.dylib -DCMAKE_INSTALL_PREFIX=/usr/local-pcl ..
     316
     317
     318# edit cmake_install.cmake files:  "lib..*\.dylib"  -->  "${CMAKE_INSTALL_PREFIX}/lib/lib..*\.dylib"
     319printf '\n\n%s\n\n' "${PWD}: install_name_tool search & replace:   \"lib..*.dylib\"   -->   \"\${CMAKE_INSTALL_PREFIX}/lib/lib..*.dylib\""
     320egrep -Ilsr -Z -e 'install_name_tool' . | xargs -0 egrep -Ils '"lib..*\.dylib"' | nl
     321
     322egrep -Ilsr -Z -e 'install_name_tool' . |
     323   xargs -0 egrep -Ils -Z '"lib..*\.dylib"' |
     324   xargs -0 -n 1 /bin/sh -c 'printf "%s\n" H "g/\"\(lib..*\.dylib\)\"/s||\"\${CMAKE_INSTALL_PREFIX}/lib/\1\"|g" wq | /bin/ed -s "${1}"' argv0
     325
     326# for use with gcc-mp-4.7 / g++-mp-4.7 and gcc-mp-4.8 / g++-mp-4.8 only
     327###egrep -Ilsr -Z -e ' \-Wl ' . | xargs -0 -n 1 /bin/sh -c 'printf "%s\n" H "g/ \-Wl /s|| |g" wq | /bin/ed -s "${1}"' argv0
     328
     329make
     330make install
     331
     332
     333find -x /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib /usr/local-pcl/bin /usr/local-pcl/lib -type f -print0 | xargs -0 otool -L 2>/dev/null | less
     334find /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib /usr/local-pcl/bin /usr/local-pcl/lib -type f -print0 | xargs -0 otool -L | grep '\.\./\.\./' | sort -u
     335
     336
     337
     338}}}