add autobuild of some tcc libs #339

Merged
Burer merged 14 commits from Egor00f/kolibrios:add-crt0-autobuild into main 2026-05-16 08:30:22 +00:00
Contributor

Implement autobuild for(this libs in programs/develop/ktcc/bin/lib/):

  • crt0.o
  • libtcc1.a
  • tiny.o
  • libshell.a
  • libcryptal.a
  • libsound.a

it autobuild for kolibrios image and programs build.

link_tcc automatically add this libs to extra_inputs

roots of this grow from #311

Implement autobuild for(this libs in [`programs/develop/ktcc/bin/lib/`](https://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/develop/ktcc/bin/lib)): + `crt0.o` + `libtcc1.a` + `tiny.o` + `libshell.a` + `libcryptal.a` + `libsound.a` it autobuild for kolibrios image and programs build. `link_tcc` automatically add this libs to `extra_inputs` roots of this grow from #311
Egor00f requested review from mxlgv 2026-02-22 09:03:46 +00:00
mxlgv added the C
Kind
Enhancement
Priority
Low
labels 2026-02-23 23:31:27 +00:00
mxlgv changed title from libc.obj: add auto build `crt.o` to libc.obj: add auto build `crt0.o` 2026-02-23 23:33:05 +00:00
mxlgv requested changes 2026-02-23 23:35:02 +00:00
Dismissed
mxlgv left a comment
Owner

This file apparently also needs to be deleted... However, this will probably break the build

668fd4deeb/programs/develop/ktcc/trunk/bin/lib/crt0.o

This file apparently also needs to be deleted... However, this will probably break the build https://git.kolibrios.org/KolibriOS/kolibrios/src/commit/668fd4deeb6cdcb26508657b696a04d4a240d221/programs/develop/ktcc/trunk/bin/lib/crt0.o
mxlgv added the
PR
Request changes
label 2026-02-23 23:35:29 +00:00
mxlgv added a new dependency 2026-02-24 00:02:05 +00:00
Author
Contributor

yes. In general, it's better to remove the ktcc binaries from the repository.

yes. In general, it's better to remove the ktcc binaries from the repository.
Author
Contributor

However, this will probably break the build

No, none of the files in the repository mention libc.obj/lib/crt.o. And auto build is work. And it have duplicate in ktcc/trunk/bin/lib

> However, this will probably break the build No, none of the files in the repository mention `libc.obj/lib/crt.o`. And auto build is work. And it have duplicate in `ktcc/trunk/bin/lib`
Egor00f requested review from mxlgv 2026-03-07 18:52:37 +00:00
mxlgv requested changes 2026-03-11 12:00:21 +00:00
mxlgv left a comment
Owner

TCC = "kos32-tcc -B" .. tup.getcwd().. "/develop/ktcc/trunk/bin"

Please note. TCC takes this file from the bin folder. Your builted file is ignored.

https://git.kolibrios.org/KolibriOS/kolibrios/src/commit/0253ec87530d26e76ee38ecb101d8839d6c354d0/programs/use_tcc.lua#L1 Please note. TCC takes this file from the bin folder. Your builted file is ignored.
Egor00f marked the pull request as work in progress 2026-03-16 05:16:57 +00:00
Author
Contributor

Интересный факт: библиотеки(libshell и libcryptal) из автосборки отличаются от тех что были. Они меньше

Интересный факт: библиотеки(libshell и libcryptal) из автосборки отличаются от тех что были. Они меньше
Egor00f changed title from WIP: libc.obj: add auto build `crt0.o` to WIP: add autobuild of some tcc libs 2026-04-11 16:19:26 +00:00
Author
Contributor

Если использовать libSDL.a из contrib/..., то tcc не может найти SDL_MapRGB. С sdl потом когда-нибудь разберусь

Если использовать `libSDL.a` из `contrib/...`, то `tcc` не может найти `SDL_MapRGB`. С sdl потом когда-нибудь разберусь
Author
Contributor

(удалил мусорные коммиты)

(удалил мусорные коммиты)
Egor00f marked the pull request as ready for review 2026-04-12 06:57:53 +00:00
Egor00f requested review from mxlgv 2026-04-12 06:58:15 +00:00
Burer requested changes 2026-04-12 16:34:56 +00:00
Dismissed
Burer left a comment
Owner

Requesting changes due to a few blocking issues:

Requesting changes due to a few blocking issues: - [x] **High** `NO_FASM=full` can break TCC builds: `use_tcc.lua` unconditionally adds FASM-related libs/groups, while those artifacts are conditionally produced. Files: [programs/use_tcc.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/use_tcc.lua), [programs/develop/ktcc/trunk/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/develop/ktcc/trunk/Tupfile.lua) - [x] **High** `NO_TCC=full` config conflict: `ktcc/trunk/Tupfile.lua` may request `crt0.o`, but `libc.obj/source/Tupfile.lua` exits early on `NO_TCC`. Files: [programs/develop/ktcc/trunk/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/develop/ktcc/trunk/Tupfile.lua), [programs/develop/ktcc/trunk/libc.obj/source/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/develop/ktcc/trunk/libc.obj/source/Tupfile.lua) - [x] **High** Risky Tup dependency wiring for `libsound.a`: direct cross-tree path to a generated artifact instead of grouped dependency flow. Files: [programs/develop/ktcc/trunk/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/develop/ktcc/trunk/Tupfile.lua), [contrib/sdk/sources/sound/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/contrib/sdk/sources/sound/Tupfile.lua) - [x] **Medium** Relaxed guards (`NO_TCC && NO_FASM`) across TCC apps can enable builds in modes where required linker inputs are missing. Files: [programs/system/shell/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/system/shell/Tupfile.lua), [programs/other/TinyHashView/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/other/TinyHashView/Tupfile.lua), [programs/develop/tinybasic-1.0.4/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/develop/tinybasic-1.0.4/Tupfile.lua) - [x] **Low** Typo in SSL guard: checks `NO_FASM` twice (`A and A`). File: [programs/develop/libraries/kos_mbedtls/programs/ssl/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/develop/libraries/kos_mbedtls/programs/ssl/Tupfile.lua) - [x] **Fixed** `libcryptal.a` completeness issue (`blowfish.c`): now uses wildcard C source list. File: [programs/develop/ktcc/trunk/lib/libcryptal/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/programs/develop/ktcc/trunk/lib/libcryptal/Tupfile.lua) - [x] **Fixed** `symbols` is declared as input for `objcopy --redefine-syms=symbols`. File: [contrib/sdk/sources/sound/Tupfile.lua](https://git.kolibrios.org/Egor00f/kolibrios/src/branch/add-crt0-autobuild/contrib/sdk/sources/sound/Tupfile.lua)
Egor00f requested review from Burer 2026-04-17 12:46:12 +00:00
Burer force-pushed add-crt0-autobuild from 0398c655bf to 99e1a18839 2026-04-18 11:01:02 +00:00 Compare
Author
Contributor

By the way, the libc examples use libraries from programs/develop/ktcc/trunk/bin/lib. It might be worth adding a tup build for them.

By the way, the [libc examples](https://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/develop/ktcc/trunk/libc.obj/samples) use libraries from `programs/develop/ktcc/trunk/bin/lib`. It might be worth adding a tup build for them.
Member

@Egor00f - Please note that the file path for ktcc was recently changed with #425. This will conflict with your changes.

@Egor00f - Please note that the file path for `ktcc` was recently changed with #425. This will conflict with your changes.
Egor00f added 12 commits 2026-04-20 16:27:55 +00:00
before build something directly/with `make` maybe need run `tup programs/develop/ktcc/trunk/bin`
The `use_tcc.lua` file now has a separate table for libraries and a dependency on .def files.
unneeded libs deleted.
`libtcc1` requires fasm and tcc both
`libSDL.a` from `contrib/sdk/lib` require `SDL_MapRGB`, tcc can't find this function.
add to deps libc headers
use `*.c`
create group for libsound.a && update libraries list
Build system / Check kernel codestyle (pull_request) Successful in 1m44s
Build system / Build (pull_request) Failing after 1m50s
2f0d14dcea
Egor00f force-pushed add-crt0-autobuild from 7f94f7f1ab to 2f0d14dcea 2026-04-20 16:27:55 +00:00 Compare
Egor00f added 1 commit 2026-04-20 17:01:09 +00:00
after rebase fixes
Build system / Check kernel codestyle (pull_request) Successful in 2m43s
Build system / Build (pull_request) Successful in 16m5s
ee832c469d
Egor00f force-pushed add-crt0-autobuild from 67a61cd164 to ee832c469d 2026-04-20 17:01:09 +00:00 Compare
Burer added 1 commit 2026-05-03 16:41:00 +00:00
ktcc autobuild: fix gating, dependency wiring, and packaging
Build system / Check kernel codestyle (pull_request) Successful in 26s
Build system / Build (pull_request) Successful in 9m23s
a83c77a1e4
Address several blockers in the TCC autobuild PR so it does not break
non-default toolchain configurations and so that build-time deps line
up with the new policy "TCC programs require FASM":

* programs/demos/kmatrix/Tupfile.lua: skip-guard used `and` instead of
  `or`, which would attempt the build with NO_FASM=full and fail at
  link time. Aligned with the rest of the TCC programs.

* programs/develop/ktcc/libc.obj/source/Tupfile.lua: FASM_SRC was
  declared inside the NO_TCC block, so NO_TCC=full + NO_FASM=""
  errored on a nil reference instead of building crt0.o. Hoisted the
  declaration above both blocks.

* programs/develop/ktcc/Tupfile.lua, programs/use_tcc.lua: stop
  routing libsound.a through tup.getvariantdir()-based cross-tree
  paths in use_tcc.lua. libsound.a is now copied into bin/lib/ via a
  dedicated tup.rule that references the contrib group through
  extra_inputs (matching the cross-tree convention used elsewhere in
  the tree, e.g. minizip and fridge). Cleaned up the now-dead
  libPath/lib-table case in link_tcc together with the double-negation
  conditionals.

* programs/use_tcc.lua: split LIST_OF_LIBS (mandatory crt0/tiny/libtcc1)
  from OPTIONAL_LIBS (sound/cryptal/shell). link_tcc accepts an
  optional third argument naming requested libraries, so programs no
  longer transitively depend on libsound/libcryptal/libshell unless
  they actually need them.

* programs/other/TinyHashView/Tupfile.lua: declares the cryptal
  dependency explicitly through the new link_tcc signature.

* programs/develop/ktcc/lib/libshell/Tupfile.lua: missing shell_api.h
  added to extra_inputs so libshell is rebuilt when its public header
  changes (matches the pattern already used for the other headers).

* data/Tupfile.lua: libsound.a now sourced from
  programs/develop/ktcc/bin/lib/<libsound.a> for consistency with the
  other libs. The TCC packaging block was gated only on NO_TCC; under
  the new policy executables also require FASM, so the executable
  entries are nested under an additional NO_FASM gate while LIBC.OBJ,
  libshell.a, libcryptal.a and the static data files stay outside the
  inner gate.

* .gitignore: replaced build-en_US/ + en_US.config with the more
  general /build-*/ + /*.config (root-anchored so they cannot shadow
  tracked files in subdirectories).
Burer approved these changes 2026-05-04 16:04:58 +00:00
Dismissed
Burer approved these changes 2026-05-04 16:42:35 +00:00
Doczom approved these changes 2026-05-09 10:49:51 +00:00
Burer merged commit 175bd31489 into main 2026-05-16 08:30:22 +00:00
Burer deleted branch add-crt0-autobuild 2026-05-16 08:30:22 +00:00
Burer referenced this issue from a commit 2026-05-19 10:30:50 +00:00
Sign in to join this conversation.
No Reviewers
5 Participants
Notifications
Due Date
No due date set.
Blocks
#340 libc.obj: update exit
KolibriOS/kolibrios
Reference: KolibriOS/kolibrios#339