Bug #101923 Compiling without Python support fails
Submitted: 9 Dec 2020 8:54 Modified: 31 Aug 2022 16:36
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Shell General / Core Client Severity:S3 (Non-critical)
Version:8.0.22 OS:Any
Assigned to: CPU Architecture:Any

[9 Dec 2020 8:54] Daniël van Eeden
Description:
$ mkdir bld
$ cd bld
$ cmake .. -DMYSQL_SOURCE_DIR=/home/dvaneeden/dev/mysql-server -DMYSQL_BUILD_DIR=/home/dvaneeden/dev/mysql-server/bld -DPACKAGE_YEAR=2020
...
CMake Warning at CMakeLists.txt:336 (message):
  Python is unavailable: building without Python support.
...
$ make
...
[ 44%] Building CXX object mysqlshdk/libs/oci/CMakeFiles/oci.dir/oci.cc.o
In file included from /home/dvaneeden/dev/mysql-shell/mysqlshdk/include/scripting/python_context.h:29,
                 from /home/dvaneeden/dev/mysql-shell/mysqlshdk/libs/oci/oci.cc:28:
/home/dvaneeden/dev/mysql-shell/mysqlshdk/include/scripting/python_utils.h:39:10: fatal error: Python.h: No such file or directory
   39 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.
make[2]: *** [mysqlshdk/libs/oci/CMakeFiles/oci.dir/build.make:134: mysqlshdk/libs/oci/CMakeFiles/oci.dir/oci.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:797: mysqlshdk/libs/oci/CMakeFiles/oci.dir/all] Error 2
make: *** [Makefile:171: all] Error 2

How to repeat:
Compile without setting `-DHAVE_PYTHON=1`

Suggested fix:
Python.h should not be used if compiling without Python support.

If things like OCI can't work without Python support they should be disabled if there is no Python support and/or cmake should report this as failure to configure
[10 Dec 2020 8:11] MySQL Verification Team
Hello Daniël,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[31 Aug 2022 16:36] Edward Gilmore
Posted by developer:
 
Added the following to the MySQL Shell 8.0.27 release notes:
Compiling without Python support resulted in a fatal error. This
        was caused by Python test files included in the compilation
        process.