Question

I am working on building zope2 with python for Android, however I end up with the below error:

Leaving ARM enviromnent
Skipped build_python
Skipped build_pil
Entering in ARM enviromnent
Compiler found at /home/zachary/android-ndk-r8c/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin//arm-linux-androideabi-gcc
Biglink create /home/zachary/python-for-android/build/libs/libpymodules.so library
Biglink arguments:
 /home/zachary/python-for-android/build/objects/_arraysurfarray.so.o
 /home/zachary/python-for-android/build/objects/c_opengl_debug.so.o
 /home/zachary/python-for-android/build/objects/_MethodObject.so.o
 /home/zachary/python-for-android/build/objects/_android_sound.so.o
 /home/zachary/python-for-android/build/objects/key.so.o
 /home/zachary/python-for-android/build/objects/pixelarray.so.o
 /home/zachary/python-for-android/build/objects/shader.so.o
 /home/zachary/python-for-android/build/objects/buffer.so.o
 /home/zachary/python-for-android/build/objects/cPickleCache.so.o
 /home/zachary/python-for-android/build/objects/stencil_instructions.so.o
 /home/zachary/python-for-android/build/objects/draw.so.o
 /home/zachary/python-for-android/build/objects/instructions.so.o
 /home/zachary/python-for-android/build/objects/TimeStamp.so.o
 /home/zachary/python-for-android/build/objects/gfxdraw.so.o
 /home/zachary/python-for-android/build/objects/fbo.so.o
 /home/zachary/python-for-android/build/objects/_android.so.o
 /home/zachary/python-for-android/build/objects/opengl_utils.so.o
 /home/zachary/python-for-android/build/objects/_event.so.o
 /home/zachary/python-for-android/build/objects/transformation.so.o
 /home/zachary/python-for-android/build/objects/_proxy.so.o
 /home/zachary/python-for-android/build/objects/surface.so.o
 /home/zachary/python-for-android/build/objects/_IOBTree.so.o
 /home/zachary/python-for-android/build/objects/display.so.o
 /home/zachary/python-for-android/build/objects/_initgroups.so.o
 /home/zachary/python-for-android/build/objects/_LOBTree.so.o
 /home/zachary/python-for-android/build/objects/transform.so.o
 /home/zachary/python-for-android/build/objects/_imagingmath.so.o
 /home/zachary/python-for-android/build/objects/_Record.so.o
 /home/zachary/python-for-android/build/objects/_IIBTree.so.o
 /home/zachary/python-for-android/build/objects/vertex.so.o
 /home/zachary/python-for-android/build/objects/gl_instructions.so.o
 /home/zachary/python-for-android/build/objects/_zope_interface_coptimizations.so.o
 /home/zachary/python-for-android/build/objects/opengl.so.o
 /home/zachary/python-for-android/build/objects/_ExtensionClass.so.o
 /home/zachary/python-for-android/build/objects/properties.so.o
 /home/zachary/python-for-android/build/objects/_Persistence.so.o
 /home/zachary/python-for-android/build/objects/surflock.so.o
 /home/zachary/python-for-android/build/objects/texture.so.o
 /home/zachary/python-for-android/build/objects/_zope_security_checker.so.o
 /home/zachary/python-for-android/build/objects/joystick.so.o
 /home/zachary/python-for-android/build/objects/_OIBTree.so.o
 /home/zachary/python-for-android/build/objects/_LLBTree.so.o
 /home/zachary/python-for-android/build/objects/_zope_i18nmessageid_message.so.o
 /home/zachary/python-for-android/build/objects/context_instructions.so.o
 /home/zachary/python-for-android/build/objects/_IFBTree.so.o
 /home/zachary/python-for-android/build/objects/_fsBTree.so.o
 /home/zachary/python-for-android/build/objects/_MultiMapping.so.o
 /home/zachary/python-for-android/build/objects/font.so.o
 -lsdl_ttf
 /home/zachary/python-for-android/build/objects/base.so.o
 /home/zachary/python-for-android/build/objects/_OOBTree.so.o
 /home/zachary/python-for-android/build/objects/vbo.so.o
 /home/zachary/python-for-android/build/objects/event.so.o
 /home/zachary/python-for-android/build/objects/_ComputedAttribute.so.o
 /home/zachary/python-for-android/build/objects/imageext.so.o
 -lsdl_image
 -lpng
 /home/zachary/python-for-android/build/objects/cdrom.so.o
 /home/zachary/python-for-android/build/objects/_zope_container_contained.so.o
 /home/zachary/python-for-android/build/objects/color.so.o
 /home/zachary/python-for-android/build/objects/_android_billing.so.o
 /home/zachary/python-for-android/build/objects/constants.so.o
 /home/zachary/python-for-android/build/objects/rwobject.so.o
 /home/zachary/python-for-android/build/objects/_Acquisition.so.o
 /home/zachary/python-for-android/build/objects/cPersistence.so.o
 /home/zachary/python-for-android/build/objects/context.so.o
 /home/zachary/python-for-android/build/objects/vertex_instructions.so.o
 /home/zachary/python-for-android/build/objects/bufferproxy.so.o
 /home/zachary/python-for-android/build/objects/image.so.o
 /home/zachary/python-for-android/build/objects/_LFBTree.so.o
 /home/zachary/python-for-android/build/objects/rect.so.o
 /home/zachary/python-for-android/build/objects/mask.so.o
 /home/zachary/python-for-android/build/objects/cAccessControl.so.o
 /home/zachary/python-for-android/build/objects/overlay.so.o
 /home/zachary/python-for-android/build/objects/jnius.so.o
 -Llibs/armeabi
 -llog
 /home/zachary/python-for-android/build/objects/_imaging.so.o
 -L/home/zachary/python-for-android/src/obj/local/armeabi
 -L/home/zachary/android-ndk-r8c/platforms/android-14/arch-arm/usr/lib
 -ljpeg
 /home/zachary/python-for-android/build/objects/time.so.o
 /home/zachary/python-for-android/build/objects/fastevent.so.o
 /home/zachary/python-for-android/build/objects/okascore.so.o
 /home/zachary/python-for-android/build/objects/compiler.so.o
 -lGLESv2
 /home/zachary/python-for-android/build/objects/_Missing.so.o
 /home/zachary/python-for-android/build/objects/cDocumentTemplate.so.o
 /home/zachary/python-for-android/build/objects/_zope_proxy_proxy.so.o
 /home/zachary/python-for-android/build/objects/mouse.so.o
 -L/home/zachary/python-for-android/src/obj/local/armeabi/
 -lz
 -L/home/zachary/python-for-android/build/python-install/lib
 -lsdl
 -lpython2.7
 /home/zachary/python-for-android/build/objects/_OLBTree.so.o
 /home/zachary/python-for-android/build/objects/stopper.so.o
 -lm
 -L/home/zachary/python-for-android/build/libs
