[pacman-dev] macros needed when using libalpm

jjacky i.am.jack.mail at gmail.com
Wed Feb 15 11:27:12 EST 2012

Alright, thanks a lot.


On 02/15/12 14:47, Dan McGee wrote:
> On Wed, Feb 15, 2012 at 7:30 AM, jjacky <i.am.jack.mail at gmail.com> wrote:
>> Hi,
>> Just a quick question, it might be pretty obvious but I'm still
>> relatively new at this, so excuse my "noobness."
>> While working on a little app using libalpm, I wanted to use the
>> download callback. But I had a problem, because the total size would
>> always be zero. I didn't understand why it didn't work, especially since
>> it did for pacman, which seemed to do exactly the same as I did.
>> After investigation, I figured out that this was because I needed to use
>> a macro when compiling, namely:
>> #define _FILE_OFFSET_BITS 64
>> Apparently one of the things this does is turn off_t (type of both size
>> parameters of the dl callback, among other things) into off64_t. I'm
>> guessing that means one more byte to store the data, and therefore
>> explains why with my "regular" off_t I didn't get the correct values.
>> Thing is, I'm not sure how I was supposed to know that using this macro
>> was required of me in order to get things to work properly, so my
>> questions are:
>> - how was I supposed to know? :) As in, is there any indication or
>> something about this written somewhere that I missed? I did look at the
>> README and such, but couldn't find anything. (and if not, shouldn't
>> there be, maybe?)
>> Or is this just usual/common knowledge or something?
> This is
> 1) only necessary on 32-bit platforms
> 2) an unfortunate hack
> 3) widely known, for the most part- 99% of apps are compiled with this
> because 32-bits is not enough to have anything > 2GiB signed, or >4
> GiB unsigned.
>> - any chance there is/are other such things I need to use for things to
>> work properly? I'm guessing not, but just in case...
> Don't think so. Your best bet is to look at the pacman side of things
> as a reference, in addition to the configure.ac file and the generated
> config.h.
> -Dan

More information about the pacman-dev mailing list