On Sat, Oct 13, 2012 at 8:04 AM, Peter Stuge <[email protected]> wrote:
> Xiaofan Chen wrote:
>> If you come out with a simple instruction to cross compile
>> openocd (using libusb-1.0, libusb-win32, libftdi) with the
>> help of pkg-config under Linux, that would be helpful.
>> Thanks in advance.
>
> I don't know libusb-win32 at all well - does it also provide a .pc
> file, or no?

No. But I know it can be created pretty easily. In reality,
libusb-win32's Makefile does not even include "make install"
functionality. So you need to copy file to the tmp directory
in your case.

> libftdi uses cmake, where cross-compilation is complicated. :\

It is not that bad to cross build libftdi for Windows under Linux
but the extra Boost binding and Python binding are not easy to
build. That is why I choose to build libftdi natively under Windows
with a unofficial MinGW build (with Boost inside) and CMake.

For the purpose of openocd or urjtag, then the extra Python
binding and Boost binding do not matter.

> Here's an example for urjtag, which uses the pkg-config macros:
>
> ( export WD=/tmp/x-urjtag;
>   export CROSS=i686-mingw32;
>   export PKG_CONFIG_LIBDIR="${WD}"/lib/pkgconfig;
>   mkdir -p "${WD}"/source && \
>   cd "${WD}"/source && \
>   git clone git://git.libusb.org/libusb.git && \
>   git clone git://urjtag.git.sourceforge.net/gitroot/urjtag/urjtag && \
>   cd libusb && \
>   ./autogen.sh --prefix="${WD}" --host=$CROSS --disable-debug-log && \
>   make install && \
>   cd ../urjtag/urjtag && \
>   ./autogen.sh --prefix="${WD}" --host=$CROSS --disable-python \
>     --without-readline --with-libusb=1.0 --without-libftdi && \
>   make install && \
>   ls -l "${WD}"/*
> )

Thanks. This helps quite a bit.

> --disable-python and --without-libftdi were needed for urjtag,
> because I have neither Python nor libftdi for Windows, and the
> urjtag configure.ac tries very hard to find those optional
> dependencies. In the case of libftdi it leads to the discovery of
> libftdi-config from the libftdi-0.16 package on my build system.

That is a problem. I can accept --disable-python but --without-libftdi
will render urjtag useless for many users of urjtag. But I get what
you mean. I can cross-build libftdi and use your method and hopefully
urjtag can find it.

I will try your method to see how good/bad it is to use pkg-config
with cross.

>> As for MinGW/MSys, there is a package manager as part of
>> the installer (mingw-get) but it does not have the functionality
>> of pkg-config.
>
> Right, and pkg-config is also not related to the package manager, the
> point is that using pkg-config allows to build and install packages
> in a way that does not create unneccessary conflicts with what the
> package manager does. The example above shows a process that is
> completely contained in whatever subdirectory one wants, which also
> has the nice side-effect that everything can be done by the current
> user.

The issue with native MinGW/MSys is that it does not have pkg-config.
To install that one needs to get pkg-config and its dependencies.
The nice thing about MinGW/Msys is that it provides a nice installer
to set up a working environment. Adding pkg-config just complicates
the things. That being said, CMake is foreign to MinGW/MSys as well.



-- 
Xiaofan

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to