[#6694] bfin toolchain doesn't support ftw()?

Document created by Aaronwu Employee on Oct 17, 2013
Version 1Show Document
  • View in full screen mode

[#6694] bfin toolchain doesn't support ftw()?

Submitted By: Bob Liu

Open Date

2011-07-14 23:23:32     Close Date

2013-07-03 02:17:28

Priority:

Medium     Assignee:

Vivi Li

Stuart Henderson

Board:

N/A     Silicon Revision:

Resolution:

Fixed     Fixed In Release:

N/A

Processor:

ALL     

Host Operating System:

toolchain rev.:

git-b5d2cba) 4.3.5     kernel rev.:

State:

Closed     Found In Release:

2011R1

Is this bug repeatable?:

N/A     

Summary: bfin toolchain doesn't support ftw()?

Details:

 

I got a test file from ftw man help page but it can't compile with bfin toolchain.  

       #define _XOPEN_SOURCE 500

       #include <ftw.h>

       #include <stdio.h>

       #include <stdlib.h>

       #include <string.h>

       #include <stdint.h>

 

       static int

       display_info(const char *fpath, const struct stat *sb,

                    int tflag, struct FTW *ftwbuf)

       {

           printf("%-3s %2d %7jd   %-40s %d %s\n",

               (tflag == FTW_D) ?   "d"   : (tflag == FTW_DNR) ? "dnr" :

               (tflag == FTW_DP) ?  "dp"  : (tflag == FTW_F) ?   "f" :

               (tflag == FTW_NS) ?  "ns"  : (tflag == FTW_SL) ?  "sl" :

               (tflag == FTW_SLN) ? "sln" : "???",

               ftwbuf->level, (intmax_t) sb->st_size,

               fpath, ftwbuf->base, fpath + ftwbuf->base);

           return 0;           /* To tell nftw() to continue */

       }

 

       int

       main(int argc, char *argv[])

       {

           int flags = 0;

 

           if (argc > 2 && strchr(argv[2], 'd') != NULL)

               flags |= FTW_DEPTH;

           if (argc > 2 && strchr(argv[2], 'p') != NULL)

               flags |= FTW_PHYS;

 

           if (nftw((argc < 2) ? "." : argv[1], display_info, 20, flags)

                   == -1) {

               perror("nftw");

               exit(EXIT_FAILURE);

           }

           exit(EXIT_SUCCESS);

       }

 

The error is like this:

root@adam-desktop:~/test# bfin-linux-uclibc-gcc test.c

test.c:2:24: error: ftw.h: No such file or directory

test.c:10: warning: ‘struct FTW’ declared inside parameter list

test.c:10: warning: its scope is only this definition or declaration, which is probably not what you want

test.c:10: warning: ‘struct stat’ declared inside parameter list

test.c: In function ‘display_info’:

test.c:13: error: ‘FTW_D’ undeclared (first use in this function)

test.c:13: error: (Each undeclared identifier is reported only once

test.c:13: error: for each function it appears in.)

test.c:13: error: ‘FTW_DNR’ undeclared (first use in this function)

test.c:14: error: ‘FTW_DP’ undeclared (first use in this function)

test.c:14: error: ‘FTW_F’ undeclared (first use in this function)

test.c:15: error: ‘FTW_NS’ undeclared (first use in this function)

test.c:15: error: ‘FTW_SL’ undeclared (first use in this function)

test.c:16: error: ‘FTW_SLN’ undeclared (first use in this function)

test.c:17: error: dereferencing pointer to incomplete type

test.c:17: error: dereferencing pointer to incomplete type

test.c:18: error: dereferencing pointer to incomplete type

test.c:18: error: dereferencing pointer to incomplete type

test.c: In function ‘main’:

test.c:28: error: ‘FTW_DEPTH’ undeclared (first use in this function)

test.c:30: error: ‘FTW_PHYS’ undeclared (first use in this function)

 

Follow-ups

 

--- Mike Frysinger                                           2011-07-18 08:52:48

this is expected behavior.  we dont enable FTW support when building uClibc.  if

you want it, build uClibc yourself with something like:

./BuildToolChain ... -a UCLIBC_HAS_FTW=y ...

 

--- Stuart Henderson                                         2011-08-09 09:26:02

we now build ftw into the uclibc-full packages, which are available for download

now.

 

--- Mingquan Pan                                             2013-07-03 03:20:55

Yes,so close here.

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes