Build tcc fails because the related tag is absent in git repo
duselguy opened this issue · 7 comments
Describe the bug
vladimir@Veriton:~/Project2/tilck$ ./scripts/build_toolchain -s build_tcc
ARCH=i386
HOST_ARCH=x86_64
GCC_TC_VER=8.4.0
ARCH_GCC_TC_VER=stable-2020.02-2
CI Detected: None [Assuming user machine]
[build_toolchain] Executing single function 'build_tcc'
NOTE: Skipping GCC TOOLCHAIN (i386 - musl)
*** TCC ***
+ local url=git://repo.or.cz/tinycc.git
+ local tag=15e9b7384e7091200aa33499b1ddcbf6e2f6a959
+ local tarname=tcc.tgz
+ local dirname=tcc
+ '[' -f /home/vladimir/Project2/tilck/toolchain2/cache/tcc.tgz ']'
+ '[' -z 15e9b7384e7091200aa33499b1ddcbf6e2f6a959 ']'
+ git clone --branch 15e9b7384e7091200aa33499b1ddcbf6e2f6a959 --depth 1 git://repo.or.cz/tinycc.git tcc
Cloning into 'tcc'...
warning: Could not find remote branch 15e9b7384e7091200aa33499b1ddcbf6e2f6a959 to clone.
fatal: Remote branch 15e9b7384e7091200aa33499b1ddcbf6e2f6a959 not found in upstream origin
+ tar cfz tcc.tgz tcc
tar: tcc: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
+ mv tcc.tgz /home/vladimir/Project2/tilck/toolchain2/cache
+ rm -rf tcc
+ set +x
Extracting tcc.tgz...
Extracting completed.
/home/vladimir/Project2/tilck/scripts/bash_includes/tc/tcc: line 40: cd: tcc: No such file or directory
sed: can't read Makefile: No such file or directory
Running command: ./configure --enable-cross --cross-prefix=i686-linux- --enable-static --cpu=i386 --prefix=/ --extra-ldflags='-Wl,--oformat=elf32-i386 -static' --crtprefix=/lib/i686-tilck-musl --libpaths=/lib/i686-tilck-musl &> configure.log
Running command: make cross-i386 &> build.log
i686-linux-strip: 'i386-tcc': No such file
[build_toolchain] Executing single function: DONE
Host configuration
-
Linux distro and version
Linux Veriton 5.13.0-41-generic 20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux -
Compiler (name and version)
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) -
Tilck commit: please indicate the exact commit used to reproduce the problem
b4ba5e7
Type of issue (select one)
- Toolchain build problem
P.S. tcc.tgz in cahe is empty.
P.P.S. It's desirable to have minimal error processing in scripts to exit early after the critical errors.
Best regards,
Vladimir
Thank you for the bug report, Vladimir.
I've just fixed the issue with commit d03e876.
It looks like the TCC repo changed something server side and now it doesn't accept fetch of untagged refs. Since TCC has no recent tags, I have no choice but to point to a specific commit SHA. That's not supported by their server anymore, maybe because they switched to BitBucket, I don't know. See this: https://stackoverflow.com/a/51002078/2077198
My fix does full git clone and then checks out the pointed commit, in case the direct clone fails and we referred to an untagged commit.
Note: in order to try TCC on Tilck, you'll need to re-run ./scripts/cmake_run (to discover the new package in the TC) and then to run ccmake to enable EXTRA_TCC option that now will be available in your build. In alternative to ccmake, you can enable the option with: ./scripts/cmake_run -DEXTRA_TCC=1. Clearly, after that, run make.
Enojy!
Thank you, it works like a charm!
P.S. Though the version information does not look convenient to use and support:
Host:
vladimir@Veriton:~$ busybox | head -1
BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6.4) multi-call binary.
vladimir@Veriton:~$ tcc -v
tcc version 0.9.27 (x86_64 Linux)
Tilck:

There is no limit to perfection to have a version number and the latest commit tag for the git based apps :-)
@duselguy You're welcome!
What do you mean with "the version information does not look convenient to use and support"? Tilck's build scripts do nothing in particular to add meta-information to the version of each supported app, if that's what you mean. If you refer to the TCC version that looks weird, consider that 0.9.27 has been released several years ago, and since then nobody tagged a commit with a new version. Tilck is using a much more recent version of TCC, which has no tags, just a commit SHA. Probably that version (commit 15e9b7384e709120) is more recent than the one you have on your host machine, as Linux distros tend to stick with the latest tagged version, no matter what. In my case, that didn't work, because I use do a cross-build, which is not properly supported by TCC. With commit 15e9b7384e709120 some of the bugs in 0.9.27 have been fixed, but it still required hacks to build.
My previous comment was rhetorical (and not about tilck project). The output of -v is (traditionally) incomplete and non-standard to give sufficient information about the state of the product. And the date/MSK (busybox) and d03e876 (tilck) values look odd (to me) as they refer to the product's environment rather than being a useful addition to the version information of the product itself.
@duselguy I understand now. I actually haven’t noticed that TCC shows Tilck’s commit SHA. Thanks for pointing that out. Your comment is perfectly valid.
That’s probably caused by TCC’s build system running the git command. Since I delete the .git directory after the clone operation to save space in the cache, the only git repository that git finds is the parent’s one. I’ll think about a solution for this problem too.
About BusyBox, it shows the actual version and the build date, which looks good enough for the moment even if, I agree it could be something better. Probably in the Busybox config there is a clean way to customize that extra version info, and Ubuntu uses that.
@vvaltchev
Thank you, is ok now.