[CMake] Compiling python with CMake

shlomi shlomi at hexadite.com
Thu Nov 27 04:00:41 EST 2014


Hello,
I am trying to compile python 2.7.x with CMake using gcc
I am actually wrapping the original project with cmake.

my project already work on windows machine using VS2013

at the moment my code looks like this:

#include "Python.h"

int main(int argc, char* argv[])
{
	return 1;
}

very simple.

I have issues with the CRT include files. I can't find the proper includes.

my CMakeLists.txt looks like this:

PROJECT(lib C )
cmake_minimum_required(VERSION 2.8)

SET_TARGET_PROPERTIES(my_lib PROPERTIES LINKER_LANGUAGE C)
set_source_files_properties(main.c PROPERTIES LANGUAGE C )

include_directories("/usr/lib/gcc/x86_64-linux-gnu/4.8/include")
include_directories("Include") # python source
include_directories("PC") # python source
include_directories("/usr/include")
include_directories("/usr/include/linux")
include_directories("/usr/include/x86_64-linux-gnu/sys")

I get many error, at they are from improper definitions.

the errors now are:
In file included from /usr/include/stdio.h:74,
                 from
/home/shlomi/git/AIRS/src/airs/actions_providers/agent/hosting_process/tmp/src/PC/pyconfig.h:296,
                 from
/home/shlomi/git/AIRS/src/airs/actions_providers/agent/hosting_process/tmp/src/Include/Python.h:8,
                 from
/home/shlomi/git/AIRS/src/airs/actions_providers/agent/hosting_process/tmp/main.c:1:
/usr/include/libio.h:306: error: expected specifier-qualifier-list before
‘size_t’
/usr/include/libio.h:338: error: expected declaration specifiers or ‘...’
before ‘size_t’
 

following this:
https://gcc.gnu.org/gcc-4.6/porting_to.html

I changed my gcc from 4.8 to 4.4.

so this:
error: 'size_t' has not been declared
changed to this:
error: expected declaration specifiers or ‘...’ before ‘size_t’

my question is:
what is the right setup for compiling python 2.7.x with cmake on linux using
gcc?

I would really appreciate assistance.



--
View this message in context: http://cmake.3232098.n2.nabble.com/Compiling-python-with-CMake-tp7589097.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list