/home/zachary/python-for-android/build/objects/_LOBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_LOBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/_IIBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_IIBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/_OIBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_OIBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/_LLBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_LLBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/_IFBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_IFBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/_fsBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_fsBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/_OOBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_OOBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/cPersistence.so.o: In function `ring_move_to_head':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/persistent/ring.c:55: multiple definition of `ring_move_to_head'
/home/zachary/python-for-android/build/objects/cPickleCache.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/persistent/ring.c:55: first defined here
/home/zachary/python-for-android/build/objects/cPersistence.so.o: In function `ring_add':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/persistent/ring.c:38: multiple definition of `ring_add'
/home/zachary/python-for-android/build/objects/cPickleCache.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/persistent/ring.c:38: first defined here
/home/zachary/python-for-android/build/objects/cPersistence.so.o: In function `ring_del':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/persistent/ring.c:46: multiple definition of `ring_del'
/home/zachary/python-for-android/build/objects/cPickleCache.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/persistent/ring.c:46: first defined here
/home/zachary/python-for-android/build/objects/_LFBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_LFBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
/home/zachary/python-for-android/build/objects/_zope_proxy_proxy.so.o: In function `init_zope_proxy_proxy':
/tmp/easy_install-pE3zst/zope.proxy-3.6.1/src/zope/proxy/_zope_proxy_proxy.c:1120: multiple definition of `init_zope_proxy_proxy'
/home/zachary/python-for-android/build/objects/_zope_container_contained.so.o:/tmp/easy_install-yJWap3/zope.container-3.11.2/src/zope/container/_zope_proxy_proxy.c:1074: first defined here
/home/zachary/python-for-android/build/objects/_zope_proxy_proxy.so.o: In function `WrapperType_Lookup':
/tmp/easy_install-pE3zst/zope.proxy-3.6.1/src/zope/proxy/_zope_proxy_proxy.c:154: multiple definition of `WrapperType_Lookup'
/home/zachary/python-for-android/build/objects/_zope_container_contained.so.o:/tmp/easy_install-yJWap3/zope.container-3.11.2/src/zope/container/_zope_proxy_proxy.c:154: first defined here
/home/zachary/python-for-android/build/objects/_OLBTree.so.o: In function `init_persist_type':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: multiple definition of `init_persist_type'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeModuleTemplate.c:455: first defined here
/home/zachary/python-for-android/build/objects/_OLBTree.so.o: In function `get_bucket_state':
/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: multiple definition of `get_bucket_state'
/home/zachary/python-for-android/build/objects/_IOBTree.so.o:/tmp/easy_install-mi1nSH/ZODB3-3.10.5/src/BTrees/BTreeTemplate.c:1150: first defined here
collect2: ld returned 1 exit status
zachary@zachary-VirtualBox:~/python-for-android$ 

