Page 1 of 1
bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclared
Posted: Wed May 15, 2013 5:28 am
by gorge_alan_sw
Hi,
I am using Raspbian distribution, for RPi.
I am compiling a package on Raspbian. Where i use to get the following error.
error: 'AT_SYMLINK_NOFOLLOW' undeclared
this constant is defined in following file :---
http://lxr.free-electrons.com/source/in ... cntl.h#L44
Is there some bug with Raspbian
Code: Select all
[ 37%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_read_disk_posix.c.o
/home/ignite/rpi_package_sb2/cmake-2.8.10.2/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c: In function 'tree_current_lstat':
/home/ignite/rpi_package_sb2/cmake-2.8.10.2/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c:2139:7: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
/home/ignite/rpi_package_sb2/cmake-2.8.10.2/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c:2139:7: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_read_disk_posix.c.o] Error 1
make[1]: *** [Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/all] Error 2
make: *** [all] Error 2
Please suggest.
//Allan
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 1:22 am
by jojopi
Cannot reproduce. cmake-2.8.10.2 compiles correctly out of the box for me on Raspbian. You have not indicated whether you configured cmake unusually or if it was compiling as part of some other package. Without knowing exactly what you downloaded and what you typed, it is hard to speculate whether your results were unexpected.
You should be able to rule out any problem with the header files in your image with a simple test program:
Code: Select all
#include <stdio.h>
#include <fcntl.h>
int main()
{
printf("%d\n", AT_SYMLINK_NOFOLLOW);
return 0;
}
If you are not familiar with troubleshooting compile errors then using the binary package manager, apt-get, is recommended. cmake at least is in the Raspbian repositories, and installing it is much faster than compiling from source.
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 8:34 am
by gorge_alan_sw
Thanks for replying :--
Cannot reproduce. cmake-2.8.10.2 compiles correctly out of the box for me on Raspbian.
I have only configured
./configure --prefix=/usr & then make.
I compiled following program :----
Code: Select all
#define _ATFILE_SOURCE
#include <sys/stat.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("%d\n", AT_SYMLINK_NOFOLLOW);
return 0;
}
Error i got :------
Code: Select all
$ gcc -c fcnt_file.c
fcnt_file.c: In function 'main':
fcnt_file.c:6:20: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
fcnt_file.c:6:20: note: each undeclared identifier is reported only once for each function it appears in
ignite@ignite:~/rpi_package_sb2/test/4$ gedit /var/local/rpi/rfs_raspbian/home/pi/.bashrc
ignite@ignite:~/rpi_package_sb2/test/4$
/usr/include/fcntl.h ----------> contains file ---> # include <bits/stat.h>
stat.h ----> file is in following location ----->
/usr/include/arm-linux-gnueabihf/bits/stat.h
stat.h file contains this Macro ----> AT_SYMLINK_NOFOLLOW
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 9:09 am
by rurwin
If the macro is in bits/stat.h, why did you include sys/stat.h ?
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 9:11 am
by jojopi
Both "man 2 fstatat" and
POSIX say that the AT_* macros are defined in <fcntl.h>.
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 10:31 am
by gorge_alan_sw
Both "man 2 fstatat" and POSIX say that the AT_* macros are defined in <fcntl.h>.
But if you will see RPI wheezy image it is like what i have mentioned .
/usr/include/fcntl.h ----------> contains file ---> # include <bits/stat.h>
stat.h ----> file is in following location -----> /usr/include/arm-linux-gnueabihf/bits/stat.h
stat.h file contains this Macro ----> AT_SYMLINK_NOFOLLOW
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 10:54 am
by fbutler
gorge_alan_sw wrote:Both "man 2 fstatat" and POSIX say that the AT_* macros are defined in <fcntl.h>.
But if you will see RPI wheezy image it is like what i have mentioned .
/usr/include/fcntl.h ----------> contains file ---> # include <bits/stat.h>
stat.h ----> file is in following location -----> /usr/include/arm-linux-gnueabihf/bits/stat.h
stat.h file contains this Macro ----> AT_SYMLINK_NOFOLLOW
Here's what I see on Raspian:
Code: Select all
pi@raspberrypi /usr/include $ uname -a
Linux raspberrypi 3.6.11+ #446 PREEMPT Fri May 10 20:17:25 BST 2013 armv6l Ginux
pi@raspberrypi /usr/include $ sudo find . -type f -name "*.h" -exec grep AT_SYMLINK_NOFOLLOW {} \; -print
# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
./arm-linux-gnueabihf/bits/fcntl.h
#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
./linux/fcntl.h
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 11:54 am
by gorge_alan_sw
Both the folder are inside /usr :--
Code: Select all
usr/arm-linux-gnueabihf/bits/
usr/linux/
/usr/include is the standard path to search for the include directories.
Does compiler search for directory & subdirectories inside /usr/include also

Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 12:36 pm
by fbutler
gorge_alan_sw wrote:Both the folder are inside /usr :--
Code: Select all
usr/arm-linux-gnueabihf/bits/
usr/linux/
/usr/include is the standard path to search for the include directories.
Does compiler search for directory & subdirectories inside /usr/include also

I believe so. See
http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
Add a -v option to your compile flags and you should see the directories being search for #includes.
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 12:37 pm
by rurwin
gorge_alan_sw wrote:Both the folder are inside /usr :--
Code: Select all
usr/arm-linux-gnueabihf/bits/
usr/linux/
fbutler wrote:/usr/include ... ./arm-linux-gnueabihf/bits/fcntl.h
The files are in /usr/
include/arm-linux-gnueabihf/bits/ and /usr/
include/linux.
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 1:43 pm
by gorge_alan_sw
The files are in /usr/include/arm-linux-gnueabihf/bits/ and /usr/include/linux.
yes
i am getting same error ...
My makefile :---
Code: Select all
CXX = g++
CC = gcc
OBJS = fcnt_file.o
CFLAGS_TEMP = -v -I/usr/include/arm-linux-gnueabihf/sys/
all: fcnt_file
#http://darkautism.blogspot.in/2010/10/undefined-reference-to-compctxfree.html
widget: fcnt_file.o
$(CXX) -o widget widget.o
#$(LIBRARY_TO_LINK)
widget.o :%.o: %.c
$(CXX) -c $(CFLAGS_TEMP) $< -o $@
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 3:20 pm
by rurwin
gorge_alan_sw wrote:Code: Select all
CFLAGS_TEMP = -v -I/usr/include/arm-linux-gnueabihf/sys/
You are making the same mistake again. The file is in the directory
bits, yet you are including the directory
sys. Unless you are doing that to include a different file, you are including the wrong directory.
And your makefile has no instructions for making
fcnt_file, so it will use the default rules, and none of the rules you have in the file. That probably includes not using the CFLAGS_TEMP macro at all. The last rule looks like you tried to make it generic, but I think it is invalid and you need to remove the "widget.o:" from the beginning.
Re: bug in raspbian -- error: 'AT_SYMLINK_NOFOLLOW' undeclar
Posted: Thu May 16, 2013 3:26 pm
by jojopi
gorge_alan_sw wrote:CFLAGS_TEMP = -v -I/usr/include/arm-linux-gnueabihf/sys/
Does the
correct version of the test program fail to compile? If so, your image is broken and you need to replace it or reinstall the relevant packages.
Otherwise, you just need to fix the thing that you are actually compiling to include the correct headers.
Either way, you should
not need to mess with the include paths, or include, or know about, the underlying headers of your implementation such as bits/*.h. Just include the headers that the
documentation tells you to.