Coder Social home page Coder Social logo

Comments (17)

gerickson avatar gerickson commented on July 27, 2024

Per the above, this should work when invoking both in-situ (in the build tree) as well as as-installed. There is specific logic in the WeaveDeviceMgr load exception handler that attempts to intuit the right location to find _WeaveDeviceMgr.so:

https://github.com/openweave/openweave-core/blob/master/src/device-manager/python/weave-device-mgr.py#L40

In the case of in-situ execution:

% src/device-manager/python/weave-device-mgr
/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so not exist
trying pkgpythondir python
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/python
trying pkgpythondir lib/python/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/lib/python/weave
trying pkgpythondir lib/python2.7/dist-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/lib/python2.7/dist-packages/weave
trying pkgpythondir lib/python2.7/site-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/lib/python2.7/site-packages/weave
Could not find the WeaveDeviceMgr module!

In the in-situ case, the shared object is located as follows:

% find src -type f -name "_WeaveDeviceMgr.so"
src/device-manager/python/.libs/_WeaveDeviceMgr.so

In the case of as-installed execution, this gets slightly more complicated since weave-device-mgr is actually a symbolic link to a trampoline script, weave-run, that tries even harder to sort out the run time environment and, once it does, executes libexec/weave-device-mgr:

% tmp-install/usr/local/bin/weave-device-mgr
pkgskdrootdir is /Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local
trying to build loaderpaths from pkgsdklibdir lib
trying to build loaderpaths from pkgsdklibdir lib/python/weave
trying to build loaderpaths from pkgsdklibdir lib/python2.7/dist-packages/weave
trying to build loaderpaths from pkgsdklibdir lib/python2.7/site-packages/weave
set DYLD_LIBRARY_PATH to /Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/lib:/Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/lib/python/weave:/Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/lib/python2.7/dist-packages/weave:/Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/lib/python2.7/site-packages/weave
attempting to exec /Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/libexec/weave-device-mgr
trying pkgpythondir python
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/python
trying pkgpythondir lib/python/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/lib/python/weave
trying pkgpythondir lib/python2.7/dist-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/lib/python2.7/dist-packages/weave
trying pkgpythondir lib/python2.7/site-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install/usr/local/lib/python2.7/site-packages/weave
Could not find the WeaveDeviceMgr module!

In the installed case, the shared object is located as follows:

% find tmp-install/ -type f -name "_WeaveDeviceMgr.so"
tmp-install/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so

So, the key problem, at least in the installed case, is that _WeaveDeviceMgr.so isn't being qualified with "weave/...".

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

Looking at the generated makefile, it would appear that pyexecdir and pkgpyexecdir are correct:

pkgpyexecdir = ${pyexecdir}/weave
pyexecdir = ${exec_prefix}/lib/python2.7/site-packages
weavedir = $(pyexecdir)/weave
pyexec_LTLIBRARIES = _WeaveDeviceMgr.la
install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES)
    @$(NORMAL_INSTALL)
    @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \
    list2=; for p in $$list; do \
      if test -f $$p; then \
        list2="$$list2 $$p"; \
      else :; fi; \
    done; \
    test -z "$$list2" || { \
      echo " $(MKDIR_P) '$(DESTDIR)$(pyexecdir)'"; \
      $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" || exit 1; \
      echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyexecdir)'"; \
      $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyexecdir)"; \
    }

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

Comparing to commit 6d6b3fc, in-situ we find:

