Using fopen () fclose ()
Posted: Sat May 28, 2016 10:57 pm
I need to use the functions of file I/O, fclose fopen () write and read to files in esp8266 sdk firmware, but when compiling my program it presents the error:
/../../..//sdk/lib/libcirom.a(lib_a-fclose.o):(.irom0.literal+0x0): undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-fclose.o): In function `_fclose_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fclose.c:102: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fclose.c:104: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fclose.c:106: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-fflush.o): In function `__sflush_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fflush.c:162: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-findfp.o):(.irom0.literal+0x4): undefined reference to `_malloc_r'
../../../..//sdk/lib/libcirom.a(lib_a-findfp.o): In function `__sfmoreglue':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/findfp.c:88: undefined reference to `_malloc_r'
../../../..//sdk/lib/libcirom.a(lib_a-fopen.o):(.irom0.literal+0x0): undefined reference to `_open_r'
../../../..//sdk/lib/libcirom.a(lib_a-fopen.o): In function `_fopen_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fopen.c:141: undefined reference to `_open_r'
../../../..//sdk/lib/libcirom.a(lib_a-fseeko.o):(.irom0.literal+0xc): undefined reference to `_fstat_r'
../../../..//sdk/lib/libcirom.a(lib_a-fseeko.o): In function `_fseeko_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:231: undefined reference to `_fstat_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:258: undefined reference to `_fstat_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:313: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:335: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:362: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-makebuf.o): In function `__smakebuf_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/makebuf.c:59: undefined reference to `_fstat_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/makebuf.c:95: undefined reference to `_malloc_r'
../../../..//sdk/lib/libcirom.a(lib_a-refill.o): In function `__srefill_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/refill.c:88: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0x4): undefined reference to `_read_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0x8): undefined reference to `_lseek_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0xc): undefined reference to `_write_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0x10): undefined reference to `_close_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__sread':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:48: undefined reference to `_read_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__swrite':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:89: undefined reference to `_lseek_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:97: undefined reference to `_write_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__sseek':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:117: undefined reference to `_lseek_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__sclose':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:135: undefined reference to `_close_r'
../../../..//sdk/lib/libcirom.a(isatty.o): In function `_isatty_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/sys/xtensa/isatty.c:13: undefined reference to `_fstat_r'
collect2: error: ld returned 1 exit status
../../../..//scripts/Makefile:154: recipe for target 'build/app.out' failed
Thanks
/../../..//sdk/lib/libcirom.a(lib_a-fclose.o):(.irom0.literal+0x0): undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-fclose.o): In function `_fclose_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fclose.c:102: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fclose.c:104: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fclose.c:106: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-fflush.o): In function `__sflush_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fflush.c:162: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-findfp.o):(.irom0.literal+0x4): undefined reference to `_malloc_r'
../../../..//sdk/lib/libcirom.a(lib_a-findfp.o): In function `__sfmoreglue':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/findfp.c:88: undefined reference to `_malloc_r'
../../../..//sdk/lib/libcirom.a(lib_a-fopen.o):(.irom0.literal+0x0): undefined reference to `_open_r'
../../../..//sdk/lib/libcirom.a(lib_a-fopen.o): In function `_fopen_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fopen.c:141: undefined reference to `_open_r'
../../../..//sdk/lib/libcirom.a(lib_a-fseeko.o):(.irom0.literal+0xc): undefined reference to `_fstat_r'
../../../..//sdk/lib/libcirom.a(lib_a-fseeko.o): In function `_fseeko_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:231: undefined reference to `_fstat_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:258: undefined reference to `_fstat_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:313: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:335: undefined reference to `_free_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/fseeko.c:362: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-makebuf.o): In function `__smakebuf_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/makebuf.c:59: undefined reference to `_fstat_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/makebuf.c:95: undefined reference to `_malloc_r'
../../../..//sdk/lib/libcirom.a(lib_a-refill.o): In function `__srefill_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/refill.c:88: undefined reference to `_free_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0x4): undefined reference to `_read_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0x8): undefined reference to `_lseek_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0xc): undefined reference to `_write_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o):(.irom0.literal+0x10): undefined reference to `_close_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__sread':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:48: undefined reference to `_read_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__swrite':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:89: undefined reference to `_lseek_r'
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:97: undefined reference to `_write_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__sseek':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:117: undefined reference to `_lseek_r'
../../../..//sdk/lib/libcirom.a(lib_a-stdio.o): In function `__sclose':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/stdio/stdio.c:135: undefined reference to `_close_r'
../../../..//sdk/lib/libcirom.a(isatty.o): In function `_isatty_r':
/home/wjg/Repo/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/sys/xtensa/isatty.c:13: undefined reference to `_fstat_r'
collect2: error: ld returned 1 exit status
../../../..//scripts/Makefile:154: recipe for target 'build/app.out' failed
Thanks