Python problem when compiling lldb

Hi,

I'm still working on getting a clean compile on Scientific Linux 7.1. So
for I've gotten a compile (after applying Pull Request #282) when for the
basic build script with no additional flags (./swift/utils/build-script).

I'm now trying to also compile with lldb (./swift/utils/build-script
--lldb). When I do so I get the following error:

-- Build files have been written to:

/home/lanes/swift/build/Ninja-DebugAssert/lldb-linux-x86_64
++ cmake_config_opt lldb
++ product=lldb
++ [[ Ninja == \X\c\o\d\e ]]
+ /home/lanes/cmake-3.4.1-Linux-x86_64.binary_distribution/bin/cmake
--build /home/lanes/swift/build/Ninja-DebugAssert/lldb-linux-x86_64 -- all
[10/845] Building CXX object
scripts/Python/modules/readline/CMakeFiles/readline.dir/readline.cpp.o
FAILED: /usr/bin/clang++ -DHAVE_PROCESS_VM_READV -DHAVE_ROUND
-DLIBXML2_DEFINED -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -Dreadline_EXPORTS -Iscripts/Python/modules/readline
-I/home/lanes/swift/lldb/scripts/Python/modules/readline
-I/home/lanes/swift/lldb/include -Iinclude
-I/home/lanes/swift/build/Ninja-DebugAssert/llvm-linux-x86_64/include
-I/home/lanes/swift/build/Ninja-DebugAssert/llvm-linux-x86_64/tools/clang/include
-I/home/lanes/swift/llvm/include
-I/home/lanes/swift/llvm/tools/clang/include
-I/home/lanes/swift/build/Ninja-DebugAssert/swift-linux-x86_64/include
-I/home/lanes/swift/swift/include -I/home/lanes/swift/lldb/source
-I/usr/local/include/python3.4m
-I/home/lanes/swift/lldb/tools/clang/include -I../clang/include
-I/usr/include/libxml2 -std=c++11 -fcolor-diagnostics
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing
-Wno-deprecated-register -Wno-vla-extension -fno-exceptions -fno-rtti -g
-fPIC -MMD -MT
scripts/Python/modules/readline/CMakeFiles/readline.dir/readline.cpp.o -MF
scripts/Python/modules/readline/CMakeFiles/readline.dir/readline.cpp.o.d -o
scripts/Python/modules/readline/CMakeFiles/readline.dir/readline.cpp.o -c
/home/lanes/swift/lldb/scripts/Python/modules/readline/readline.cpp
/home/lanes/swift/lldb/scripts/Python/modules/readline/readline.cpp:68:34:
error: assigning to 'char *(*)(FILE *, FILE *, const char *)' from
incompatible type 'char *(FILE *, FILE *, char *)': type mismatch at 3rd
parameter ('const char *' vs 'char *')
    PyOS_ReadlineFunctionPointer = simple_readline;
                                 ^ ~~~~~~~~~~~~~~~
/home/lanes/swift/lldb/scripts/Python/modules/readline/readline.cpp:70:5:
error: use of undeclared identifier 'Py_InitModule4'
    Py_InitModule4(
    ^
2 errors generated.

I've installed the python-devel, python27-python-devel, and
python33-python-devel packages, as well as swig.

The readline.cpp file where the error occurs imports Python.h. The header
file Python.h exists at /usr/include/python2.7/Python.h, and it includes
modsupport.h (/usr/include/python2.7/modsupport.h) which appears to define
Py_InitModule4.

Any thoughts or assistance would be appreciated.

Thanks,
Lane

See: [SR-14] Wrong python version selected when building swift-lldb · Issue #4417 · apple/llvm-project · GitHub

···

On 2015.12.10 at 09:29 -0600, Lane Schwartz via swift-users wrote:

I'm still working on getting a clean compile on Scientific Linux 7.1. So
for I've gotten a compile (after applying Pull Request #282) when for the
basic build script with no additional flags (./swift/utils/build-script).

I'm now trying to also compile with lldb (./swift/utils/build-script
--lldb). When I do so I get the following error:
> PyOS_ReadlineFunctionPointer = simple_readline;
> ^ ~~~~~~~~~~~~~~~
> /home/lanes/swift/lldb/scripts/Python/modules/readline/readline.cpp:70:5:
> error: use of undeclared identifier 'Py_InitModule4'
> Py_InitModule4(
> ^

--
Markus

Thanks, Markus. I'll keep tabs on that bug as well.

···

On Thu, Dec 10, 2015 at 9:32 AM, Markus Trippelsdorf <markus@trippelsdorf.de > wrote:

On 2015.12.10 at 09:29 -0600, Lane Schwartz via swift-users wrote:
> I'm still working on getting a clean compile on Scientific Linux 7.1. So
> for I've gotten a compile (after applying Pull Request #282) when for the
> basic build script with no additional flags (./swift/utils/build-script).
>
> I'm now trying to also compile with lldb (./swift/utils/build-script
> --lldb). When I do so I get the following error:
> > PyOS_ReadlineFunctionPointer = simple_readline;
> > ^ ~~~~~~~~~~~~~~~
> >
/home/lanes/swift/lldb/scripts/Python/modules/readline/readline.cpp:70:5:
> > error: use of undeclared identifier 'Py_InitModule4'
> > Py_InitModule4(
> > ^

See: [SR-14] Wrong python version selected when building swift-lldb · Issue #4417 · apple/llvm-project · GitHub

--
Markus

--
When a place gets crowded enough to require ID's, social collapse is not
far away. It is time to go elsewhere. The best thing about space travel
is that it made it possible to go elsewhere.
                -- R.A. Heinlein, "Time Enough For Love"