I am trying to compile a python program to c file.First, After going through and eliminating tens of errors with dozens of linking flags, finally left with a single error. When I type:
$ gcc -Os -I /usr/include/python3.6m -o example example_cy.c -lpython3.6m -lpthread -lm -lutil -ldl
the error is:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
Then I add -nostartfiles:
gcc -Os -I /usr/include/python3.6m -o example example_cy.c
-lpython3.6m -lpthread -lm -lutil -ldl -nostartfiles
The error becomes:
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
00000000000022f0
I got the image that the problem is roughly do have neither main nor _start function in my .c file.