sol2 icon indicating copy to clipboard operation
sol2 copied to clipboard

Unable to build `Sol2 single` (on linux at least)

Open ipochto opened this issue 7 months ago • 0 comments

#Fixed with https://github.com/ThePhD/sol2/pull/1683

Unable to build Sol2 single (on linux at least) because of reference to wrong variable of python interpreter.

According to cmake documentation FindPython3 module which called by:

find_package (Python3 ...)

sets Python3_EXECUTABLE instead of PYTHON_EXECUTABLE.

Thus, since the PYTHON_EXECUTABLE variable is not set, an attempt is made to run the single.py script directly, without the interpreter here:

add_custom_command(
	COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include/sol"
	COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/single.py" --input "${CMAKE_CURRENT_SOURCE_DIR}/../include" --output "${CMAKE_CURRENT_BINARY_DIR}/include/sol/sol.hpp"
	DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/single.py" "${sol2_generated_header_sources}"
	OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/sol/sol.hpp" "${CMAKE_CURRENT_BINARY_DIR}/include/sol/forward.hpp" "${CMAKE_CURRENT_BINARY_DIR}/include/sol/config.hpp")

and since it has no permission to run, the script does not run.

*chmod +x single.py can fix the issue.

ipochto avatar Apr 12 '25 16:04 ipochto