How fix Error of error of crt1.o,crti.o in Build TinyCCompiler(TCC) from Source?
Asked Answered
I

2

8

How fix Error of crt1.o,crti.o in Build TinyCCompiler(TCC) from Source?

https://github.com/LuaDist/tcc

i'm test this at my Desktop system(ubuntu) and also test on server(centos). at both OS , show error.

Error :

tcc: file '/usr/lib/crt1.o' not found
tcc: file '/usr/lib/crti.o' not found

Details :

guest@Base:~/Gits/tcc-compiler$ ./configure --prefix=build

Binary  directory   build/bin
TinyCC directory    build/lib/tcc
Library directory   build/lib
Include directory   build/include
Manual directory    build/man
Doc directory       build/share/doc/tcc
Target root prefix  
Source path      /home/guest/Gits/tcc-compiler
C compiler       gcc
CPU              x86-64
Big Endian       no
gprof enabled    no
cross compilers  no
use libgcc       no
Creating config.mak and config.h
config.h is unchanged

guest@Base:~/Gits/tcc-compiler$ sudo make

....
....

guest@Base:~/Gits/tcc-compiler$ sudo make install

mkdir -p "build/bin"
install -s -m755 tcc "build/bin"
mkdir -p "build/man/man1"
install tcc.1 "build/man/man1"
mkdir -p "build/lib/tcc"
mkdir -p "build/lib/tcc/include"
install -m644 libtcc1.a "build/lib/tcc"
install -m644 include/stdarg.h include/stddef.h include/stdbool.h include/float.h include/varargs.h include/tcclib.h "build/lib/tcc/include"
mkdir -p "build/share/doc/tcc"
install -m644 tcc-doc.html "build/share/doc/tcc"
mkdir -p "build/lib"
install -m644 libtcc.a "build/lib"
mkdir -p "build/include"
install -m644 libtcc.h "build/include"

guest@Base:~/Gits/tcc-compiler$ cat test2.c

#include <tcclib.h>

int main()
{
    printf("Hello World\n");
    return 0;
}

Error :

guest@Base:~/Gits/tcc-compiler$ build/bin/tcc test2.c

tcc: file '/usr/lib/crt1.o' not found
tcc: file '/usr/lib/crti.o' not found

$ find /usr/ -name crti*

/usr/mipsel-linux-gnu/lib/crti.o
/usr/lib32/crti.o
/usr/libx32/crti.o
/usr/lib/i386-linux-gnu/crti.o
/usr/lib/x86_64-linux-gnu/crti.o

$ find /usr/ -name crt1*

/usr/mipsel-linux-gnu/lib/crt1.o
/usr/lib32/crt1.o
/usr/libx32/crt1.o
/usr/x86_64-w64-mingw32/lib/crt1.o
/usr/x86_64-w64-mingw32/lib/crt1u.o
/usr/i686-w64-mingw32/lib/crt1.o
/usr/i686-w64-mingw32/lib/crt1u.o
/usr/lib/i386-linux-gnu/crt1.o
/usr/lib/x86_64-linux-gnu/crt1.o

(Full Commands available at https://pastebin.ubuntu.com/26211506/)

how can fix error?


i'm can install tcc using sudo apt install tcc.(without bug and error)

but i want install tcc from source.(this have error)


New Update

in tcc.h file :

#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib"

i'm change /usr/lib to /usr/lib/x86_64-linux-gnu.

$ build/bin/tcc test.c -run

Hello World

$ /build/bin/tcc test.c

tcc: undefined symbol '__libc_csu_fini'
tcc: undefined symbol '__libc_csu_init'
tcc: undefined symbol '__libc_start_main'
tcc: undefined symbol 'printf'

New Update

#include <tcclib.h>
int main()
{
    printf("Hello World\n");
    return 0;
}

guest@Base:~/Gits/tcc-try/_build/_install/bin$ ./tcc test.c

test.c:1: include file 'tcclib.h' not found

How fix error of include files not found?!

Related Question : How fix Error of error of include files in TinyCCompiler(TCC)?

Incognizant answered 18/12, 2017 at 22:46 Comment(9)
This looks like something you should be asking of the maintainers of the program you are trying to build.Botryoidal
i not have access to them. available tcc tag at stackoverflow. @ChristianGibbonsIncognizant
github.com/LuaDist/tcc , github not have issues!Incognizant
Just because we have a [tcc] tag does not mean that all questions about tcc are on-topic here. Sorry. But you have a source distribution; very likely it contains information about how to contact the maintainers.Passacaglia
FWIW, it looks like a configuration / installation problem to me.Passacaglia
not installed for you also? @JohnBollingerIncognizant
i think should change #define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib" at tcc.h file.Incognizant
i'm changed to /usr/lib/x86_64-linux-gnu , and now new errors.(question text updated)Incognizant
my system also is AMD64. @JohnBollingerIncognizant
S
1

The LuaDist project aims to build a complete Lua ecosystem using CMake. So you should use the CMake build system instead of the original makefiles. Typically you would do the following CMake invocation.

$ mkdir _build && cd _build
$ cmake .. -DCMAKE_INSTALL_PREFIX=_install
$ cmake --build . --target install

After this you should have working tcc in _install/bin

Sweetening answered 19/12, 2017 at 9:10 Comment(5)
#include <stdlib.h> #include <stdio.h> int main() { printf("Hello World\n"); return 0; } , $ ./tcc ../test.c ../test.c:1: include file 'stdlib.h' not foundIncognizant
#include <tcclib.h> int main() { printf("Hello World\n"); return 0; } $ ./tcc ../test.c ../test.c:1: include file 'tcclib.h' not found @SweeteningIncognizant
How fix error of include files not found?! @SweeteningIncognizant
@C-Compiler: Stop that flood. Single notion about your question is sufficient. If the answerer wants to see it, he will do that. But do not insist on that.Stob
Ok sorry, but But I need a small-tiny compiler for C.. @StobIncognizant
E
1

Sorry this is not exactly an answer to a question, but initially I had the same problem and this is my solution (Ubuntu 18.04):

git clone https://github.com/TinyCC/tinycc
cd tinycc
./configure
make
make test
cd ..
echo '#include <stdio.h>
int main() {
 printf("Hi!\n");
}' > a.c
tinycc/tcc -Btinycc a.c -o a.o
./a.o
Eclecticism answered 2/11, 2022 at 11:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.