bugAVR Downloader/UploaDEr - Bugs: bug #41854, avrdude 6.1 does not compile on...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

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

Submitted by:  Georg von Zengen <oni>
Submitted on:  Thu 13 Mar 2014 02:05:00 PM UTC  
 
Category: NoneSeverity: 4 - Important
Priority: 5 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: Joerg Wunsch <joerg_wunsch>Originator Name: oni
Open/Closed: Closed

(Jump to the original submission Jump to the original submission)

Wed 06 Aug 2014 08:30:33 PM UTC, comment #7:

> 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).

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Wed 06 Aug 2014 07:42:53 AM UTC, comment #6:

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.)

Volker <funker211>
Mon 19 May 2014 12:33:02 PM UTC, comment #5:

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

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Fri 21 Mar 2014 12:15:38 PM UTC, comment #4:

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)

Didrik Madheden <didrikm>
Thu 13 Mar 2014 03:07:03 PM UTC, 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).

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Thu 13 Mar 2014 03:00:15 PM UTC, comment #2:

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.

Georg von Zengen <oni>
Thu 13 Mar 2014 02:34:36 PM UTC, comment #1:

Too bad. :-(

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

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

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Thu 13 Mar 2014 02:05:00 PM UTC, original submission:

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

Georg von Zengen <oni>

 

Attached Files
file #30986:  dfu.c added by didrikm (14kB - application/octet-stream - Added and fixed stubs to allow avrdude to be compiled without libusb0, without error.)
file #30987:  flip1.c added by didrikm (28kB - application/octet-stream - Added and fixed stubs to allow avrdude to be compiled without libusb0, without error.)
file #30988:  flip2.c added by didrikm (29kB - application/octet-stream - Added and fixed stubs to allow avrdude to be compiled without libusb0, without error.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by funker211 (Posted a comment)
  • -unavailable- added by didrikm (Updated the item)
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by oni (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 19 May 2014 12:33:02 PM UTCjoerg_wunschStatusNone=>Fixed
      Assigned toNone=>joerg_wunsch
      Open/ClosedOpen=>Closed
    Fri 21 Mar 2014 12:15:38 PM UTCdidrikmAttached File-=>Added dfu.c, #30986
      Attached File-=>Added flip1.c, #30987
      Attached File-=>Added flip2.c, #30988
    Thu 13 Mar 2014 03:07:03 PM UTCjoerg_wunschSeverity3 - Normal=>4 - Important

    Back to the top


    Powered by Savane 3.1-cleanup