pscholl / jenprog

simple Jennic programmer tool
http://www.teco.edu/~scholl/blog
8 stars 6 forks source link

Does not build on Mac OS #1

Closed spachner closed 13 years ago

spachner commented 13 years ago

Hi,

I kindly ask for assistance for Mac OS. I installed as adviced swig, libftdi and scons by means of MacPorts. So the ftdi stuff got installed into /opt/local/include/ and /opt/local/lib/.

The 'scons install' fails because the ftdi.h and ftdi lib are not found.

I tried to change the SConstrut but I failed. How to adopt the SConstruct to get the installer run through?

Thanks for helping.

spachner

pscholl commented 13 years ago

Hi, depends on what you are doing, probably you can skip this step completly. Are you using a design that has DTR and DSR lines connected to the RESET and SPIMISO lines of the jennic module?

Best, -Philipp Scholl

On Mon, May 16, 2011 at 08:48:51AM -0700, spachner wrote:

Hi,

I kindly ask for assistance for Mac OS. I installed as adviced swig, libftdi and scons by means of MacPorts. So the ftdi stuff got installed into /opt/local/include/ and /opt/local/lib/.

The 'scons install' fails because the ftdi.h and ftdi lib are not found.

I tried to change the SConstrut but I failed. How to adopt the SConstruct to get the installer run through?

Thanks for helping.

spachner

Reply to this email directly or view it on GitHub: https://github.com/pscholl/jenprog/issues/1

spachner commented 13 years ago

Hi,

I have several selfmade PCBs incorporated a JN5148 and a FTDI chip. I even made a small PCB with just the FTDI which allows me to connect to the standard Jennic evaluation boards which unfortunately lacks the FTDI. The mechanism to start the bootloader by automatic handling of MISO/Reset is great for rapid development cycles. Usually I develop under Windows (in a VM under MAC OS) but I would like to program my boards under MAC OS which makes things easier.

Thanks for helping

spachner

pscholl commented 13 years ago

Hi, try with a modified this modified SConstruct file:

import sys
import os

PYCPPPATH  = os.path.join(sys.prefix, 'include', 'python%d.%d'%(sys.version_info[0], sys.version_info[1]))
PYPLATPATH = filter(lambda x: "plat" in x, sys.path)[0]

lib = SharedLibrary( target='_ftdi', source='ftdi.i'.split(),
                     CPPPATH=['.', '/opt/local/include', PYCPPPATH],
                     SWIGFLAGS='-python -I/usr/include -I/opt/local/include',
                     SHLIBPREFIX='',
                     LIBPATH='/opt/local/lib',
                     LIBS='ftdi',
                     CFLAGS='-g',
                    )

Alias('install', Install(PYPLATPATH, [lib, 'ftdi.py']))

let me know if this works, and I'll commit that.

-phil

spachner commented 13 years ago

Hi Phil,

better but something is still missing:

spachner$ sudo scons install
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o _ftdi.dylib -dynamiclib ftdi_wrap.os -lftdi
ld: library not found for -lftdi
collect2: ld returned 1 exit status
scons: *** [_ftdi.dylib] Error 1
scons: building terminated because of errors.

spachner$ ll /opt/local/lib/libftdi.*
-rwxr-xr-x  2 root  admin  29640 16 Mai 16:47 /opt/local/lib/libftdi.1.dylib
-rw-r--r--  2 root  admin  28976 16 Mai 16:47 /opt/local/lib/libftdi.a
lrwxr-xr-x  1 root  admin     15 16 Mai 16:47 /opt/local/lib/libftdi.dylib -> libftdi.1.dylib
-rwxr-xr-x  2 root  admin    995 16 Mai 16:47 /opt/local/lib/libftdi.la
pscholl commented 13 years ago

weird, you use a non standard directory where gcc needs to find libftdi. The path should be given to gcc with '-L' option, which can be set from SCons with the LIBPATH directive. This works on my machine, perhaps you forgot to add that in the SConstruct file or forgot to clean the build with 'scons -c' beforehand?

-phil

On Thu, May 19, 2011 at 04:58:55AM -0700, spachner wrote:

Hi Phil,

better but something is still missing:

spachner$ sudo scons install
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o _ftdi.dylib -dynamiclib ftdi_wrap.os -lftdi
ld: library not found for -lftdi
collect2: ld returned 1 exit status
scons: *** [_ftdi.dylib] Error 1
scons: building terminated because of errors.

spachner$ ll /opt/local/lib/libftdi.*
-rwxr-xr-x  2 root  admin  29640 16 Mai 16:47 /opt/local/lib/libftdi.1.dylib
-rw-r--r--  2 root  admin  28976 16 Mai 16:47 /opt/local/lib/libftdi.a
lrwxr-xr-x  1 root  admin     15 16 Mai 16:47 /opt/local/lib/libftdi.dylib -> libftdi.1.dylib
-rwxr-xr-x  2 root  admin    995 16 Mai 16:47 /opt/local/lib/libftdi.la

Reply to this email directly or view it on GitHub: https://github.com/pscholl/jenprog/issues/1#comment_1203034

spachner commented 13 years ago

I usually add packages by MacPorts which uses for everything /opt/local/.. I added LIBPATH='/opt/local/lib' to SConstruct and started over in a fresh directory:

lib = SharedLibrary( target='_ftdi', source='ftdi.i'.split(),
                    CPPPATH=['.', '/opt/local/include', PYCPPPATH],
                    SWIGFLAGS='-python -I/usr/include -I/opt/local/include',
                    SHLIBPREFIX='',
                    LIBPATH='/opt/local/lib',
                    LIBS='ftdi',
                    CFLAGS='-g',
                   )

Now it ends up in other errors:

spachner$ sudo scons install
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
swig -o ftdi_wrap.c -python -I/usr/include -I/opt/local/include ftdi.i
gcc -o ftdi_wrap.os -c -g -fPIC -I. -I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 ftdi_wrap.c
ftdi_wrap.c: In function 'SWIG_Python_AddErrorMsg':
ftdi_wrap.c:853: warning: format not a string literal and no format arguments
ftdi_wrap.c: In function '_wrap_ftdi_enable_bitbang':
ftdi_wrap.c:6419: warning: 'ftdi_enable_bitbang' is deprecated (declared at /opt/local/include/ftdi.h:331)
gcc -o _ftdi.dylib -dynamiclib ftdi_wrap.os -L/opt/local/lib -lftdi
Undefined symbols for architecture x86_64:
  "_PyExc_MemoryError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyExc_IOError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyExc_RuntimeError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
      _SWIG_Python_AddErrorMsg in ftdi_wrap.os
  "_PyExc_IndexError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyExc_TypeError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
      _SWIG_Python_UnpackTuple in ftdi_wrap.os
      _SWIG_Python_TypeError in ftdi_wrap.os
  "_PyExc_ZeroDivisionError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyExc_OverflowError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyExc_SyntaxError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyExc_ValueError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyExc_SystemError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
      _SWIG_Python_UnpackTuple in ftdi_wrap.os
  "_PyExc_AttributeError", referenced from:
      _SWIG_Python_ErrorType in ftdi_wrap.os
  "_PyErr_Occurred", referenced from:
      _SWIG_Python_AddErrorMsg in ftdi_wrap.os
      _PySwigClientData_New in ftdi_wrap.os
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
      _SWIG_Python_ConvertPtrAndOwn in ftdi_wrap.os
      _SWIG_Python_GetModule in ftdi_wrap.os
      _SWIG_Python_AddErrMesg in ftdi_wrap.os
      _SWIG_Python_ArgFail in ftdi_wrap.os
      ...
  "_PyErr_Fetch", referenced from:
      _SWIG_Python_AddErrorMsg in ftdi_wrap.os
      _SWIG_Python_AddErrMesg in ftdi_wrap.os
  "_PyObject_Str", referenced from:
      _SWIG_Python_AddErrorMsg in ftdi_wrap.os
      _SWIG_Python_AddErrMesg in ftdi_wrap.os
      _SWIG_Python_TypeError in ftdi_wrap.os
  "_PyErr_Clear", referenced from:
      _SWIG_Python_AddErrorMsg in ftdi_wrap.os
      _PySwigClientData_New in ftdi_wrap.os
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
      _SWIG_Python_ConvertPtrAndOwn in ftdi_wrap.os
      _SWIG_Python_GetModule in ftdi_wrap.os
      _SWIG_Python_AddErrMesg in ftdi_wrap.os
      _SWIG_Python_MustGetPtr in ftdi_wrap.os
      ...
  "_PyString_AsString", referenced from:
      _SWIG_Python_AddErrorMsg in ftdi_wrap.os
      _PySwigObject_repr in ftdi_wrap.os
      _PySwigObject_print in ftdi_wrap.os
      _SWIG_Python_AddErrMesg in ftdi_wrap.os
      _SWIG_Python_TypeError in ftdi_wrap.os
      _SWIG_AsCharPtrAndSize in ftdi_wrap.os
      _swig_varlink_print in ftdi_wrap.os
      ...
  "_PyErr_Format", referenced from:
      _SWIG_Python_AddErrorMsg in ftdi_wrap.os
      _SWIG_Python_UnpackTuple in ftdi_wrap.os
      _SWIG_Python_AddErrMesg in ftdi_wrap.os
      _SWIG_Python_TypeError in ftdi_wrap.os
  "_PyErr_SetObject", referenced from:
      _SWIG_Python_SetErrorObj in ftdi_wrap.os
  "_PyErr_SetString", referenced from:
      _SWIG_Python_SetErrorMsg in ftdi_wrap.os
      _SWIG_Python_UnpackTuple in ftdi_wrap.os
      _swig_varlink_getattr in ftdi_wrap.os
      _swig_varlink_setattr in ftdi_wrap.os
  "_PyDict_SetItemString", referenced from:
      _SWIG_Python_SetConstant in ftdi_wrap.os
      _SWIG_Python_InstallConstants in ftdi_wrap.os
  "__Py_NoneStruct", referenced from:
      _SWIG_Python_AppendOutput in ftdi_wrap.os
      _SWIG_Py_Void in ftdi_wrap.os
      _SWIG_Python_ConvertPtrAndOwn in ftdi_wrap.os
  "_PyList_New", referenced from:
      _SWIG_Python_AppendOutput in ftdi_wrap.os
  "_PyList_SetItem", referenced from:
      _SWIG_Python_AppendOutput in ftdi_wrap.os
  "_PyList_Append", referenced from:
      _SWIG_Python_AppendOutput in ftdi_wrap.os
  "_PyClass_Type", referenced from:
      _PySwigClientData_New in ftdi_wrap.os
  "_PyObject_GetAttrString", referenced from:
      _PySwigClientData_New in ftdi_wrap.os
      _SWIG_Python_SetSwigThis in ftdi_wrap.os
  "_PyTuple_New", referenced from:
      _PySwigClientData_New in ftdi_wrap.os
      _PySwigObject_format in ftdi_wrap.os
  "_PyTuple_SetItem", referenced from:
      _PySwigClientData_New in ftdi_wrap.os
      _PySwigObject_format in ftdi_wrap.os
  "_PyLong_FromVoidPtr", referenced from:
      _PySwigObject_long in ftdi_wrap.os
  "_PyString_FromString", referenced from:
      _PySwigObject_format in ftdi_wrap.os
      _PySwigObject_str in ftdi_wrap.os
      _PySwigPacked_str in ftdi_wrap.os
      __SWIG_This in ftdi_wrap.os
      _SWIG_Python_TypeQuery in ftdi_wrap.os
      _swig_varlink_repr in ftdi_wrap.os
      _swig_varlink_str in ftdi_wrap.os
      ...
  "_PyString_Format", referenced from:
      _PySwigObject_format in ftdi_wrap.os
  "_PyString_FromFormat", referenced from:
      _PySwigObject_repr in ftdi_wrap.os
      _PySwigPacked_repr in ftdi_wrap.os
      _PySwigPacked_str in ftdi_wrap.os
  "_PyString_ConcatAndDel", referenced from:
      _PySwigObject_repr in ftdi_wrap.os
      _swig_varlink_str in ftdi_wrap.os
  "_PyObject_CallFunctionObjArgs", referenced from:
      _PySwigObject_dealloc in ftdi_wrap.os
      _SWIG_Python_ConvertPtrAndOwn in ftdi_wrap.os
  "_PyObject_Free", referenced from:
      _PySwigObject_dealloc in ftdi_wrap.os
      _PySwigPacked_dealloc in ftdi_wrap.os
      _PySwigPacked_New in ftdi_wrap.os
  "_PyArg_UnpackTuple", referenced from:
      _PySwigObject_own in ftdi_wrap.os
  "_PyBool_FromLong", referenced from:
      _PySwigObject_own in ftdi_wrap.os
  "_PyObject_IsTrue", referenced from:
      _PySwigObject_own in ftdi_wrap.os
  "_PyObject_GenericGetAttr", referenced from:
      _tmp.9718 in ftdi_wrap.os
      _tmp.9868 in ftdi_wrap.os
  "_PyType_Type", referenced from:
      __PySwigObject_type in ftdi_wrap.os
      __PySwigPacked_type in ftdi_wrap.os
      _swig_varlink_type in ftdi_wrap.os
  "_PyObject_Malloc", referenced from:
      _PySwigObject_New in ftdi_wrap.os
      _PySwigPacked_New in ftdi_wrap.os
      _SWIG_Python_newvarlink in ftdi_wrap.os
  "_PyObject_Init", referenced from:
      _PySwigObject_New in ftdi_wrap.os
      _PySwigPacked_New in ftdi_wrap.os
      _SWIG_Python_newvarlink in ftdi_wrap.os
  "_PyInstance_Type", referenced from:
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
  "__PyInstance_Lookup", referenced from:
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
  "__PyObject_GetDictPtr", referenced from:
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
      _SWIG_Python_NewShadowInstance in ftdi_wrap.os
      _SWIG_Python_SetSwigThis in ftdi_wrap.os
  "_PyDict_GetItem", referenced from:
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
      _SWIG_Python_TypeQuery in ftdi_wrap.os
  "__PyWeakref_ProxyType", referenced from:
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
  "__PyWeakref_CallableProxyType", referenced from:
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
  "_PyObject_GetAttr", referenced from:
      _SWIG_Python_GetSwigThis in ftdi_wrap.os
  "_PyCFunction_Type", referenced from:
      _SWIG_Python_ConvertFunctionPtr in ftdi_wrap.os
  "_PyObject_Call", referenced from:
      _SWIG_Python_NewShadowInstance in ftdi_wrap.os
  "_PyDict_New", referenced from:
      _SWIG_Python_NewShadowInstance in ftdi_wrap.os
      _SWIG_Python_SetSwigThis in ftdi_wrap.os
      _SWIG_Python_TypeCache in ftdi_wrap.os
  "_PyDict_SetItem", referenced from:
      _SWIG_Python_NewShadowInstance in ftdi_wrap.os
      _SWIG_Python_SetSwigThis in ftdi_wrap.os
      _SWIG_Python_TypeQuery in ftdi_wrap.os
  "_PyInstance_NewRaw", referenced from:
      _SWIG_Python_NewShadowInstance in ftdi_wrap.os
  "_PyCObject_Import", referenced from:
      _SWIG_Python_GetModule in ftdi_wrap.os
  "_Py_InitModule4_64", referenced from:
      _SWIG_Python_SetModule in ftdi_wrap.os
      _init_ftdi in ftdi_wrap.os
  "_PyCObject_FromVoidPtr", referenced from:
      _SWIG_Python_SetModule in ftdi_wrap.os
      _SWIG_Python_TypeQuery in ftdi_wrap.os
  "_PyModule_AddObject", referenced from:
      _SWIG_Python_SetModule in ftdi_wrap.os
  "_PyCObject_AsVoidPtr", referenced from:
      _SWIG_Python_TypeQuery in ftdi_wrap.os
  "_PyOS_snprintf", referenced from:
      _SWIG_Python_ArgFail in ftdi_wrap.os
  "_usb_set_debug", referenced from:
      _ftdi_debug in ftdi_wrap.os
  "_PyFloat_Type", referenced from:
      _SWIG_AsVal_double in ftdi_wrap.os
  "_PyType_IsSubtype", referenced from:
      _SWIG_AsVal_double in ftdi_wrap.os
  "_PyFloat_AsDouble", referenced from:
      _SWIG_AsVal_double in ftdi_wrap.os
  "_PyInt_AsLong", referenced from:
      _SWIG_AsVal_double in ftdi_wrap.os
      _SWIG_AsVal_unsigned_SS_long in ftdi_wrap.os
      _SWIG_AsVal_long in ftdi_wrap.os
  "_PyLong_AsDouble", referenced from:
      _SWIG_AsVal_double in ftdi_wrap.os
  "_PyLong_AsUnsignedLong", referenced from:
      _SWIG_AsVal_unsigned_SS_long in ftdi_wrap.os
  "_PyLong_AsLong", referenced from:
      _SWIG_AsVal_long in ftdi_wrap.os
  "_PyString_AsStringAndSize", referenced from:
      _SWIG_AsCharPtrAndSize in ftdi_wrap.os
  "_PyArg_ParseTuple", referenced from:
      __wrap_new_cArray in ftdi_wrap.os
      __wrap_delete_cArray in ftdi_wrap.os
      __wrap_cArray___getitem__ in ftdi_wrap.os
      __wrap_cArray___setitem__ in ftdi_wrap.os
      __wrap_cArray_cast in ftdi_wrap.os
      __wrap_cArray_frompointer in ftdi_wrap.os
      _cArray_swigregister in ftdi_wrap.os
      ...
  "_PyLong_FromUnsignedLong", referenced from:
      _SWIG_From_unsigned_SS_long in ftdi_wrap.os
  "_PyInt_FromLong", referenced from:
      _SWIG_From_unsigned_SS_long in ftdi_wrap.os
      _SWIG_From_int in ftdi_wrap.os
  "_PyString_FromStringAndSize", referenced from:
      _SWIG_FromCharPtrAndSize in ftdi_wrap.os
  "_PyExc_NameError", referenced from:
      _swig_varlink_getattr in ftdi_wrap.os
      _swig_varlink_setattr in ftdi_wrap.os
  "_PyModule_GetDict", referenced from:
      _init_ftdi in ftdi_wrap.os
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
scons: *** [_ftdi.dylib] Error 1
scons: building terminated because of errors.
pscholl commented 13 years ago

Hurm, okay, mac os needs to be linked to the python lib. Here is different SConsctruct using pkg-config:

import sys import os

env = Environment() env.ParseConfig('pkg-config --libs --cflags libftdi python-%d.%d'%(sys.version_info[0], sys.version_info[1]))

PYPLATPATH = filter(lambda x: "plat" in x, sys.path)[0]

lib = env.SharedLibrary( target='_ftdi', source='ftdi.i'.split(), CPPPATH=['.', '$CPPPATH'], SWIGFLAGS='-python -I/usr/include', SHLIBPREFIX='', )

env.Alias('install', env.Install(PYPLATPATH, [lib, 'ftdi.py']))

-phil

spachner commented 13 years ago

Phil, thanks for trying to help. I give up, have currently not the time to dig deeper into scons which I am not familiar with.

regards

spachner