[vtkusers] Building vtk classes HELP!!!!!

Yi-Yu Chou chouyiyu at hotmail.com
Fri Jan 16 07:00:25 EST 2004


Hi,

I am trying to build my own vtk classes on Linux using vtk4.2, and I have 
two accounts:
yyroot : has the rigth to full access /usr/lib/vtk40/VTK
gtg353c: only has the right to access /home/gtg353c
I can successfully build the example under 
/usr/lib/vtk40/VTK/Examples/Build/vtkLocal by using yyroot,
but when I tried to move these files to a out-of-source place (I copied the 
folder to /home/gtg353c/vtkLocal) and built it by gtg353c, it failed to run 
"make".
The error messages are :

Building object file vtkLocalExample.o...
Building object file vtkLocalInstantiator.o...
Building shared library 
/usr/lib/vtk40/VTK/Examples/Build/vtkLocal/bin/libvtkLocal.so...
/usr/bin/ld: cannot open output file 
/usr/lib/vtk40/VTK/Examples/Build/vtkLocal/
bin/libvtkLocal.so: Permission denied
collect2: ld returned 1 exit status
make[1]: *** 
[/usr/lib/vtk40/VTK/Examples/Build/vtkLocal/bin/libvtkLocal.so] Error 1
make: *** [default_target] Error 2

Sould I change any option when running ccmake or I need to edit the 
CMakeList.txt ?
Please help me build it in a out-of-source place.
Any suggestion will be appreciated !!!

YY

// Below is the CMakeList.txt //
CMAKE_MINIMUM_REQUIRED(VERSION 1.6)

# Set the project/library name here.  Classes should be declared as
# "class vtkLocal_EXPORT vtkFoo", where vtkLocal is the name of the
# project set here.
PROJECT(vtkLocal)

# Set your list of sources here.  Do not change the name of the
# vtkLocal_SRCS variable.
SET(vtkLocal_SRCS
  vtkLocalExample.cxx
)

# List the kits from VTK that are needed by this project.
SET(vtkLocal_LIBS
  vtkCommon
)

#-----------------------------------------------------------------------------

# Most users should not need to change anything below this line.

# Need to include class headers and the configuration header.
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})

# Find and load VTK settings.
INCLUDE(${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF(VTK_FOUND)
  INCLUDE(${VTK_USE_FILE})
ENDIF(VTK_FOUND)

# Give user option of building shared or static libraries.  Default to
# the choice made for VTK.
OPTION(BUILD_SHARED_LIBS "Build with shared libraries." 
       ${VTK_BUILD_SHARED_LIBS})

# Set VTKLOCAL_BUILD_SHARED_LIBS to 1 or 0 for use in creating the
# configuration header.
IF(BUILD_SHARED_LIBS)
  SET(VTKLOCAL_BUILD_SHARED_LIBS_CONFIG 1)
ELSE(BUILD_SHARED_LIBS)
  SET(VTKLOCAL_BUILD_SHARED_LIBS_CONFIG 0)
ENDIF(BUILD_SHARED_LIBS)

SET (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH
     "Single output directory for building all libraries.")

SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH
     "Single output directory for building all executables.")

MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)