To get this point (and thus replicate the bug/issue) I had to do the following:

  • Use a 32bit Build environment in this case Ubutu 13.10
  • Use this recipe to build Zope2:

!/bin/bash

VERSION_zope2=${VERSION_zope2:-2.13}
URL_zope2=http://github.com/zopefoundation/Zope/archive/$VERSION_zope2.zip
BUILD_zope2=$BUILD_PATH/zope2/$(get_directory $URL_zope2)
RECIPE_zope2=$RECIPES_PATH/zope2

function prebuild_zope2() {
    true
}

function build_zope2() {
    cd $BUILD_zope2

    push_arm

    export LDFLAGS="$LDFLAGS -L$LIBS_PATH"
    export LDSHARED="$LIBLINK"

    HOSTPYTHON=/home/zac/Documents/Projects/Apps/python-for-android/build/hostpython/Python-2.7.2/hostpython
    try $HOSTPYTHON bootstrap.py
    try bin/buildout

    unset LDSHARED
    pop_arm
}

function postbuild_zope2() {
    true
}
  • Fix a bug with Zope2 and _SSL by doing:

    python-for-android/build/hostpython/Python-2.7.2/Lib ln -s ../build/lib.linux-x86_64-2.7 plat-linux3

And then everything should build to the point above

Was it helpful?

Solution

The biglink script basically creates a single library from everything it finds in build/objects/*so.o

But the zope objects are sometimes defining the same symbols, for example this is the implementation of _IFBTree.c:

/* IFBTree - int key, float value BTree

   Implements a collection using int type keys
   and float type values
*/

/* Setup template macros */

#define PERSISTENT

#define MOD_NAME_PREFIX "IF"

#define DEFAULT_MAX_BUCKET_SIZE 120
#define DEFAULT_MAX_BTREE_SIZE 500

#include "_compat.h"
#include "intkeymacros.h"
#include "floatvaluemacros.h"

#ifdef PY3K
#define INITMODULE PyInit__IFBTree
#else
#define INITMODULE init_IFBTree
#endif
#include "BTreeModuleTemplate.c"

And _IIBTree.c:

/* IIBTree - int key, int value BTree

   Implements a collection using int type keys
   and int type values
*/

/* Setup template macros */

#define PERSISTENT

#define MOD_NAME_PREFIX "II"

#define DEFAULT_MAX_BUCKET_SIZE 120
#define DEFAULT_MAX_BTREE_SIZE 500

#include "_compat.h"
#include "intkeymacros.h"
#include "intvaluemacros.h"

#ifdef PY3K
#define INITMODULE PyInit__IIBTree
#else
#define INITMODULE init_IIBTree
#endif
#include "BTreeModuleTemplate.c"

As you see, both include BTreeModuleTemplate.c, therefore name clashes between functions are unavoidable if the resulting .o files are merged together.

In your case, you can exclude the conflicting objects from the resulting library:

diff --git a/src/tools/biglink b/src/tools/biglink
index 1f82d18..7b05fb5 100755
--- a/src/tools/biglink
+++ b/src/tools/biglink
@@ -7,9 +7,24 @@ import subprocess

 sofiles = [ ]

+blacklist = [
+    '_LOBTree.so', '_LLBTree.so', 'cPersistence.so', '_zope_', 'cPickleCache.so',
+    '_LFBTree.so', '_OOBTree.so', '_IIBTree.so', '_OLBTree.so', '_IFBTree.so',
+    '_IOBTree.so', '_fsBTree.so',
+]
+
+def is_blacklisted(fn):
+    for name in blacklist:
+        if fn.startswith(name):
+            return True
+    return False
+
+
 for directory in sys.argv[2:]:

     for fn in os.listdir(directory):
+        if is_blacklisted(fn):
+            continue
         fn = os.path.join(directory, fn)

         if not fn.endswith(".so.o"):
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top