You are not logged in.

#1 2018-06-14 19:04:28

oz
Member
Registered: 2004-05-20
Posts: 102

[SOLVED] What library contains attr_get and attr_set?(undefned symbol)

These are the filesystem extended attributes functions. Consider:

test.c

#include <sys/types.h>
#include <attr/attributes.h>

int main(int argc, char* argv[])
{
   char value[255];
   int len = sizeof(value);
   attr_get("foo", "bar", value, &len, 0);
   return 0;
}

Compiling fails:

$ gcc test.c
/tmp/ccXHfmjE.o: In function `main':
test.c:(.text+0x5a): undefined reference to `attr_get'
collect2: error: ld returned 1 exit status

What gives? I can't find any library that might contain the functions under /lib /usr/lib other than libc and looking in the attr/attributes.h they don't seem to be inline either. What gives? mad

Last edited by oz (2018-06-14 22:36:46)

Offline

#2 2018-06-14 19:13:26

oz
Member
Registered: 2004-05-20
Posts: 102

Re: [SOLVED] What library contains attr_get and attr_set?(undefned symbol)

To answer my own question it's "libattr" which didn't exist (compiling 32-bit on 64-bit platform). lib32-attr has it.

Offline

#3 2018-06-14 22:17:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [SOLVED] What library contains attr_get and attr_set?(undefned symbol)

For future reference, if the problem wasn't due to needing the 32-bit library, libattr certainly does exist:

$ pac -Qo /usr/include/attr/attributes.h
/usr/include/attr/attributes.h is owned by attr 2.4.47-3

$ pac -Qlq attr | grep so$
/usr/lib/libattr.so

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2018-06-14 22:35:38

oz
Member
Registered: 2004-05-20
Posts: 102

Re: [SOLVED] What library contains attr_get and attr_set?(undefned symbol)

Handy, thanks!

Offline

Board footer

Powered by FluxBB