New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling with tcc (TinyC Compiler) #132
Comments
This is the build script: name=strace
version=5.4
release=1
source="https://github.com/strace/strace/releases/download/v$version/$name-$version.tar.xz"
build() {
cd $name-$version
./configure \
--prefix=/usr \
--enable-mpers=no
make
make DESTDIR="$PKG" install
} |
On Fri, Apr 10, 2020 at 02:34:36AM -0700, James Mills wrote:
When I try to compile with `tcc` it ends with this error:
```sh
echo '} struct_printers;' >> printers.h-t
echo 'extern const struct_printers *printers;' >> printers.h-t
echo '#define MPERS_PRINTER_NAME(printer_name) printers->printer_name' >> printers.h-t
mv printers.h-t printers.h
for f in linux/32/syscallent.h linux/64/syscallent.h linux/aarch64/syscallent.h linux/aarch64/syscallent1.h linux/alpha/syscallent.h linux/arc/syscallent.h linux/arm/syscallent.h linux/avr32/syscallent.h linux/bfin/syscallent.h linux/csky/syscallent.h linux/hppa/syscallent.h linux/i386/syscallent.h linux/ia64/syscallent.h linux/m68k/syscallent.h linux/metag/syscallent.h linux/microblaze/syscallent.h linux/mips/syscallent-n32.h linux/mips/syscallent-n64.h linux/mips/syscallent-o32.h linux/mips/syscallent.h linux/nios2/syscallent.h linux/or1k/syscallent.h linux/powerpc/syscallent.h linux/powerpc64/syscallent.h linux/powerpc64/syscallent1.h linux/powerpc64le/syscallent.h linux/riscv64/syscallent.h linux/s390/syscallent.h linux/s390x/syscallent.h linux/s390x/syscallent1.h linux/sh/syscallent.h linux/sh64/syscallent.h linux/sparc/syscallent.h linux/sparc64/syscallent.h linux/sparc64/syscallent1.h linux/subcall.h linux/syscallent-common-32.h linux/syscallent-common.h linux/tile/syscallent.h linux/tile/syscallent1.h linux/x32/syscallent.h linux/x32/syscallent1.h linux/x86_64/syscallent.h linux/x86_64/syscallent1.h linux/xtensa/syscallent.h; do cat -- $f; done | \
D="" \
./generate_sen.sh > sen.h
for f in access.c affinity.c aio.c alpha.c basic_filters.c bind.c bjm.c block.c bpf.c bpf_filter.c bpf_seccomp_filter.c bpf_sock_filter.c btrfs.c cacheflush.c capability.c chdir.c chmod.c clone.c copy_file_range.c count.c delay.c desc.c dirent.c dirent64.c dm.c dyxlat.c epoll.c error_prints.c evdev.c evdev_mpers.c eventfd.c execve.c fadvise.c fallocate.c fanotify.c fchownat.c fcntl.c fetch_bpf_fprog.c fetch_struct_flock.c fetch_struct_keyctl_kdf_params.c fetch_struct_mmsghdr.c fetch_struct_msghdr.c fetch_struct_stat.c fetch_struct_stat64.c fetch_struct_statfs.c fetch_struct_xfs_quotastat.c file_handle.c file_ioctl.c filter_qualify.c filter_seccomp.c flock.c fs_x_ioctl.c fsconfig.c fsmount.c fsopen.c fspick.c futex.c get_personality.c get_robust_list.c getcpu.c getcwd.c getrandom.c hdio.c hostname.c inotify.c inotify_ioctl.c io.c io_uring.c ioctl.c ioperm.c iopl.c ioprio.c ipc_msg.c ipc_msgctl.c ipc_sem.c ipc_shm.c ipc_shmctl.c kcmp.c kexec.c keyctl.c kvm.c ldt.c link.c listen.c lookup_dcookie.c loop.c lseek.c mem.c membarrier.c memfd_create.c mknod.c mmap_notify.c mmsghdr.c mount.c move_mount.c mq.c msghdr.c mtd.c nbd_ioctl.c net.c netlink.c netlink_crypto.c netlink_inet_diag.c netlink_kobject_uevent.c netlink_netfilter.c netlink_netlink_diag.c netlink_packet_diag.c netlink_route.c netlink_selinux.c netlink_smc_diag.c netlink_sock_diag.c netlink_unix_diag.c nlattr.c nsfs.c numa.c number_set.c oldstat.c open.c open_tree.c or1k_atomic.c pathtrace.c perf.c perf_ioctl.c personality.c pidfd_open.c pkeys.c poll.c prctl.c print_aio_sigset.c print_dev_t.c print_group_req.c print_ifindex.c print_instruction_pointer.c print_kernel_version.c print_mac.c print_mq_attr.c print_msgbuf.c print_sg_req_info.c print_sigevent.c print_statfs.c print_struct_stat.c print_time.c print_timespec.c print_timespec32.c print_timespec64.c print_timeval.c print_timeval64.c print_timex.c printmode.c printrusage.c printsiginfo.c process.c process_vm.c ptp.c ptrace_syscall_info.c quota.c random_ioctl.c readahead.c readlink.c reboot.c renameat
sed -n 's/^SYS_FUNC(.*/extern &;/p' $f; \
done | sort -u > sys_func.h
tcc -E -P -DHAVE_CONFIG_H -I./linux/x86_64 -I./linux/x86_64 -I./linux -I./linux -I. -I. -include config.h linux/x86_64/syscallent.h -o syscallent.i
tcc: erro
make: *** [Makefile:9840: syscallent.i] Error 1
rm ioctlsort0 ioctlsort1.o ioctlsort2 ioctlsort0.o ioctls_all0.h ioctlsort2.o ioctls_all2.h ioctls_all1.h ioctlsort1
#
```
It's not clear to me what specifiaclly is an 'unrecognized file type"
Sorry, the error message ```tcc: erro``` is too cryptic.
|
I think this was a bad copy/paste :/ -- Actually the
This is a bit strange; most other software respects the This is the
|
On Mon, Apr 20, 2020 at 7:15 AM James Mills ***@***.***> wrote:
I think this was a bad copy/paste :/ -- Actually the ./configure script doesn't even handle setting the CC env var very well :/
configure: looking for a C compiler that generates native executables
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/strace/build/src/strace-5.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
CC_FOR_BUILD has to be supplied with a path to a C compiler that
generates build architecture executables.
…--
Eugene Syromyatnikov
mailto:evgsyr@gmail.com
xmpp:esyr@jabber.{ru|org}
|
is that a standard env var for this type of thing? |
Okay I added this to the. build and now I get the original error I was trying to show here before:
|
On Mon, Apr 20, 2020 at 8:07 AM James Mills ***@***.***> wrote:
Okay I added this to the. build and now I get the original error I was trying to show here before:
mv native_printer_defs.h-t native_printer_defs.h
tcc -E -P -DHAVE_CONFIG_H -I./linux/x86_64 -I./linux/x86_64 -I./linux -I./linux -I. -I. -include config.h linux/x86_64/syscallent.h -o syscallent.i
tcc: error: unrecognized file type
It seems that tcc treats the input file as binary[1][2], and it does
so because file type detection[3] (which is in place for some reason)
doesn't treat *.h as a C source. Since the command in question
explicitly has the -E option, I'd say it's a bug on tcc's part.
[1] https://repo.or.cz/tinycc.git/blob/HEAD:/libtcc.c#l1055
[2] https://repo.or.cz/tinycc.git/blob/HEAD:/libtcc.c#l1101
[3] https://repo.or.cz/tinycc.git/blob/HEAD:/libtcc.c#l1126
…--
Eugene Syromyatnikov
mailto:evgsyr@gmail.com
xmpp:esyr@jabber.{ru|org}
|
Thanks! I'll look into this further! Thanks for the clarification. |
On Mon, Apr 20, 2020 at 8:05 AM James Mills ***@***.***> wrote:
CC_FOR_BUILD has to be supplied with a path to a C compiler that
is that a standard env var for this type of thing?
…--
Eugene Syromyatnikov
mailto:evgsyr@gmail.com
xmpp:esyr@jabber.{ru|org}
|
When I try to compile with
tcc
it ends with this error:It's not clear to me what specifiaclly is an 'unrecognized file type"
Is strace known to compile successfully with
tcc
?The text was updated successfully, but these errors were encountered: