[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] --enable-cross and libtcc1.a

From: avih
Subject: [Tinycc-devel] --enable-cross and libtcc1.a
Date: Mon, 20 Feb 2017 21:19:31 +0000 (UTC)

1. Immediate issue:
On windows, when building using a native 64 bit compiler, e.g. using:
> mkdir bld && cd bld && configure ../ --cpu=x86-64 --enable-cross && make && make install

I get the following error during install, which is ignored (`make install` returns a success code):
> install -m644 lib/x86_64-win32/libtcc1.a <prefix>"/lib/64"
> install: cannot stat `lib/x86_64-win32/libtcc1.a': No such file or directory
> make: [install] Error 1 (ignored)

And when building with a 32 bit compiler then the equivalent 32 bit libtcc1.a is missing.

While it's not critical since we have the native version anyway which is equivalent, having this error is not nice.

It's possible to just skip the native-variant cross build installl, but I think it would be simpler to just build all the cross progs, which then installs successfully. The native and cross progs and libs (for the same platform) don't clash as far as I can tell, so it doesn't hurt to just build and install all of them. It also helps that the Makefile has less exceptions, e.g. this patch solves it (note that it also adds $(I386_CROSS) which I think is accidentally missing):

diff --git a/Makefile b/Makefile
index 00d17bb..81b652d 100644
--- a/Makefile
+++ b/Makefile
@@ -97,13 +97,11 @@ C67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c
 ifdef CONFIG_WIN32
  ifeq ($(ARCH),x86_64)
-  LIBTCC1_CROSS=lib/i386-win32/libtcc1.a
-  LIBTCC1_CROSS=lib/x86_64-win32/libtcc1.a
+LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a

 else ifeq ($(ARCH),i386)

2. In general, it seems that libtcc1.a for the cross progs is only built for the windows progs, and only on x86[_64] platforms. E.g. on arm, $(CROSS_PROGS) includes the windows compilers but not their libtcc1.a, and on linux 64 there's no libtcc1.a for linux 32.

It's not entirely clear to me if libtcc1.a can be built for all the cross progs, but it does seem to me that all of them need it, and it probably cannot be expected to be available as part of the native toolchain of the cross target.

E.g. create a minimal c program with main which just returns 0 and try to compile it with all the cross compilers. All of them complain of a missing libtcc1.a (except for windows, if the native platform is x86[-64]), and most of them also complain on few missing crt?.o and libc.

E.g. on Ubuntu 64, trying to use i386-tcc to compile the test program results in (some real path shows at <prefix>):
tcc: error: file 'crt1.o' not found
tcc: error: file 'crti.o' not found
tcc: error: library 'c' not found
tcc: error: file <prefix>'/lib/tcc/i386/libtcc1.a' not found
tcc: error: file 'crtn.o' not found

I'd think that if it's possible to build libtcc1.a for more platforms, then a patch similar to the above but even more general could be useful. I.e. use as little exceptions as possible, e.g. on i386 also build cross i386, etc. It might be even possible to use the exact same set of cross progs and cross libs regardless of the host.

However, trying the above just for linux and windows, it seems that install still doesn't copy all of them, so maybe that could be generalized too.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]