% src/device-manager/python/weave-device-mgr
/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so not exist
trying pkgpythondir python
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/python
trying pkgpythondir lib/python/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/lib/python/weave
trying pkgpythondir lib/python2.7/dist-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/lib/python2.7/dist-packages/weave
trying pkgpythondir lib/python2.7/site-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/src/device-manager/lib/python2.7/site-packages/weave
WEAVE:ML: Binding general purpose IPv4 UDP endpoint to [::]:11095
WEAVE:IN: IPV6_PKTINFO: 22
WEAVE:ML: Listening on general purpose IPv4 UDP endpoint
WEAVE:ML: Binding general purpose IPv6 UDP endpoint to [::]:11095 ()
WEAVE:IN: IP_PKTINFO: 22
WEAVE:ML: Listening on general purpose IPv6 UDP endpoint
WEAVE:ML: Adding lo0 to interface table
WEAVE:ML: Adding en0 to interface table
WEAVE:ML: Adding awdl0 to interface table
WEAVE:ML: Adding utun0 to interface table
Traceback (most recent call last):
  File "src/device-manager/python/weave-device-mgr", line 96, in <module>
    from WeaveCoreBluetoothMgr import CoreBluetoothManager as BleManager
  File "/Users/gerickson/Source/github.com/openweave/openweave-core/src/device-manager/python/WeaveCoreBluetoothMgr.py", line 36, in <module>
    from Foundation import *
ImportError: No module named Foundation

A different failure that still should work. It would appear Bluetooth has broken this use case.

with the actual module in the same place as for commit 5316dfd:

% find src -type f -name "_WeaveDeviceMgr.so"
src/device-manager/python/.libs/_WeaveDeviceMgr.so
% find src -type f -name "_WeaveDeviceMgr.la"
src/device-manager/python/_WeaveDeviceMgr.la

Pretty much everything looks the same there. Checking the installed case:

% tmp-install-6d6b3fc6/usr/local/bin/weave-device-mgr
pkgskdrootdir is /Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local
trying to build loaderpaths from pkgsdklibdir lib
trying to build loaderpaths from pkgsdklibdir lib/python/weave
trying to build loaderpaths from pkgsdklibdir lib/python2.7/dist-packages/weave
trying to build loaderpaths from pkgsdklibdir lib/python2.7/site-packages/weave
set DYLD_LIBRARY_PATH to /Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/lib:/Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/lib/python/weave:/Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/lib/python2.7/dist-packages/weave:/Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave
attempting to exec /Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/libexec/weave-device-mgr
trying pkgpythondir python
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/python
trying pkgpythondir lib/python/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/lib/python/weave
trying pkgpythondir lib/python2.7/dist-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/lib/python2.7/dist-packages/weave
trying pkgpythondir lib/python2.7/site-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build/tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave
Could not find the WeaveDeviceMgr module!

it fails in the same way as for commit
with the actual module in the same place as for commit 5316dfd, so it's not clear that commit 5316dfd is the problem:

 find tmp-install-6d6b3fc6/ -type f -name "_WeaveDeviceMgr.so"
tmp-install-6d6b3fc6//usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so
% find tmp-install-6d6b3fc6/ -type f -name "_WeaveDeviceMgr.la"
tmp-install-6d6b3fc6//usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.la

Looking at the two installs, the file listings are identical:

% find tmp-install/ | sort | tee ../openweave-core/tmp-install-find-6d6b3fc6.out
% find tmp-install/ | sort | tee ../openweave-core/tmp-install-find-5316dfd.out 
cmp tmp-install-find-6d6b3fc6.out tmp-install-find-5316dfd.out 
echo $?
0

Diffing the actual files in the two installations, we find the obvious and expected differences in the binary timestamps, etc. and we find the minor expected difference in ASN1OID.h include paths. Otherwise, every file that might have some bearing on this issue is identical:

% diff -q -aruN tmp-install-6d6b3fc6/ tmp-install-5316dfd/
Files tmp-install-6d6b3fc6/usr/local/include/BuildConfig.h and tmp-install-5316dfd/usr/local/include/BuildConfig.h differ
Files tmp-install-6d6b3fc6/usr/local/include/Weave/Support/ASN1.h and tmp-install-5316dfd/usr/local/include/Weave/Support/ASN1.h differ
Files tmp-install-6d6b3fc6/usr/local/include/Weave/Support/ASN1OID.h and tmp-install-5316dfd/usr/local/include/Weave/Support/ASN1OID.h differ
Files tmp-install-6d6b3fc6/usr/local/include/Weave/WeaveVersion.h and tmp-install-5316dfd/usr/local/include/Weave/WeaveVersion.h differ
Files tmp-install-6d6b3fc6/usr/local/lib/libBleLayer.a and tmp-install-5316dfd/usr/local/lib/libBleLayer.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libInetLayer.a and tmp-install-5316dfd/usr/local/lib/libInetLayer.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libRADaemon.a and tmp-install-5316dfd/usr/local/lib/libRADaemon.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libSystemLayer.a and tmp-install-5316dfd/usr/local/lib/libSystemLayer.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libWarm.a and tmp-install-5316dfd/usr/local/lib/libWarm.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libWeave.a and tmp-install-5316dfd/usr/local/lib/libWeave.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libWeaveDeviceManager.1.dylib and tmp-install-5316dfd/usr/local/lib/libWeaveDeviceManager.1.dylib differ
Files tmp-install-6d6b3fc6/usr/local/lib/libWeaveDeviceManager.a and tmp-install-5316dfd/usr/local/lib/libWeaveDeviceManager.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libWeaveDeviceManager.dylib and tmp-install-5316dfd/usr/local/lib/libWeaveDeviceManager.dylib differ
Files tmp-install-6d6b3fc6/usr/local/lib/libcrypto.a and tmp-install-5316dfd/usr/local/lib/libcrypto.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libmincrypt.a and tmp-install-5316dfd/usr/local/lib/libmincrypt.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libnlfaultinjection.a and tmp-install-5316dfd/usr/local/lib/libnlfaultinjection.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libnlunit-test.a and tmp-install-5316dfd/usr/local/lib/libnlunit-test.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libopenssl-jpake.a and tmp-install-5316dfd/usr/local/lib/libopenssl-jpake.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libssl.a and tmp-install-5316dfd/usr/local/lib/libssl.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/libuECC.a and tmp-install-5316dfd/usr/local/lib/libuECC.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.a and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.a differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveBleBase.pyc and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveBleBase.pyc differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveBleBase.pyo and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveBleBase.pyo differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveBleUtility.pyc and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveBleUtility.pyc differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveBleUtility.pyo and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveBleUtility.pyo differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveBluezMgr.pyc and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveBluezMgr.pyc differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveBluezMgr.pyo and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveBluezMgr.pyo differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveCoreBluetoothMgr.pyc and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveCoreBluetoothMgr.pyc differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveCoreBluetoothMgr.pyo and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveCoreBluetoothMgr.pyo differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveDeviceMgr.pyc and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveDeviceMgr.pyc differ
Files tmp-install-6d6b3fc6/usr/local/lib/python2.7/site-packages/weave/WeaveDeviceMgr.pyo and tmp-install-5316dfd/usr/local/lib/python2.7/site-packages/weave/WeaveDeviceMgr.pyo differ
Files tmp-install-6d6b3fc6/usr/local/libexec/mock-device and tmp-install-5316dfd/usr/local/libexec/mock-device differ
Files tmp-install-6d6b3fc6/usr/local/libexec/weave and tmp-install-5316dfd/usr/local/libexec/weave differ
Files tmp-install-6d6b3fc6/usr/local/libexec/weave-device-descriptor and tmp-install-5316dfd/usr/local/libexec/weave-device-descriptor differ
Files tmp-install-6d6b3fc6/usr/local/libexec/weave-heartbeat and tmp-install-5316dfd/usr/local/libexec/weave-heartbeat differ
Files tmp-install-6d6b3fc6/usr/local/libexec/weave-key-export and tmp-install-5316dfd/usr/local/libexec/weave-key-export differ
Files tmp-install-6d6b3fc6/usr/local/libexec/weave-ping and tmp-install-5316dfd/usr/local/libexec/weave-ping differ

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

I addressed the pyobjc issue noted in https://github.com/openweave/openweave-core/issues and explicitly checked out commit 5316dfd and the in-situ case works fine:

% src/device-manager/python/weave-device-mgr
/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so not exist
trying pkgpythondir python
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-5316dfd/src/device-manager/python
trying pkgpythondir lib/python/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-5316dfd/src/device-manager/lib/python/weave
trying pkgpythondir lib/python2.7/dist-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-5316dfd/src/device-manager/lib/python2.7/dist-packages/weave
trying pkgpythondir lib/python2.7/site-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-5316dfd/src/device-manager/lib/python2.7/site-packages/weave
WEAVE:ML: Binding general purpose IPv4 UDP endpoint to [::]:11095
WEAVE:IN: IPV6_PKTINFO: 22
WEAVE:ML: Listening on general purpose IPv4 UDP endpoint
WEAVE:ML: Binding general purpose IPv6 UDP endpoint to [::]:11095 ()
WEAVE:IN: IP_PKTINFO: 22
WEAVE:ML: Listening on general purpose IPv6 UDP endpoint
WEAVE:ML: Adding lo0 to interface table
WEAVE:ML: Adding en0 to interface table
WEAVE:ML: Adding awdl0 to interface table
WEAVE:ML: Adding utun0 to interface table
Weave Device Manager Shell

weave-device-mgr > quit

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

I've done a side-by-side diff of the build results between commit 5316dfd and 6d6b3fc and, beyond trivial, non-impactful path deltas based on my two, differently-named build directories, there are no meaningful differences in the build artifacts:

% diff -x "*.a" -x "*.o" -x "*.html" -x "tmp-install*" -aruN build-6d6b3fc6/src/device-manager/ build-5316dfd/src/device-manager/

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

From what I can see, there has also been a regression in master in which the "Re-bootstrapped package" portion of commit 5316dfd has regressed.

from openweave-core.

jaylogue avatar jaylogue commented on July 27, 2024

There is specific logic in the WeaveDeviceMgr load exception handler that attempts to intuit the right location to find _WeaveDeviceMgr.so:

This is not correct. The logic you cite in the device manager shell (weave-device-mgr.py) is attempting to find the WeaveDeviceMgr python module (WeaveDeviceMgr.py), not the associated ctypes shared library (_WeaveDeviceMgr.so). The logic for locating the latter is here:

dmLibName = os.path.join(currentDirPath, '_WeaveDeviceMgr.so')
# If the script binding library does not exist at the same level as
# this module, then search for it one level up. Otherwise, rely on the
# system dynamic loader to find it for us (via LD_LIBRARY_PATH or
# DYLD_LIBRARY_PATH.
if not os.path.exists(dmLibName):
(dmLibDir, dmLibFile) = os.path.split(dmLibName)
dmLibName = os.path.normpath(os.path.join(dmLibDir, "..", dmLibFile))
if not os.path.exists(dmLibName):
dmLibName = dmLibFile
if not os.path.exists(dmLibName):
for path in sys.path:
dmLibName = os.path.join(path, '_WeaveDeviceMgr.so')
if os.path.exists(dmLibName):
break
if not os.path.isfile(dmLibName):
print "%s not exist" % dmLibName

Unfortunately the code in weave-device-mgr.py is pretty broken. In particular, it presumes that any exception from the statement import WeaveDeviceMgr implies that WeaveDeviceMgr.py couldn't be found. And if importing is ultimately unsuccessful, it very unhelpfully suppresses the real reason. So the error "Could not find the WeaveDeviceMgr module!" in many cases means something entirely different went wrong.

Also, regarding this:

In the installed case, the shared object is located as follows: ... tmp-install/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so

This location is wrong. Since _WeaveDeviceMgr.so is not a python module (i.e. it cannot be imported), it shouldn't be installed into a module directory. Rather, it should be treated as package data that is installed within the module's subdirectory (in this case weave).

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

@jaylogue, so if I understand what you're saying correctly, the below install is actually backwards and transposed relative to what it should be:

% find tmp-install-master/ -name "*WeaveDeviceMgr.*"
tmp-install-master//usr/local/lib/python2.7/site-packages/weave/WeaveDeviceMgr.pyo
tmp-install-master//usr/local/lib/python2.7/site-packages/weave/WeaveDeviceMgr.pyc
tmp-install-master//usr/local/lib/python2.7/site-packages/weave/WeaveDeviceMgr.py
tmp-install-master//usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so
tmp-install-master//usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.la
tmp-install-master//usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.a

in that the .py files should be up one level and the *.{so,la,a} files should be down one level in weave/...?

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

Per @jaylogue 's recommendation, added full print of the exception:

% src/device-manager/python/weave-device-mgr
trying to find dmLibName /Users/gerickson/Source/github.com/openweave/openweave-core/src/device-manager/python/_WeaveDeviceMgr.so
nope, trying to find dmLibName _WeaveDeviceMgr.so
nope, one last try, trying to find dmLibName /usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so
/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so does not exist
trying pkgpythondir python
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/python
trying pkgpythondir lib/python/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/lib/python/weave
trying pkgpythondir lib/python2.7/dist-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/lib/python2.7/dist-packages/weave
trying pkgpythondir lib/python2.7/site-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/lib/python2.7/site-packages/weave
trying to find dmLibName /Users/gerickson/Source/github.com/openweave/openweave-core/src/device-manager/python/_WeaveDeviceMgr.so
nope, trying to find dmLibName _WeaveDeviceMgr.so
nope, one last try, trying to find dmLibName /Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/python/_WeaveDeviceMgr.so
Could not import the WeaveDeviceMgr module: dlopen(/Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/python/_WeaveDeviceMgr.so, 6): Symbol not found: __ZN2nl5Weave8Platform16PersistedStorage4ReadEPKcRj
  Referenced from: /Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/python/../.libs/libWeaveDeviceManager.1.dylib
  Expected in: flat namespace
 in /Users/gerickson/Source/github.com/openweave/build-master/src/device-manager/python/../.libs/libWeaveDeviceManager.1.dylib

The real problem appears to be the missing nl::Weave::Platform::PersistedStorage::Read(char const*, unsigned int&) symbol.

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

This also better elucidates the problem with the exec-from-install problem:

% tmp-install-master/usr/local/bin/weave-device-mgr
pkgsdkrootdir is /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local
trying to build loaderpaths from pkgsdklibdir lib
trying to build loaderpaths from pkgsdklibdir lib/python/weave
trying to build loaderpaths from pkgsdklibdir lib/python2.7/dist-packages/weave
trying to build loaderpaths from pkgsdklibdir lib/python2.7/site-packages/weave
set DYLD_LIBRARY_PATH to /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib:/Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python/weave:/Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/dist-packages/weave:/Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/weave
attempting to exec /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/libexec/weave-device-mgr
trying pkgpythondir python
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/python
trying pkgpythondir lib/python/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python/weave
trying pkgpythondir lib/python2.7/dist-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/dist-packages/weave
trying pkgpythondir lib/python2.7/site-packages/weave
trying pyweavepath /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/weave
trying to find dmLibName /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/weave/_WeaveDeviceMgr.so
nope, trying to find dmLibName /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/weave/_WeaveDeviceMgr.so
nope, one last try, trying to find dmLibName /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/weave/_WeaveDeviceMgr.so
Could not import the WeaveDeviceMgr module: dlopen(/Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/weave/_WeaveDeviceMgr.so, 6): Library not loaded: @loader_path/../libWeaveDeviceManager.1.dylib
  Referenced from: /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/weave/_WeaveDeviceMgr.so
  Reason: image not found

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

Not a fix by any means; however, this will improve the diagnostic output for this an other future such failures: https://github.com/openweave/openweave-core/pull/new/bug/github-issue-250.1

from openweave-core.

jaylogue avatar jaylogue commented on July 27, 2024

the .py files should be up one level and the *.{so,la,a} files should be down one level in weave/...?

