For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Configuration error on Debian stretch

Alain Bertrand's picture

In a freshly made occ-build directory

cmake ../opencascade-7.2.0/

[...]

CMake Error at CMakeLists.txt:871 (file):
  file failed to open for writing (Permission denied):

    /usr/local/bin/custom.sh

-- Info: (13:41:20) OCCT toolkits processed
-- Info: (13:41:20) OCCT configuration files prepared
-- Configuring incomplete, errors occurred!

I feel pretty much normal that writing a file in /usr/local/bin/ fails when a script is run as an unprivileged user because it should be written only at the make install step (with root rights). How should I fix this problem to be able to compile OCC as a normal user and have /usr/local/ as prefix ?

Kirill Gavrilov's picture

The error is triggered at the line 871:

# change custom.bat/sh
if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}")
  file (READ "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT)

  set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}")

  file (WRITE "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") <<< 871
else()
  OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "custom.${SCRIPT_EXT}" "${INSTALL_DIR_SCRIPT}")
endif()

As far as I can see, it will be called only if custom.sh already exists at install location - e.g. you have been installed OCCT (by make install or something else), is it correct?
For me, on a fresh system there is no such file, so I don't see this problem.
There will be also no problem if you will specify another INSTALL location, available to user.

Of course, modifying files at INSTALL location during configure is a bad approach and should be fixed anyway (although I have some ideas why this was done in this way).
Also, custom.sh is designed to simplify using OCCT from non-standard INSTALL location; installing this file into /usr/local/bin/ does not look nice at all...

Fill free reporting an issue on Bugtracker (and provide patches, if you can):
https://dev.opencascade.org/index.php?q=home/get_involved