Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake generation fails when cmakepp.cmake is placed in a read-only directory #97

Open
15knots opened this issue Mar 13, 2015 · 9 comments
Milestone

Comments

@15knots
Copy link

15knots commented Mar 13, 2015

I installed cmakepp in the cmake modules dir /usr/share/cmake/Modules/, using the rpm under linux.
That directory does not allow write access to normal users.
drwxr-xr-x 9 root root 15016 12. Mär 21:51 /usr/share/cmake/Modules/

If I add the line
include(cmakepp)
to my CMakeLists.txt, cmake properly finds cmakepp.

But I get lots errors when I let cmake generate the build scripts:

CMake Error at /usr/share/cmake/Modules/cmakepp.cmake:16892 (file):
file Internal CMake error when trying to open file:
/usr/share/cmake/Modules/tmp/file_make_temporary_LjZKhAz1k3.tmp for
writing.
Call Stack (most recent call first):
/usr/share/cmake/Modules/cmakepp.cmake:5441 (file_make_temporary)
/usr/share/cmake/Modules/cmakepp.cmake:15617 (eval)
/usr/share/cmake/Modules/cmakepp.cmake:14673 (string_semicolon_decode)
/usr/share/cmake/Modules/cmakepp.cmake:21917 (structured_list_parse)
/usr/share/cmake/Modules/cmakepp.cmake:33436 (config_setup)
CMakeLists.txt:35 (include)

Just for the records, not a showstopper for me.

@toeb
Copy link
Owner

toeb commented Mar 13, 2015

Ok - actually behaves "correctly".
The problem is that cmakepp needs a temp folder were it can put generated files. In the root cmakepp.cmake file there is a section which tries to find a suitable temp directory. I do not know of the linux equivalent to the windows TMP environment variable so I just use a subdirectory at the current location

# get temp dir which is needed by a couple of functions in cmakepp
set(cmakepp_tmp_dir "$ENV{TMP}")
if(NOT cmakepp_tmp_dir)
    set(cmakepp_tmp_dir "${CMAKE_CURRENT_LIST_DIR}/tmp")
endif()
file(TO_CMAKE_PATH "${cmakepp_tmp_dir}" cmakepp_tmp_dir)

@15knots
Copy link
Author

15knots commented Mar 13, 2015

TMPDIR=/tmp
Edit: Sorry, this might be misleading. The env-var name to get is TMPDIR.

But no per-user temp dir as on windos.

But isn´t there a cmake variable/property for temp dir already?

Edit Asked on [email protected], waiting for answer

@15knots
Copy link
Author

15knots commented Mar 13, 2015

Answered on [email protected]:

Why not go with somewhere in the build directory?
It is already full of temporary build artifacts.

@toeb
Copy link
Owner

toeb commented Mar 14, 2015

That will not work because cmakepp is often executed in script mode. In script mode the CMAKE_BINARY_DIR is the pwd. that means whenever you start cmakepp it will create a temp folder at that location.

Another reason to not put it in the binary dir is because cmakepp caches results heavily andif the temp dir changes the results would have to be regenerated which takes quite a while.

Therefore the solution has to be a global directory which is the same for every cmakepp instance. (except if configured otherwise)

is TMPDIR define on all unix platforms?

@15knots
Copy link
Author

15knots commented Mar 14, 2015

is TMPDIR define on all unix platforms?

According to http://en.wikipedia.org/wiki/TMPDIR I would say: yes.
If not, you could use /tmp which is defined by the Filesystem Hierarchy Standard on Linux

@toeb
Copy link
Owner

toeb commented Mar 16, 2015

I added a better strategy for deriving the tmp dir . first try to use TMP then try to use TMPDIR, then use the <cmakepp dir>/tmp I will close this issue as soon as I merge back into master (might take a while)

toeb added a commit that referenced this issue Mar 16, 2015
@toeb toeb closed this as completed in 92ccc32 Mar 18, 2015
@15knots
Copy link
Author

15knots commented Mar 19, 2015

Please re-open.
v 0.1.0-alpha gives

CMake Error at /usr/share/cmake/Modules/cmakepp.cmake:24868 (file):
file Internal CMake error when trying to open file:
/usr/share/cmake/Modules/tmp/fwrite_temp.cmake for writing.
Call Stack (most recent call first):
/usr/share/cmake/Modules/cmakepp.cmake:26377 (fwrite)
/usr/share/cmake/Modules/cmakepp.cmake:11050 (fwrite_temp)
/usr/share/cmake/Modules/cmakepp.cmake:29616 (eval)
/usr/share/cmake/Modules/cmakepp.cmake:18929 (string_decode_semicolon)
/usr/share/cmake/Modules/cmakepp.cmake:18742 (structured_list_parse)
/usr/share/cmake/Modules/cmakepp.cmake:39343 (config_setup)
CMakeLists.txt:35 (include)

@toeb toeb reopened this Mar 19, 2015
@toeb
Copy link
Owner

toeb commented Mar 19, 2015

The next release will have the fix. Do you want me to amend the v0.1.0 alpha version or rather wait for a new release?

@15knots
Copy link
Author

15knots commented Mar 19, 2015

Am Donnerstag, 19. M�rz 2015, 13:58:20 schrieb Tobias Becker:

The next release will have the fix. Do you want me to amend the v0.1.0
alpha version or rather wait for a new release?

I'll wait for the next release. Having rpms for cmakepp currently is a
benefit, not a must.

I opted to re-enable building the the docs run all tests while packaging,
instead of creating issues in cmakepp.
Sadly, both fail, so currently there are no rpms for cmakepp.
You may find a current packaging log at (for example)
https://build.opensuse.org/package/live_build_log/home:15knots/cmakepp/SLE_12/x86_64
which could tell you about packaging/build problems.

To trigger a package build upon the next release, I see three options:

  1. PM me on each release.
  2. re-open one of the issues I'm watching.
  3. Let github trigger the packaging on each commit
    http://openbuildservice.org/2013/11/22/Source-Update-Via_Token/

If you choose otion 2, please send me a personal email, so I can create & sent
you the token. (I won't post it here for security reasons)

Overall packaging status can be viewed at
https://build.opensuse.org/package/show/home:15knots/cmakepp

Cd wrttn wtht vwls s mch trsr.

@toeb toeb modified the milestone: Stable Feb 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants