Patchwork Build error when trying to build the py-smbus package of i2c-tools

login
register
mail settings
Submitter Thomas Weininger
Date June 20, 2013, 7:18 a.m.
Message ID <4E062DFADC6E8142AA8EE9D214BA0C50E3E24C@NB-EX-MBX01.diasemi.com>
Download mbox | patch
Permalink /patch/252766/
State Not Applicable
Headers show

Comments

Thomas Weininger - June 20, 2013, 7:18 a.m.
Hi,

I'm using Buildroot Git version 28ab11d7855a1b85e4be15cd9c86ad0838fa1cb1 from 2013-06-06. I tried to change the package/i2c-tools/i2c-tools.mk in order to build an extra package called py-smbus, which is part of i2c-tools but not built by default. Considering the i2c-tools README http://www.lm-sensors.org/browser/i2c-tools/trunk/README?rev=6171 I added EXTRA="py-smbus" to the make options.

But even this small change breaks the build. I'm confused because of the strage error message:
gcc: error: unrecognized command line option '-mfpu=vfpv4-d16'
gcc: error: unrecognized command line option '-mfloat-abi=hard'

Could you please help me to understand what is going wrong here and how to fix it? The mfpu and mfloat-abi switches are okay IMO. My toolchain is built by Buildroot. It is configured to build for an ARM Cortex A5 target (Atmel SAMA5D3).


>>> i2c-tools 3.1.0 Building
[...]
/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc  -o tools/i2cget tools/i2cget.o tools/i2cbusses.o tools/util.o
running build
running build_ext
building 'smbus' extension
creating build
creating build/temp.linux-i686-2.7
/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include -fPIC -I/home/diasemi/workspace/dialog/buildroot/output/host/usr/include/python2.7 -c smbusmodule.c -o build/temp.linux-i686-2.7/smbusmodule.o
smbusmodule.c: In function 'initsmbus':
smbusmodule.c:695:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
creating build/lib.linux-i686-2.7
/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /usr/bin/gcc -pthread -shared -L/home/diasemi/workspace/dialog/buildroot/output/host/lib -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -Wl,-rpath,/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include build/temp.linux-i686-2.7/smbusmodule.o -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -lpython2.7 -o build/lib.linux-i686-2.7/smbus.so
gcc: error: unrecognized command line option '-mfpu=vfpv4-d16'
gcc: error: unrecognized command line option '-mfloat-abi=hard'
error: command '/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache' failed with exit status 1
make[1]: *** [all-python] Error 1
make[1]: Leaving directory `/home/diasemi/workspace/dialog/buildroot/output/build/i2c-tools-3.1.0'
make: *** [/home/diasemi/workspace/dialog/buildroot/output/build/i2c-tools-3.1.0/.stamp_built] Error 2
Thomas Petazzoni - June 20, 2013, 7:57 a.m.
Dear Thomas Weininger,

On Thu, 20 Jun 2013 07:18:42 +0000, Thomas Weininger wrote:

> /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include -fPIC -I/home/diasemi/workspace/dialog/buildroot/output/host/usr/include/python2.7 -c smbusmodule.c -o build/temp.linux-i686-2.7/smbusmodule.o

This line is correctly using the ARM cross-compiler.

> smbusmodule.c: In function 'initsmbus':
> smbusmodule.c:695:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
> creating build/lib.linux-i686-2.7
> /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /usr/bin/gcc -pthread -shared -L/home/diasemi/workspace/dialog/buildroot/output/host/lib -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -Wl,-rpath,/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include build/temp.linux-i686-2.7/smbusmodule.o -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -lpython2.7 -o build/lib.linux-i686-2.7/smbus.so
> gcc: error: unrecognized command line option '-mfpu=vfpv4-d16'
> gcc: error: unrecognized command line option '-mfloat-abi=hard'

But this line is using a native compiler (gcc) and ARM-specific options
are passed (-mfpu, -mfloat-abi). You'll have to figure out why the
i2c-tools build system is using the native compiler and not the
cross-compiler here.

Best regards,

Thomas
Thomas Weininger - June 20, 2013, 9:30 a.m.
> -----Original Message-----
> From: Thomas Petazzoni [mailto:thomas.petazzoni@free-electrons.com]
> Sent: Donnerstag, 20. Juni 2013 09:58
> To: Thomas Weininger
> Cc: buildroot@busybox.net
> Subject: Re: [Buildroot] Build error when trying to build the py-smbus
> package of i2c-tools
>
> Dear Thomas Weininger,
>
> On Thu, 20 Jun 2013 07:18:42 +0000, Thomas Weininger wrote:
>
> > /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache
> > /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-
> build
> > root-linux-uclibcgnueabi-gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
> > -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -
> pipe
> > -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE
> > -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include -fPIC
> > -
> I/home/diasemi/workspace/dialog/buildroot/output/host/usr/include/pyt
> > hon2.7 -c smbusmodule.c -o build/temp.linux-i686-2.7/smbusmodule.o
>
> This line is correctly using the ARM cross-compiler.
>
> > smbusmodule.c: In function 'initsmbus':
> > smbusmodule.c:695:2: warning: dereferencing type-punned pointer will
> > break strict-aliasing rules [-Wstrict-aliasing] creating
> > build/lib.linux-i686-2.7
> > /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache
> > /usr/bin/gcc -pthread -shared
> > -L/home/diasemi/workspace/dialog/buildroot/output/host/lib
> > -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib
> > -Wl,-
> rpath,/home/diasemi/workspace/dialog/buildroot/output/host/usr/li
> > b -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -
> D_FILE_OFFSET_BITS=64
> > -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE
> > -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include
> > build/temp.linux-i686-2.7/smbusmodule.o
> > -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib
> > -lpython2.7 -o build/lib.linux-i686-2.7/smbus.so
> > gcc: error: unrecognized command line option '-mfpu=vfpv4-d16'
> > gcc: error: unrecognized command line option '-mfloat-abi=hard'
>
> But this line is using a native compiler (gcc) and ARM-specific options are
> passed (-mfpu, -mfloat-abi). You'll have to figure out why the i2c-tools build
> system is using the native compiler and not the cross-compiler here.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux development, consulting,
> training and support.
> http://free-electrons.com

 [Thomas Weininger]
Thank you Thomas for your help. I decided to split the py-smbus module from i2c-tools to a separate package. This may not be the most elegant way, but it works for me. Also the gcc errors do not occur anymore.

The downside of this approach is that I have to provide an extra python-smbus-3.1.0.tar.gz package. If someone is interested I could provide a patch for this package.

Best regards,
Thomas
Arnout Vandecappelle - June 20, 2013, 4:25 p.m.
On 20/06/13 09:18, Thomas Weininger wrote:
> Hi,
> 
> I'm using Buildroot Git version 28ab11d7855a1b85e4be15cd9c86ad0838fa1cb1 
> from 2013-06-06. I tried to change the package/i2c-tools/i2c-tools.mk in 
> order to build an extra package called py-smbus, which is part of 
> i2c-tools but not built by default. Considering the i2c-tools README 
> http://www.lm-sensors.org/browser/i2c-tools/trunk/README?rev=6171 I added 
> EXTRA="py-smbus" to the make options.
> 
> diff --git a/package/i2c-tools/i2c-tools.mk b/package/i2c-tools/i2c-tools.mk
> 
> index 1589d04..403b96d 100644
> 
> --- a/package/i2c-tools/i2c-tools.mk
> 
> +++ b/package/i2c-tools/i2c-tools.mk
> 
> @@ -9,7 +9,7 @@ I2C_TOOLS_SOURCE = i2c-tools-$(I2C_TOOLS_VERSION).tar.bz2
> 
> I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases
> 
>   define I2C_TOOLS_BUILD_CMDS
> 
> - $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
> 
> + $(MAKE) $(TARGET_CONFIGURE_OPTS) EXTRA="py-smbus" -C $(@D)

 Can you try if
	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
		EXTRA="py-smbus" -C $(@D)
works?

 The problem is that the PATH doesn't get propagated, so the Makefile is using
the system's python instead of buildroot's python.

 By the way, you should also add

I2C_TOOLS_DEPENDENCIES = host-python

to make sure the cross-python is built before i2c-tools.


 If you get this working, it would be nice if you could send a patch that adds
a configure option for py-smbus.


 Regards,
 Arnout

 
> 
> endef
> 
>   define I2C_TOOLS_INSTALL_TARGET_CMDS

[snip]
Thomas Weininger - June 21, 2013, 9:28 a.m.
> -----Original Message-----
> From: Arnout Vandecappelle [mailto:arnout@mind.be]
> Sent: Donnerstag, 20. Juni 2013 18:25
> To: Thomas Weininger
> Cc: buildroot@busybox.net
> Subject: Re: [Buildroot] Build error when trying to build the py-smbus
> package of i2c-tools
>
> On 20/06/13 09:18, Thomas Weininger wrote:
> > Hi,
> >
> > I'm using Buildroot Git version
> > 28ab11d7855a1b85e4be15cd9c86ad0838fa1cb1
> > from 2013-06-06. I tried to change the package/i2c-tools/i2c-tools.mk
> > in order to build an extra package called py-smbus, which is part of
> > i2c-tools but not built by default. Considering the i2c-tools README
> > http://www.lm-sensors.org/browser/i2c-tools/trunk/README?rev=6171 I
> > added EXTRA="py-smbus" to the make options.
> >
> > diff --git a/package/i2c-tools/i2c-tools.mk
> > b/package/i2c-tools/i2c-tools.mk
> >
> > index 1589d04..403b96d 100644
> >
> > --- a/package/i2c-tools/i2c-tools.mk
> >
> > +++ b/package/i2c-tools/i2c-tools.mk
> >
> > @@ -9,7 +9,7 @@ I2C_TOOLS_SOURCE =
> > i2c-tools-$(I2C_TOOLS_VERSION).tar.bz2
> >
> > I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases
> >
> >   define I2C_TOOLS_BUILD_CMDS
> >
> > - $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
> >
> > + $(MAKE) $(TARGET_CONFIGURE_OPTS) EXTRA="py-smbus" -C $(@D)
>
>  Can you try if
>       $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
>               EXTRA="py-smbus" -C $(@D)
> works?
>
>  The problem is that the PATH doesn't get propagated, so the Makefile is
> using the system's python instead of buildroot's python.
>
>  By the way, you should also add
>
> I2C_TOOLS_DEPENDENCIES = host-python
>
> to make sure the cross-python is built before i2c-tools.
>
>
>  If you get this working, it would be nice if you could send a patch that adds
> a configure option for py-smbus.
>
>
>  Regards,
>  Arnout
>
>
> >
> > endef
> >
> >   define I2C_TOOLS_INSTALL_TARGET_CMDS
>
> [snip]
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
[Thomas Weininger]

Thank you for your suggestion Arnout. I tried it out but the error stays the same:

/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /usr/bin/gcc -pthread -shared -L/home/diasemi/workspace/dialog/buildroot/output/host/lib -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -Wl,-rpath,/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include build/temp.linux-i686-2.7/smbusmodule.o -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -lpython2.7 -o build/lib.linux-i686-2.7/smbus.so
gcc: error: unrecognized command line option '-mfpu=vfpv4-d16'
gcc: error: unrecognized command line option '-mfloat-abi=hard'
error: command '/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache' failed with exit status 1

It still uses /usr/bin/gcc for building smbus.so and I am not sure if I understand why this happens. Could it be because it uses python distutils in order to start the build?

The file structure in the py-smbus subdirectory of i2c-tools is:
py-smbus/
├── Module.mk
├── README
├── setup.py
└── smbusmodule.c

From the Module.mk file:
all-python: $(INCLUDE_DIR)/linux/i2c-dev.h
        $(DISTUTILS) build

So it uses Python distutils (the setup.py) in order to build smbus.so. And it seems to me that it uses the host distutils instead of the target system's one.
If this is the problem, then the Module.mk or the setup.py will most likely need to be patched in order to use the target system toolchain?
I have not much experience in writing Makefiles or setup.py files for Buildroot, so I would very much appreciate if someone could show me where I have to make changes.
Below are the contents of the original setup.py file:

#!/usr/bin/env python

from distutils.core import setup, Extension

setup(  name="smbus",
        version="1.1",
        description="Python bindings for Linux SMBus access through i2c-dev",
        author="Mark M. Hoffman",
        author_email="mhoffman@lightlink.com",
        maintainer="Mark M. Hoffman",
        maintainer_email="linux-i2c@vger.kernel.org",
        license="GPLv2",
        url="http://lm-sensors.org/",
        ext_modules=[Extension("smbus", ["smbusmodule.c"])])

Of course I will provide a patch if I get it to work. Thank you for your assistance.

Best regards,
Thomas
Arnout Vandecappelle - June 21, 2013, 9:49 a.m.
On 21/06/13 11:28, Thomas Weininger wrote:
> Thank you for your suggestion Arnout. I tried it out but the error stays the same:
>
> /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /usr/bin/gcc -pthread -shared -L/home/diasemi/workspace/dialog/buildroot/output/host/lib -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -Wl,-rpath,/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include build/temp.linux-i686-2.7/smbusmodule.o -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib -lpython2.7 -o build/lib.linux-i686-2.7/smbus.so
> gcc: error: unrecognized command line option '-mfpu=vfpv4-d16'
> gcc: error: unrecognized command line option '-mfloat-abi=hard'
> error: command '/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache' failed with exit status 1
>
> It still uses /usr/bin/gcc for building smbus.so and I am not sure if I understand why this happens. Could it be because it uses python distutils in order to start the build?
>
> The file structure in the py-smbus subdirectory of i2c-tools is:
> py-smbus/
> ├── Module.mk
> ├── README
> ├── setup.py
> └── smbusmodule.c
>
>  From the Module.mk file:
> all-python: $(INCLUDE_DIR)/linux/i2c-dev.h
>          $(DISTUTILS) build

  Can you add 'echo $$PATH' just above the call to $(DISTUTILS), just to 
be sure that the right python will be used?  Or, in the setup.py script, add

import sys
print sys.path

to check that the host-distutils will be used.


>
> So it uses Python distutils (the setup.py) in order to build smbus.so. And it seems to me that it uses the host distutils instead of the target system's one.
> If this is the problem, then the Module.mk or the setup.py will most likely need to be patched in order to use the target system toolchain?

  Hang on, maybe you have to build host-python-setuptools first?

  Regards,
  Arnout
Thomas Weininger - June 21, 2013, 10:31 a.m.
> -----Original Message-----
> From: Arnout Vandecappelle [mailto:arnout@mind.be]
> Sent: Freitag, 21. Juni 2013 11:50
> To: Thomas Weininger
> Cc: buildroot@busybox.net
> Subject: Re: [Buildroot] Build error when trying to build the py-smbus
> package of i2c-tools
>
> On 21/06/13 11:28, Thomas Weininger wrote:
> > Thank you for your suggestion Arnout. I tried it out but the error stays the
> same:
> >
> > /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache
> > /usr/bin/gcc -pthread -shared
> > -L/home/diasemi/workspace/dialog/buildroot/output/host/lib
> > -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib
> > -Wl,-
> rpath,/home/diasemi/workspace/dialog/buildroot/output/host/usr/li
> > b -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -
> D_FILE_OFFSET_BITS=64
> > -pipe -mfpu=vfpv4-d16 -mfloat-abi=hard -O3 -D_LARGEFILE_SOURCE
> > -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I../include
> > build/temp.linux-i686-2.7/smbusmodule.o
> > -L/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib
> > -lpython2.7 -o build/lib.linux-i686-2.7/smbus.so
> > gcc: error: unrecognized command line option '-mfpu=vfpv4-d16'
> > gcc: error: unrecognized command line option '-mfloat-abi=hard'
> > error: command
> >
> '/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache'
> > failed with exit status 1
> >
> > It still uses /usr/bin/gcc for building smbus.so and I am not sure if I
> understand why this happens. Could it be because it uses python distutils in
> order to start the build?
> >
> > The file structure in the py-smbus subdirectory of i2c-tools is:
> > py-smbus/
> > ├── Module.mk
> > ├── README
> > ├── setup.py
> > └── smbusmodule.c
> >
> >  From the Module.mk file:
> > all-python: $(INCLUDE_DIR)/linux/i2c-dev.h
> >          $(DISTUTILS) build
>
>   Can you add 'echo $$PATH' just above the call to $(DISTUTILS), just to be
> sure that the right python will be used?  Or, in the setup.py script, add
>
> import sys
> print sys.path
>
> to check that the host-distutils will be used.
[Thomas Weininger]
I put 'echo $(PATH)' in the Module.mk file before the distutils call:
echo /home/diasemi/workspace/dialog/buildroot/output/host/bin:/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin:/home/diasemi/workspace/dialog/buildroot/output/host/usr/sbin/:~/bin:~/bin:~/bin:/usr/lib/mpi/gcc/openmpi/bin:/home/diasemi/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/home/diasemi/workspace/dialog/u-boot/tools:/home/diasemi/workspace/dialog/u-boot/tools:/home/diasemi/workspace/dialog/u-boot/tools
So /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/python is in PATH at this time.

And additionally I tried to print sys.path in the setup.py:
['/home/diasemi/workspace/dialog/buildroot/output/build/i2c-tools-3.1.0/py-smbus', '/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/python27.zip', '/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/python2.7', '/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/python2.7/plat-linux2', '/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/python2.7/lib-tk', '/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/python2.7/lib-old', '/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/python2.7/lib-dynload', '/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/python2.7/site-packages']
Seems also okay for me.

>
>
> >
> > So it uses Python distutils (the setup.py) in order to build smbus.so. And it
> seems to me that it uses the host distutils instead of the target system's
> one.
> > If this is the problem, then the Module.mk or the setup.py will most likely
> need to be patched in order to use the target system toolchain?
>
>   Hang on, maybe you have to build host-python-setuptools first?
[Thomas Weininger]
I can't find a python-setuptools option in the host utilities menu in Buildroot's make menuconfig. How can I build it?
However, for the target BR2_PACKAGE_PYTHON_SETUPTOOLS is set.

>
>   Regards,
>   Arnout
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
Arnout Vandecappelle - June 21, 2013, 10:48 a.m.
On 21/06/13 12:31, Thomas Weininger wrote:
>>> > >
>>> > >So it uses Python distutils (the setup.py) in order to build smbus.so. And it
>> >seems to me that it uses the host distutils instead of the target system's
>> >one.
>>> > >If this is the problem, then the Module.mk or the setup.py will most likely
>> >need to be patched in order to use the target system toolchain?
>> >
>> >   Hang on, maybe you have to build host-python-setuptools first?
> [Thomas Weininger]
> I can't find a python-setuptools option in the host utilities menu in Buildroot's make menuconfig. How can I build it?
> However, for the target BR2_PACKAGE_PYTHON_SETUPTOOLS is set.

  It's not a user-selectable host package, since it is only needed to 
build other packages.  Normally, you build it by adding it to the 
I2C_TOOLS_DEPENDENCIES variable. But you can also do it directly from the 
command line:

make host-python-setuptools
make i2c-tools-dirclean # Just to be sure
make


  Regards,
  Arnout
Thomas Weininger - June 21, 2013, 12:06 p.m.
> -----Original Message-----
> From: Arnout Vandecappelle [mailto:arnout@mind.be]
> Sent: Freitag, 21. Juni 2013 12:48
> To: Thomas Weininger
> Cc: buildroot@busybox.net
> Subject: Re: [Buildroot] Build error when trying to build the py-smbus
> package of i2c-tools
>
> On 21/06/13 12:31, Thomas Weininger wrote:
> >>> > >
> >>> > >So it uses Python distutils (the setup.py) in order to build
> >>> > >smbus.so. And it
> >> >seems to me that it uses the host distutils instead of the target
> >> >system's one.
> >>> > >If this is the problem, then the Module.mk or the setup.py will
> >>> > >most likely
> >> >need to be patched in order to use the target system toolchain?
> >> >
> >> >   Hang on, maybe you have to build host-python-setuptools first?
> > [Thomas Weininger]
> > I can't find a python-setuptools option in the host utilities menu in
> Buildroot's make menuconfig. How can I build it?
> > However, for the target BR2_PACKAGE_PYTHON_SETUPTOOLS is set.
>
>   It's not a user-selectable host package, since it is only needed to build
> other packages.  Normally, you build it by adding it to the
> I2C_TOOLS_DEPENDENCIES variable. But you can also do it directly from the
> command line:
>
> make host-python-setuptools
> make i2c-tools-dirclean # Just to be sure make
>

[Thomas Weininger]
I executed
make host-python-setuptools
make i2c-tools-dirclean
make i2c-tools-rebuild

Still the same error.

Regards
Thomas
Thomas Weininger - June 21, 2013, 12:37 p.m.
> -----Original Message-----
> From: buildroot-bounces@busybox.net [mailto:buildroot-
> bounces@busybox.net] On Behalf Of Thomas Weininger
> Sent: Freitag, 21. Juni 2013 14:07
> To: Arnout Vandecappelle
> Cc: buildroot@busybox.net
> Subject: Re: [Buildroot] Build error when trying to build the py-smbus
> package of i2c-tools
>
> > -----Original Message-----
> > From: Arnout Vandecappelle [mailto:arnout@mind.be]
> > Sent: Freitag, 21. Juni 2013 12:48
> > To: Thomas Weininger
> > Cc: buildroot@busybox.net
> > Subject: Re: [Buildroot] Build error when trying to build the py-smbus
> > package of i2c-tools
> >
> > On 21/06/13 12:31, Thomas Weininger wrote:
> > >>> > >
> > >>> > >So it uses Python distutils (the setup.py) in order to build
> > >>> > >smbus.so. And it
> > >> >seems to me that it uses the host distutils instead of the target
> > >> >system's one.
> > >>> > >If this is the problem, then the Module.mk or the setup.py will
> > >>> > >most likely
> > >> >need to be patched in order to use the target system toolchain?
> > >> >
> > >> >   Hang on, maybe you have to build host-python-setuptools first?
> > > [Thomas Weininger]
> > > I can't find a python-setuptools option in the host utilities menu
> > > in
> > Buildroot's make menuconfig. How can I build it?
> > > However, for the target BR2_PACKAGE_PYTHON_SETUPTOOLS is set.
> >
> >   It's not a user-selectable host package, since it is only needed to
> > build other packages.  Normally, you build it by adding it to the
> > I2C_TOOLS_DEPENDENCIES variable. But you can also do it directly from
> > the command line:
> >
> > make host-python-setuptools
> > make i2c-tools-dirclean # Just to be sure make
> >
>
> [Thomas Weininger]
> I executed
> make host-python-setuptools
> make i2c-tools-dirclean
> make i2c-tools-rebuild
>
> Still the same error.
>
> Regards
> Thomas
> ________________________________
>
> Dialog Semiconductor GmbH
> Neue Str. 95
> D-73230 Kirchheim
> Managing Directors: Dr. Jalal Bagherli, Jean-Michel Richard Chairman of the
> Supervisory Board: Gregorio Reyes Commercial register: Amtsgericht
> Stuttgart: HRB 231181 UST-ID-Nr. DE 811121668
>
> Legal Disclaimer: This e-mail communication (and any attachment/s) is
> confidential and contains proprietary information, some or all of which may
> be legally privileged. It is intended solely for the use of the individual or
> entity to which it is addressed. Access to this email by anyone else is
> unauthorized. If you are not the intended recipient, any disclosure, copying,
> distribution or any action taken or omitted to be taken in reliance on it, is
> prohibited and may be unlawful.
>
> Please consider the environment before printing this e-mail
>
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
[Thomas Weininger]

I've just notice something, which seem to be strange:

>>> i2c-tools 3.1.0 Building
PATH="/home/diasemi/workspace/dialog/buildroot/output/host/bin:/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin:/home/diasemi/workspace/dialog/buildroot/output/host/usr/sbin/:~/bin:~/bin:~/bin:/usr/lib/mpi/gcc/openmpi/bin:/home/diasemi/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/home/diasemi/workspace/dialog/u-boot/tools:/home/diasemi/workspace/dialog/u-boot/tools:/home/diasemi/workspace/dialog/u-boot/tools" PERLLIB="/home/diasemi/workspace/dialog/buildroot/output/host/usr/lib/perl" /usr/bin/make -j3 PATH="/home/diasemi/workspace/dialog/buildroot/output/host/bin:/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin:/home/diasemi/workspace/dialog/buildroot/output/host/usr/sbin/:~/bin:~/bin:~/bin:/usr/lib/mpi/gcc/openmpi/bin:/home/diasemi/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/home/diasemi/workspace/dialog/u-boot/tools:/home/diasemi/workspace/dialog/u-boot/tools:/
 home/diasemi/workspace/dialog/u-boot/tools" AR="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-ar" AS="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-as" LD="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-ld" NM="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-nm" CC="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc" GCC="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc" CPP="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-cpp" CXX="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /home/dias
 emi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-g++" FC="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gfortran" RANLIB="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-ranlib" READELF="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-readelf" STRIP="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-strip" OBJCOPY="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-objcopy" OBJDUMP="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccache /usr/bin/gcc" GCC_FOR_BUILD="/home/diasemi/workspace/dialog/buildroot/output/host/usr/bin/ccach
 e /usr/bin/gcc"

So CC_FOR_BUILD and GCC_FOR_BUILD point to /usr/bin/gcc. Couldn't be that the source of the errors?
But when this is wrong, why does the rest of i2c-tools build successfully?

Regards
Thomas
Thomas Petazzoni - June 21, 2013, 12:48 p.m.
Dear Thomas Weininger,

On Fri, 21 Jun 2013 12:37:33 +0000, Thomas Weininger wrote:

> So CC_FOR_BUILD and GCC_FOR_BUILD point to /usr/bin/gcc. Couldn't be that the source of the errors?
> But when this is wrong, why does the rest of i2c-tools build successfully?

CC_FOR_BUILD and GCC_FOR_BUILD are correct. As their name suggest,
those variables should point to the compiler that allows to build
things for the /build/ machine, i.e the native compiler.

	CC           => compiler to build things for the host machine
	CC_FOR_BUILD => compiler to build things for the build machine

Best regards,

Thomas

Patch

diff --git a/package/i2c-tools/i2c-tools.mk b/package/i2c-tools/i2c-tools.mk
index 1589d04..403b96d 100644
--- a/package/i2c-tools/i2c-tools.mk
+++ b/package/i2c-tools/i2c-tools.mk
@@ -9,7 +9,7 @@  I2C_TOOLS_SOURCE = i2c-tools-$(I2C_TOOLS_VERSION).tar.bz2
I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases
 define I2C_TOOLS_BUILD_CMDS
- $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
+ $(MAKE) $(TARGET_CONFIGURE_OPTS) EXTRA="py-smbus" -C $(@D)
endef
 define I2C_TOOLS_INSTALL_TARGET_CMDS