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 authentication level.

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

Submitter:  Georg von Zengen <oni>
Submitted:  Thu 13 Mar 2014 02:05:00 PM UTC
   
 
Category:  None Severity:  4 - Important
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  joerg_wunsch Originator Name:  oni
Open/Closed:  Closed Release:  None
Programmer hardware:  Device type: 

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>
Group administrator
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>
Group administrator
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>
Group administrator
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


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.

Joerg Wunsch <joerg_wunsch>
Group administrator
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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #30986:  dfu.c added by didrikm (14KiB - application/octet-stream - Added and fixed stubs to allow avrdude to be compiled without libusb0, without error.)
file #30987:  flip1.c added by didrikm (28KiB - application/octet-stream - Added and fixed stubs to allow avrdude to be compiled without libusb0, without error.)
file #30988:  flip2.c added by didrikm (29KiB - 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
  • -email is unavailable- added by funker211 (Posted a comment)
  • -email is unavailable- added by didrikm (Updated the item)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by oni (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-05-19 joerg_wunsch StatusNone Fixed
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed
    2014-03-21 didrikm Attached File- Added dfu.c, #30986
        Attached File- Added flip1.c, #30987
        Attached File- Added flip2.c, #30988
    2014-03-13 joerg_wunsch Severity3 - Normal 4 - Important

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code