[issue35953] crosscompilation fails with clang on android

2019-02-10 Thread muhzi


Change by muhzi :


--
components: Cross-Build
nosy: Alex.Willmer, muhzi
priority: normal
severity: normal
status: open
title: crosscompilation fails with clang on android
type: compile error
versions: Python 2.7

___
Python tracker 
<https://bugs.python.org/issue35953>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35953] crosscompilation fails with clang on android

2019-02-10 Thread muhzi


New submission from muhzi :

Trying to cross compile python for android using NDK r19. but I keep facing a 
linker error.

x86_64-linux-android21-clang -pie 
-L~/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64/usr/lib64 -Xlinker 
-export-dynamic -o python \
Modules/python.o \
-L. -lpython2.7 -ldl-lm  
./libpython2.7.so: error: undefined reference to 'nl_langinfo'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

--

___
Python tracker 
<https://bugs.python.org/issue35953>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35997] ImportError: dlopen failed: cannot locate symbol "PyBool_Type"

2019-02-14 Thread muhzi


New submission from muhzi :

I cross compiled python for android x86_64, and the interpreter works fine, no 
problems. But when I compiled some other extension and try to import it. I get 
an import error as such the imported shared library fails to locate the symbol 
"PyBool_Type".

ImportError: dlopen failed: cannot locate symbol "PyBool_Type" referenced by 


The extension was compiled with -I && -L flags pointing to the Python 
installation include and lib folders.

--
components: Cross-Build, Regular Expressions
messages: 335560
nosy: Alex.Willmer, ezio.melotti, mrabarnett, muhzi, xdegaye
priority: normal
severity: normal
status: open
title: ImportError: dlopen failed: cannot locate symbol "PyBool_Type"
type: behavior
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue35997>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35997] ImportError: dlopen failed: cannot locate symbol "PyBool_Type"

2019-02-14 Thread muhzi


muhzi  added the comment:

Yes, the symbols are there.
And here is how I cross compiled Python:

export CC="${ANDROID_TARGET}${ANDROID_API}-clang"
export CXX="$CC++"

# environment variables for binary utils..
export AR="$BIN_UTILS_PREFIX-ar"
export LD="$BIN_UTILS_PREFIX-ld"
export AS="$BIN_UTILS_PREFIX-as"
export STRIP="$BIN_UTILS_PREFIX-strip"
export RANLIB="$BIN_UTILS_PREFIX-ranlib"
export READELF="$BIN_UTILS_PREFIX-readelf"

# compiler and linker flags
export CFLAGS="-fPIE -fPIC"
export LDFLAGS="-fuse-ld=lld -Wl,--rpath=../lib"

export CONFIG_SITE="config.site"

CONFIG_BUILD="$(uname -m)-linux-gnu"
CONFIG_ARGS="--enable-shared --disable-ipv6"
CONFIG_PREFIX="$PYTHON_PATH/output/$ARCH-android"

$PYTHON_PATH/configure --host=$ANDROID_TARGET --build=$CONFIG_BUILD 
--prefix=$CONFIG_PREFIX $CONFIG_ARGS
make -C $PYTHON_PATH
make -C $PYTHON_PATH install

--

___
Python tracker 
<https://bugs.python.org/issue35997>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35997] ImportError: dlopen failed: cannot locate symbol "PyBool_Type"

2019-02-14 Thread muhzi


muhzi  added the comment:

OK, I uploaded it. I give the path for NDK then it determines those values for 
the target architecture, in my case I use it for x86_64.

--
Added file: https://bugs.python.org/file48139/xcompile-py3.sh

___
Python tracker 
<https://bugs.python.org/issue35997>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35997] ImportError: dlopen failed: cannot locate symbol "PyBool_Type"

2019-02-14 Thread muhzi


Change by muhzi :


Removed file: https://bugs.python.org/file48139/xcompile-py3.sh

___
Python tracker 
<https://bugs.python.org/issue35997>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35997] ImportError: dlopen failed: cannot locate symbol "PyBool_Type"

2019-02-14 Thread muhzi


Change by muhzi :


Added file: https://bugs.python.org/file48140/xcompile-py3.sh

___
Python tracker 
<https://bugs.python.org/issue35997>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35997] ImportError: dlopen failed: cannot locate symbol "PyBool_Type"

2019-02-15 Thread muhzi


muhzi  added the comment:

Ah! I used the option -Bsymbolic while linking the extension to make it work 
and it did, but I figure it is not ideal. I will be checking that patch!

--
components: +Extension Modules -Regular Expressions

___
Python tracker 
<https://bugs.python.org/issue35997>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-27 Thread muhzi


New submission from muhzi :

I am facing a problem while trying to compile Python for android armv7a using 
the latest NDK version (clang). The configure script fails to find pthread 
library, which should be bundled in libc. Here is the full configure output:


Building for armv7a-linux-androideabi
configure: loading site script ./config.site
checking build system type... x86_64-pc-linux-gnu
checking host system type... armv7a-unknown-linux-androideabi
checking for python3.7... python3.7
checking for python interpreter for cross build... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for armv7a-linux-androideabi-gcc... armv7a-linux-androideabi16-clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether armv7a-linux-androideabi16-clang accepts -g... yes
checking for armv7a-linux-androideabi16-clang option to accept ISO C89... none 
needed
checking how to run the C preprocessor... armv7a-linux-androideabi16-clang -E
checking for grep that handles long lines and -e... /bin/grep
checking for a sed that does not truncate output... /bin/sed
checking for --with-cxx-main=... no
checking for the platform triplet based on compiler characteristics... none
checking for -Wl,--no-as-needed... yes
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for the Android API level... 16
checking for the Android arm ABI... 7
checking for --with-suffix... 
checking for case-insensitive build directory... no
checking LIBRARY... libpython$(VERSION)$(ABIFLAGS).a
checking LINKCC... $(PURIFY) $(MAINCC)
checking for GNU ld... yes
checking for --enable-shared... yes
checking for --enable-profiling... no
checking LDLIBRARY... libpython$(LDVERSION).so
checking for armv7a-linux-androideabi-ar... arm-linux-androideabi-ar
checking for armv7a-linux-androideabi-readelf... arm-linux-androideabi-readelf
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for --with-pydebug... no
checking for --with-assertions... no
checking for --enable-optimizations... no
checking for --with-lto... no
checking for -llvm-profdata... no
checking for -Wextra... yes
checking whether armv7a-linux-androideabi16-clang accepts and needs 
-fno-strict-aliasing... no
checking if we can turn off armv7a-linux-androideabi16-clang unused result 
warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang unused parameter 
warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang missing field 
initializers warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang invalid function 
cast warning... no
checking if we can turn on armv7a-linux-androideabi16-clang mixed sign 
comparison warning... yes
checking if we can turn on armv7a-linux-androideabi16-clang unreachable code 
warning... yes
checking if we can turn on armv7a-linux-androideabi16-clang strict-prototypes 
warning... yes
checking if we can make implicit function declaration an error in 
armv7a-linux-androideabi16-clang... yes
checking whether pthreads are available without options... no
checking whether armv7a-linux-androideabi16-clang accepts -Kpthread... no
checking whether armv7a-linux-androideabi16-clang accepts -Kthread... no
checking whether armv7a-linux-androideabi16-clang accepts -pthread... no
checking whether armv7a-linux-androideabi16-clang++ also accepts flags for 
thread support... no
checking for ANSI C header files... (cached) yes
checking asm/types.h usability... yes
checking asm/types.h presence... yes
checking for asm/types.h... yes
checking crypt.h usability... no
checking crypt.h presence... no
checking for crypt.h... no
checking conio.h usability... no
checking conio.h presence... no
checking for conio.h... no
checking direct.h usability... no
checking direct.h presence... no
checking for direct.h... no
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking grp.h usability... yes
checking

[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-27 Thread muhzi


Change by muhzi :


--
components: +Cross-Build
nosy: +Alex.Willmer

___
Python tracker 
<https://bugs.python.org/issue36141>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-27 Thread muhzi


Change by muhzi :


--
type:  -> compile error

___
Python tracker 
<https://bugs.python.org/issue36141>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-28 Thread muhzi


muhzi  added the comment:

Well, it solves the problem with the configure script. 

My pyconfig.h.in contains:

/* Define to 1 if you have the  header file. */
#undef HAVE_PTHREAD_H

/* Define to 1 if you have the `pthread_init' function. */
#undef HAVE_PTHREAD_INIT

/* Define to 1 if you have the `pthread_kill' function. */
#undef HAVE_PTHREAD_KILL

/* Define to 1 if you have the `pthread_sigmask' function. */
#undef HAVE_PTHREAD_SIGMASK

The problem extends after the configuration. It's as if the android headers are 
not visible to configure. All the macros are undefined in the pyconfig file too 
btw.

--

___
Python tracker 
<https://bugs.python.org/issue36141>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-28 Thread muhzi


muhzi  added the comment:

OK! NDK version is 19.1.5304403

Cool, so I uploaded the output of configure (attachments)

Sorry for the confusion about pyconfig.h, what I was trying to say is after 
providing ac_cv_pthread_is_default=yes to configure I get errors in make:

Python/pytime.c:911:9: error: implicit declaration of function 
'pytime_fromtimespec' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
if (pytime_fromtimespec(tp, &ts, raise) < 0) {
^
Python/pytime.c:911:9: note: did you mean 'pytime_fromtimeval'?
Python/pytime.c:336:1: note: 'pytime_fromtimeval' declared here
pytime_fromtimeval(_PyTime_t *tp, struct timeval *tv, int raise)
^
Python/pytime.c:911:9: warning: this function declaration is not a prototype 
[-Wstrict-prototypes]
if (pytime_fromtimespec(tp, &ts, raise) < 0) {
^

--
Added file: https://bugs.python.org/file48176/config.log

___
Python tracker 
<https://bugs.python.org/issue36141>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36145] android arm cross compilation fails, h

2019-02-28 Thread muhzi


New submission from muhzi :

This is a follow up of #36141, I'm trying to build python for android armv7a.
The problem was the configure script fails to find pthread_create in the 
android headers. Now after getting past the configuration, I get a build error:

armv7a-linux-androideabi16-clang -c -mfloat-abi=softfp -mfpu=vfpv3-d16 
-Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 
-Wall-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Wstrict-prototypes 
-Werror=implicit-function-declaration   -I. -I./Include-DPy_BUILD_CORE -o 
Python/pytime.o Python/pytime.c
Python/pytime.c:911:9: error: implicit declaration of function 
'pytime_fromtimespec' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
if (pytime_fromtimespec(tp, &ts, raise) < 0) {
^
Python/pytime.c:911:9: note: did you mean 'pytime_fromtimeval'?
Python/pytime.c:336:1: note: 'pytime_fromtimeval' declared here
pytime_fromtimeval(_PyTime_t *tp, struct timeval *tv, int raise)
^
Python/pytime.c:911:9: warning: this function declaration is not a prototype 
[-Wstrict-prototypes]
if (pytime_fromtimespec(tp, &ts, raise) < 0) {
^

The declaration for pytime_fromtimespec needs the token HAVE_CLOCK_GETTIME to 
be defined to 1, which isn't the case (as per pyconfig.h). I checked the 
android headers and time.h seems to have the necessary function for this token. 

I uploaded pyconfig.h for reference (attached).

--
components: Cross-Build
files: pyconfig.h
messages: 336828
nosy: Alex.Willmer, muhzi, xdegaye
priority: normal
severity: normal
status: open
title: android arm cross compilation fails, h
type: compile error
versions: Python 3.7
Added file: https://bugs.python.org/file48178/pyconfig.h

___
Python tracker 
<https://bugs.python.org/issue36145>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36145] android arm cross compilation fails, config issue

2019-02-28 Thread muhzi


Change by muhzi :


--
title: android arm cross compilation fails, h -> android arm cross compilation 
fails, config issue

___
Python tracker 
<https://bugs.python.org/issue36145>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36145] android arm cross compilation fails, config issue

2019-02-28 Thread muhzi


muhzi  added the comment:

Yes, pretty much so, which I think was what caused the pthread problem. Why 
would it fail to find the headers?

--

___
Python tracker 
<https://bugs.python.org/issue36145>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36162] error: implicit declaration of function 'sendfile' is invalid in C99

2019-03-01 Thread muhzi


New submission from muhzi :

I encountered yet another issue with cross compilation on android, it so 
happens that these errors occur only when I cross compile for non 64-bit archs. 
i.e. I could cross compile just fine for arm64 & x86_64 but the 32-bit version 
of these archs produces the following error during compilation:

./Modules/posixmodule.c:8457:19: error: implicit declaration of function 
'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = sendfile(out, in, NULL, count);
  ^
./Modules/posixmodule.c:8457:19: warning: this function declaration is not a 
prototype [-Wstrict-prototypes]
./Modules/posixmodule.c:8470:15: error: implicit declaration of function 
'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = sendfile(out, in, &offset, count);
  ^
./Modules/posixmodule.c:9057:14: error: implicit declaration of function 
'truncate' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
result = truncate(path->narrow, length);
 ^
./Modules/posixmodule.c:9057:14: note: did you mean 'ftruncate'?
/home/muhzi/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/unistd.h:220:5:
 note: 'ftruncate' declared here
int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64) 
__INTRODUCED_IN(12);
^
./Modules/posixmodule.c:9057:14: warning: this function declaration is not a 
prototype [-Wstrict-prototypes]
result = truncate(path->narrow, length);


I attached pyconfig.h for reference, it seems that the configuration step went 
fine. I checked that these missing functions are able to have their 
corresponding headers included. Also figured after misplacing some include 
lines in posixmodule.c that when the preprocessor includes Python.h it fails to 
include definitions from successively included headers.

--
components: Cross-Build
files: pyconfig.h
messages: 336958
nosy: Alex.Willmer, muhzi, xdegaye
priority: normal
severity: normal
status: open
title: error: implicit declaration of function 'sendfile' is invalid in C99
versions: Python 3.7
Added file: https://bugs.python.org/file48183/pyconfig.h

___
Python tracker 
<https://bugs.python.org/issue36162>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36162] error: implicit declaration of function 'sendfile' is invalid in C99

2019-03-01 Thread muhzi


muhzi  added the comment:

Using the latest NDK r19. Here is my compilation steps for arm:

export PATH="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH"
export CC="armv7a-linux-androideabi16-clang"
export CXX="$CC++"

export AR="arm-linux-androideabi-ar"
export LD="arm-linux-androideabi-ld"
export AS="arm-linux-androideabi-as"
export STRIP="arm-linux-androideabi-strip"
export RANLIB="arm-linux-androideabi-ranlib"
export READELF="arm-linux-androideabi-readelf"

export CFLAGS=""
export CXXFLAGS=$CFLAGS
export LDFLAGS="-pie"

export CONFIG_SITE="config.site"

./configure --host=armv7a-linux-androideabi --build=x86_64-linux-gnu 
--disable-ipv6
make
make altinstall DESTDIR=$INSTALL_DIR

--

___
Python tracker 
<https://bugs.python.org/issue36162>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36162] error: implicit declaration of function 'sendfile' is invalid in C99

2019-03-01 Thread muhzi


muhzi  added the comment:

After some testing, it works and builds extensions OK for android arm with 
API>=21. fails on lower API versions (e.g. 16).

--

___
Python tracker 
<https://bugs.python.org/issue36162>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36162] error: implicit declaration of function 'sendfile' is invalid in C99

2019-03-02 Thread muhzi


muhzi  added the comment:

Yes it is detected by configure because they exist.

>From config.log:

configure:11514: checking for truncate
configure:11514: armv7a-linux-androideabi21-clang -o conftest   -pie 
-march=armv7-a -Wl,--fix-cortex-a8 conftest.c -ldl  >&5
configure:11514: $? = 0
configure:11514: result: yes


I can include the corresponding headers in a separate test file and call these 
missing methods and I get no compilation errors. But it seems they don't work 
in posixmodule.c and for some reason when #include  is put 
before #include "Python.h", the compiler doesn't give errors for those 
particular functions. I'm guessing this is an API level < 21 issue, it might 
have propagated from the configuration step (if any faults) but not sure. I use 
the same steps to compile this for API level 21 with no errors.

--

___
Python tracker 
<https://bugs.python.org/issue36162>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36162] error: implicit declaration of function 'sendfile' is invalid in C99

2019-03-02 Thread muhzi


muhzi  added the comment:

err, wrong logs sorry... 

configure:11514: checking for truncate
configure:11514: armv7a-linux-androideabi16-clang -o conftest   -pie 
-march=armv7-a -Wl,--fix-cortex-a8 conftest.c -ldl  >&5
configure:11514: $? = 0
configure:11514: result: yes


configure:7954: checking sys/sendfile.h usability
configure:7954: armv7a-linux-androideabi16-clang -c   conftest.c >&5
configure:7954: $? = 0
configure:7954: result: yes
configure:7954: checking sys/sendfile.h presence
configure:7954: armv7a-linux-androideabi16-clang -E  conftest.c
configure:7954: $? = 0
configure:7954: result: yes
configure:7954: checking for sys/sendfile.h
configure:7954: result: yes

--

___
Python tracker 
<https://bugs.python.org/issue36162>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36162] error: implicit declaration of function 'sendfile' is invalid in C99

2019-03-06 Thread muhzi


muhzi  added the comment:

Yeah, makes sense

--

___
Python tracker 
<https://bugs.python.org/issue36162>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com