IF(VTK_FOUND)
  # If this is a build tree, provide an option for putting this
  # project's executables and libraries in with VTK's.
  IF (EXISTS ${VTK_DIR}/bin)
    OPTION(USE_VTK_OUTPUT_PATHS
     "Use VTK's output directory for this project's executables and 
libraries."
     OFF)
    MARK_AS_ADVANCED (USE_VTK_OUTPUT_PATHS)
    IF (USE_VTK_OUTPUT_PATHS)
      SET (LIBRARY_OUTPUT_PATH ${VTK_DIR}/bin)
      SET (EXECUTABLE_OUTPUT_PATH ${VTK_DIR}/bin)
    ENDIF (USE_VTK_OUTPUT_PATHS)
  ENDIF (EXISTS ${VTK_DIR}/bin)

  # Create the header to configure the classes.
  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/vtkLocalConfigure.h.in
                 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Configure.h
                 @ONLY IMMEDIATE)

  # Create the instantiator for these classes.
  SET(VTK_USE_INSTANTIATOR_NEW 1)
  VTK_MAKE_INSTANTIATOR2("${PROJECT_NAME}Instantiator" 
vtkLocalInstantiator_SRCS
                         ${vtkLocal_SRCS}
                         EXPORT_MACRO "VTK_${PROJECT_NAME}_EXPORT"
                         HEADER_LOCATION ${PROJECT_BINARY_DIR}
                         INCLUDES "${PROJECT_NAME}Configure.h")

  # Create the library.
  ADD_LIBRARY(${PROJECT_NAME} ${vtkLocal_SRCS} 
${vtkLocalInstantiator_SRCS})
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${vtkLocal_LIBS})

  # Create Tcl wrappers if VTK is wrapped in Tcl.
  IF(VTK_WRAP_TCL)
    VTK_WRAP_TCL2(${PROJECT_NAME}TCL vtkLocalTCL_SRCS ${vtkLocal_SRCS})
    ADD_LIBRARY(${PROJECT_NAME}TCL ${vtkLocalTCL_SRCS})
    TARGET_LINK_LIBRARIES(${PROJECT_NAME}TCL vtkCommonTCL ${PROJECT_NAME})

    # Create the list of kits that are required.
    SET(VTKLOCAL_KITS "")
    FOREACH(c ${vtkLocal_LIBS})
      SET(VTKLOCAL_KITS "${VTKLOCAL_KITS} ${c}")
    ENDFOREACH(c)
    FOREACH(c ${vtkLocal_SRCS})
      GET_FILENAME_COMPONENT(VTKLOCAL_LAST_CLASS ${c} NAME_WE)
    ENDFOREACH(c)

    IF(CMAKE_CONFIGURATION_TYPES)
      FOREACH(config ${CMAKE_CONFIGURATION_TYPES})
        SET(VTKLOCAL_TCL_LIBRARY_DIR "${LIBRARY_OUTPUT_PATH}/${config}")
        CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pkgIndex.tcl.in
                       ${PROJECT_BINARY_DIR}/${config}/pkgIndex.tcl
                       @ONLY IMMEDIATE)
      ENDFOREACH(config)
    ELSE(CMAKE_CONFIGURATION_TYPES)
      SET(VTKLOCAL_TCL_LIBRARY_DIR "${LIBRARY_OUTPUT_PATH}")
      CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pkgIndex.tcl.in
                     ${PROJECT_BINARY_DIR}/pkgIndex.tcl
                     @ONLY IMMEDIATE)
    ENDIF(CMAKE_CONFIGURATION_TYPES)

  ENDIF(VTK_WRAP_TCL)

  # Create Python wrappers if VTK is wrapped in Python.
  IF(VTK_WRAP_PYTHON)
    VTK_WRAP_PYTHON2(${PROJECT_NAME}Python vtkLocalPYTHON_SRCS 
${vtkLocal_SRCS})
    ADD_LIBRARY(${PROJECT_NAME}Python MODULE ${vtkLocalPYTHON_SRCS})
    TARGET_LINK_LIBRARIES(${PROJECT_NAME}Python vtkCommonPython 
${PROJECT_NAME})
  ENDIF(VTK_WRAP_PYTHON)

  # Create Java wrappers if VTK is wrapped in Java.
  IF(VTK_WRAP_JAVA)
    SET(VTK_WRAP_HINTS "${PROJECT_SOURCE_DIR}/hints")
    SET(VTK_JAVA_HOME ${PROJECT_BINARY_DIR}/java/${PROJECT_NAME})
    MAKE_DIRECTORY(${VTK_JAVA_HOME})
    VTK_WRAP_JAVA2(${PROJECT_NAME}Java vtkLocalJAVA_SRCS ${vtkLocal_SRCS})
    ADD_LIBRARY(${PROJECT_NAME}Java ${vtkLocalJAVA_SRCS})
    TARGET_LINK_LIBRARIES(${PROJECT_NAME}Java vtkCommonJava 
${PROJECT_NAME})
  ENDIF(VTK_WRAP_JAVA)

  SUBDIRS(Testing)
ENDIF(VTK_FOUND)

_________________________________________________________________
想戀愛?交朋友?MSN 線上交友:由 Match.com 提供,全世界最受歡迎的線上交友服
務 http://match.msn.com.tw 




More information about the vtkusers mailing list