View Single Post
Old 05-23-2012, 05:16 PM   #123
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
@knc1: Here is the output that you requested, except this time I HAND-TYPED the command instead of doing it in a script:
Code:
[root@kindle tcc]# tcc -vvv -run demo.c
tcc version 0.9.25
-> demo.c
nf /usr/local/include/stdio.h
nf /usr/include/stdio.h
nf /usr/local/lib/tcc/include/stdio.h
demo.c:11: include file 'stdio.h' not found
[root@kindle tcc]# tcc -Iinclude -vvv -run demo.c
tcc version 0.9.25
-> demo.c
-> include/stdio.h
->  include/features.h
->   include/bits/predefs.h
->   include/sys/cdefs.h
->    include/bits/wordsize.h
->   include/gnu/stubs.h
->  include/stddef.h
->  include/bits/types.h
->   include/bits/wordsize.h
->   include/bits/typesizes.h
->  include/libio.h
->   include/_G_config.h
->    include/wchar.h
->     include/bits/wchar.h
->    include/gconv.h
->     include/wchar.h
->   include/stdarg.h
->  include/bits/stdio_lim.h
->  include/bits/sys_errlist.h
-> include/stdlib.h
->  include/sys/types.h
->   include/time.h
->   include/endian.h
->    include/bits/endian.h
->   include/sys/select.h
->    include/bits/select.h
->    include/bits/sigset.h
->    include/time.h
->    include/bits/time.h
->   include/sys/sysmacros.h
->   include/bits/pthreadtypes.h
->  include/alloca.h
-> include/string.h
-> include/unistd.h
->  include/bits/posix_opt.h
->  include/bits/confname.h
->  include/getopt.h
-> include/fcntl.h
->  include/bits/fcntl.h
-> include/time.h
->  include/bits/time.h
-> include/sys/mman.h
->  include/bits/mman.h
-> include/sys/ioctl.h
->  include/bits/ioctls.h
->   include/asm/ioctls.h
->    include/asm/ioctl.h
->     include/asm-generic/ioctl.h
->  include/bits/ioctl-types.h
->  include/sys/ttydefaults.h
-> include/linux/fb.h
->  include/linux/types.h
->   include/asm/types.h
->   include/linux/posix_types.h
->    include/linux/stddef.h
->     include/linux/compiler.h
->    include/asm/posix_types.h
->  include/linux/i2c.h
nf /usr/local/lib/libc.so
-> /usr/lib/libc.so
-> /lib/libc.so.6
nf /usr/lib/libc_nonshared.a
tcc: file '/usr/lib/libc_nonshared.a' not found
-> /lib/libgcc_s.so.1
[root@kindle tcc]# 
The "nf" (not found) errors (marked in red) were because the bind mount is only done while the tccmake script is running. The library is loaded correctly if you type a bind mount command just like is done in the tccmake script. Although tcc looks in two different places, you only need to bind mount one of them to replace the library loader script with a simpler version.

As you can see, you also need to provide the path to the include directory. The tccmake script does this command:

tcc -I/mnt/us/tcc/include -o $1 $2 $3 $4 $5 $6 $7 $8 $9 $1.c


If you look at the rest of the tccmake script, you will see that it calls tcc with your parameters AND does the other things needed for a successful compile (including the bind mounts).

EDIT: As you can see, when searching for missing libraries it first looks in /usr/local/lib and then in /usr/lib. The reason I bind mount to /usr/lib is because that is where OTHER (correct) library symlinks can be found on the kindle, AND because some recent firmware deletes the /usr/local directory.

Last edited by geekmaster; 05-23-2012 at 06:15 PM.
geekmaster is offline   Reply With Quote