Well, perhaps the correct solution is a bit more subtle. If we wish to treat WeaveDeviceMgr itself as a module (i.e. where one can say import WeaveDeviceMgr), then either:

  1. WeaveDeviceMgr.py operates as a stand-alone script, which gets installed into site-packages. In this case _WeaveDeviceMgr.so should be installed alongside it directly in site-packages.

or

  1. site-packages contains a WeaveDeviceMgr subdirectory which contains WeaveDeviceMgr.py and an appropriate module init script (__init__.py). In this case _WeaveDeviceMgr.so should be installed in the WeaveDeviceMgr subdirectory.

Following convention, if there is a subdirectory site-packages/weave then this is expected to contain a module called weave, with an __init__.py script. Structured this way, WeaveDeviceMgr.py would be a class file in the weave module directory and _WeaveDeviceMgr.so would sit alongside it.

I believe making "weave" a proper module is the right thing to do going forward, as it allows us to package other classes in a single module. However, this means changing the way scripts import WeaveDeviceMgr to:

from weave import WeaveDeviceMgr

from openweave-core.

jaylogue avatar jaylogue commented on July 27, 2024

The real problem appears to be the missing nl::Weave::Platform::PersistedStorage::Read(char const*, unsigned int&) symbol.

Ah. So that's a build problem unrelated to how python operates.

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

If I fix / change _src/device-manager/python/Makefile.am as follows:

@@ -189,6 +199,6 @@ uninstall-exec-binLINKS: $(bin_LINKS)
    dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
 
 install-exec-hook:
-   $(call set-relocation-path,$(DESTDIR)$(pyexecdir)/_WeaveDeviceMgr.so,libWeaveDeviceManager.$(LIBWEAVE_VERSION_CURRENT).dylib,@loader_path/../)
+   $(call set-relocation-path,$(DESTDIR)$(pyexecdir)/_WeaveDeviceMgr.so,libWeaveDeviceManager.$(LIBWEAVE_VERSION_CURRENT).dylib,@loader_path/../../)
 
 include $(abs_top_nlbuild_autotools_dir)/automake/post.am

then the execute-as-installed case works and I get the same error as for the execute-in-situ case:

Could not import the WeaveDeviceMgr module: dlopen(/Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so, 6): Symbol not found: nl::Weave::Platform::PersistedStorage::Read(char const*, unsigned int&)
  Referenced from: /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/../../libWeaveDeviceManager.1.dylib
  Expected in: flat namespace
 in /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/../../libWeaveDeviceManager.1.dylib

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

There also seems to be a problem with set-relocation-path as executed by install-exec-hook. If I run the following steps:

% tmp-install-master/usr/local/bin/weave-device-mgr
[Dynamic Loader FAIL due to missing libWeaveDeviceManager.1.dylib]
% rm -f ./tmp-install-master/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so
% make DESTDIR=`pwd`/tmp-install-master install
% otool -L /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so
/Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so:
	/usr/local/lib/libWeaveDeviceManager.1.dylib (compatibility version 2.0.0, current version 2.5.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

We see that the install_name_tool has no effect. However, if I run it again manually on the CLI, it works and then invoking weave-device-mgr works (missing symbol notwithstanding):

% install_name_tool -change /usr/local/lib/libWeaveDeviceManager.1.dylib @loader_path/../../libWeaveDeviceManager.1.dylib /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so
% otool -L /Users/gerickson/Source/github.com/openweave/build-master/tmp-install-master/usr/local/lib/python2.7/site-packages/_WeaveDeviceMgr.so
% tmp-install-master/usr/local/bin/weave-device-mgr
[Dynamic Loader FAIL due to missing nl::Weave::Platform::PersistedStorage::Read(char const*, unsigned int&)]

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

#254 fixes the second of three (two) issues.

Once this and #252 are merged, then someone with more familiarity with nl::Weave::Platform::PersistedStorage::Read(char const*, unsigned int&) can address that issue.

from openweave-core.

gerickson avatar gerickson commented on July 27, 2024

@robszewczyk fixed the last issue.

from openweave-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.