[bug #41854] avrdude 6.1 does not compile on systems without libUSB

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
URL:
  <http://savannah.nongnu.org/bugs/?41854>

                 Summary: avrdude 6.1 does not compile on systems without
libUSB
                 Project: AVR Downloader/UploaDEr
            Submitted by: oni
            Submitted on: Do 13 Mär 2014 14:05:00 GMT
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: oni
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I just tried to compile arvdude 6.1 on mac OSX and it failed.
On the system libUSB is installed but not found by the configure script.
I also try to quick fix this issue by equalizing the definitions of dfu_open
and init in the .c and .h. That leaded me into even bigger problems because
the dfu_dev struct is empty if libUSB is not installed/found.
 
relevant part of make output:
mv -f .deps/libavrdude_a-crc16.Tpo .deps/libavrdude_a-crc16.Po
gcc -DHAVE_CONFIG_H -I.  -DCONFIG_DIR="/usr/local/etc"  -Wall  -g -O2 -MT
libavrdude_a-dfu.o -MD -MP -MF .deps/libavrdude_a-dfu.Tpo -c -o
libavrdude_a-dfu.o `test -f 'dfu.c' || echo './'`dfu.c
dfu.c:39:5: error: conflicting types for 'dfu_open'
int dfu_open(struct dfu_dev *dfu, char *port_name) {
    ^
./dfu.h:117:25: note: previous declaration is here
extern struct dfu_dev * dfu_open(char *port_spec);
                        ^
dfu.c:45:5: error: conflicting types for 'dfu_init'
int dfu_init(struct dfu_dev *dfu, unsigned short usb_pid) {
    ^
./dfu.h:118:12: note: previous declaration is here
extern int dfu_init(struct dfu_dev *dfu,
           ^
2 errors generated.
make[2]: *** [libavrdude_a-dfu.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
Follow-up Comment #1, bug #41854 (project avrdude):

Too bad. :-(

Where does your libusb come from?  If it's from macports, try


env CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib ./configure


Just tested it that way, and at the very least, it compiles then.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
Follow-up Comment #2, bug #41854 (project avrdude):

Thanks for the quick answer. It fixes my problem.
But this does not fix the problem for systems without libUSB.
I think a lot more ifdefs has to be added to fix the problem or libUSB has to
become mandatory to compile avrdude.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
Update of bug #41854 (project avrdude):

                Severity:              3 - Normal => 4 - Important          

    _______________________________________________________

Follow-up Comment #3:

> But this does not fix the problem for systems without libUSB.

Sure, the bug report remains valid, and stays open.  Builds
without libusb should certainly be supported, albeit I guess
they are getting fairly rare these days (maybe with some more
exotic exceptions like installations using direct GPIO on a
Raspberry Pi or such).

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
Follow-up Comment #4, bug #41854 (project avrdude):

Luckily, this can be fixed by stubbing only 3 files, dfu.c, and flip1.c and
flip2.c which both depend on dfu.c.

dfu.c already had stubs for #ifndef HAVE_LIBUSB, replacing the libusb
function, but those didn't match the exports. Fixed this.

Stubbed the external functions in flip1.c and flip2.c completely for the
ifndef case, as they touch USB internals and ultimately rely on structs
defined in the libusb headers. Maybe it would be better to duplicate
flip1/2_initpgm into the ifndef case and only provide a stub for pgm->open,
but in case this is bad form, I left stubs for all the functions.

(file #30986, file #30987, file #30988)
    _______________________________________________________

Additional Item Attachment:

File name: dfu.c                          Size:14 KB
File name: flip1.c                        Size:27 KB
File name: flip2.c                        Size:28 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
Update of bug #41854 (project avrdude):

                  Status:                    None => Fixed                  
             Assigned to:                    None => joerg_wunsch          
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #5:

Fixed in r1314, thanks for reporting, and for suggesting a fix!

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
Follow-up Comment #6, bug #41854 (project avrdude):

Let me allow to ask a - possibly dumb - follow-up question. I tried to compile
avrdude-6.1 under MinGW (latest version running under Win 7) and came across
the reported bug, although I do have the libusb installed, however in version
1.0.9, so flag HAVE_LIBUSB is not defined or set, but HAVE_LIBUSB_1_0 is set.

I would expect that I can use EITHER libusb-0.1.x or libusb-1.x.x and that
once I use ONE of them, USB support is present. Is that correct?

If that is correct, does libusb-1.x.x not require the code in flip1.c and
flip2.c and dfu.c, so that my compile should actually work, as USB support is
present? Or are these files only required for libusb-0.1.x?

Same question for libftdi: I assume I require just ONE of the libraries,
EITHER libftdi OR libftdi1?

What happens if I install both (in parallel), in both cases?

Is pthread actually required or of great advantage?

My Configuration summary:
-------------------------
DO HAVE    libelf
DON'T HAVE libusb
DO HAVE    libusb_1_0
DON'T HAVE libftdi1
DON'T HAVE libftdi
DO HAVE    libhid
DON'T HAVE pthread
ENABLED    doc
ENABLED    parport
DISABLED   linuxgpio

(I did not manage to compile libftdi1 without errors, so I tried without
FTDI-support, as I only require AVRDUDE to run with JTAG ICE 3.)

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

Re: [bug #41854] avrdude 6.1 does not compile on systems without libUSB

Hannes Weisbach-2
Hello,

> Let me allow to ask a - possibly dumb - follow-up question. I tried to compile
> avrdude-6.1 under MinGW (latest version running under Win 7) and came across
> the reported bug, although I do have the libusb installed, however in version
> 1.0.9, so flag HAVE_LIBUSB is not defined or set, but HAVE_LIBUSB_1_0 is set.
>
> I would expect that I can use EITHER libusb-0.1.x or libusb-1.x.x and that
> once I use ONE of them, USB support is present. Is that correct?
That's correct.

> If that is correct, does libusb-1.x.x not require the code in flip1.c and
> flip2.c and dfu.c, so that my compile should actually work, as USB support is
> present? Or are these files only required for libusb-0.1.x?
I don't know. Maybe someone else can say something about this.

> Same question for libftdi: I assume I require just ONE of the libraries,
> EITHER libftdi OR libftdi1?
Exactly one, correct.

> What happens if I install both (in parallel), in both cases?
It will compile, but probably not work (It didn't for me).  Both
libraries share some symbols and a mixture of both code from both
libraries will likely be used.

> Is pthread actually required or of great advantage?
As far as is know, it was only needed for ftdi_syncbb.  Not sure, if
that is still the case, though.

--
HTH,
Hannes

_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev

signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[bug #41854] avrdude 6.1 does not compile on systems without libUSB

Kevin Cuzner-2
In reply to this post by Kevin Cuzner-2
Follow-up Comment #7, bug #41854 (project avrdude):

> I would expect that I can use EITHER libusb-0.1.x or
> libusb-1.x.x and that once I use ONE of them, USB
> support is present. Is that correct?

Nope, usb_libusb.c (which wraps USB access for the Atmel tools)
requires just USB_LIBUSB (i.e., libusb-0.1) support to be
present.  The reasons are:

* libusb-0.1 API is more universally available; last I've heard, OpenSolaris
(or its successors) don't have the libusb-1.0 API at all
* except for more work rewriting our implementation ;), we wouldn't gain much
by switching the API
* all libusb-1.0 implementations known do offer a 0.1 API compatibility
wrapper anyway

So the latter is where you'd have to look for on MinGW32.
All I can tell you is that I'm using MinGW32-Crosstools under
FreeBSD to build the "official" Win32 binaries, and it works
there.

DFU support (which is the layer below FLIP) also uses the
libusb-0.1 API.

As Hannes already mentioned, pthreads are by now only used by
the FT245 implementation (low-level bitbang using FTDI FT245
chips).

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41854>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev