History

tcc.h: Extend search path for include, lib and crt

This allow the tcc cross compilers to work as expected, when tcc was build with '--enable-cross' and a simple config-extra.mak (see the provided config-extra.mak.example). Make sure, that cross development packages for libc are installed Fixes also open bugs in various bug tracker. Example in debian: 940469 tcc: error: library 'c' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf'

Detlef Riekenberg committed 4 years ago

Commit 2507c711 parent fa256302 files · +34 −1Browse files

Unified · Split

2 files
  1. config-extra.mak.example +27 −0
  2. tcc.h +7 −1
config-extra.mak.example+27−0
@@ -0,0 +1,27 @@
1+#
2+# during 'make', this file is included from the tcc Makefile
3+#
4+# this is an example, how to help tcc to find
5+# the c library and the startup files for cross compiling.
6+#
7+# we expect here, that the GNU libc is used and that the related development files
8+# are installed in a subdirectory with the target triplet used by gcc
9+#
10+
11+# set CONFIG_TRIPLET for cross compiler targets
12+DEF-i386+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i386-linux-gnu\" "
13+DEF-x86_64+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-linux-gnu\" "
14+
15+# many api/fp combinations are possible for arm
16+DEF-arm+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"arm-linux-gnueabihf\" "
17+DEF-arm64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-linux-gnu\" "
18+
19+DEF-riscv64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"riscv64-linux-gnu\" "
20+# For win32/win64 targets, we expect mingw 64
21+# is is for additional packes, as tcc has ist own win32 startfiles
22+DEF-i386-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i686-w64-mingw32\" "
23+DEF-x86_64-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-w64-mingw32\" "
24+
25+# is a free cross compile toolchain for macos available?
26+#DEF-x86_64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-apple-darwin\" "
27+#DEF-arm64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-apple-darwin\" "
tcc.h+7−1
@@ -260,7 +260,9 @@ extern long double strtold (const char *__nptr, char **__endptr); · 259 unmodified lines
260260
261261 /* path to find crt1.o, crti.o and crtn.o */
262262 #ifndef CONFIG_TCC_CRTPREFIX
263−# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
263+# define CONFIG_TCC_CRTPREFIX \
264+ ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
265+ ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib"
264266 #endif
265267
266268 #ifndef CONFIG_USR_INCLUDE
@@ -277,6 +279,8 @@ extern long double strtold (const char *__nptr, char **__endptr); · 10 unmodified lines
277279 # define CONFIG_TCC_SYSINCLUDEPATHS \
278280 "{B}/include" \
279281 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \
282+ ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/include" \
283+ ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/include" \
280284 ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE)
281285 # endif
282286 #endif
@@ -289,6 +293,8 @@ extern long double strtold (const char *__nptr, char **__endptr); · 6 unmodified lines
289293 # define CONFIG_TCC_LIBPATHS \
290294 "{B}" \
291295 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
296+ ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib" \
297+ ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/lib" \
292298 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \
293299 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR)
294300 # endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t