I used this line to get tcc: "emerge tcc > tcc.output 2>tcc.errors".
I'm attaching these 2 files so you can see what's wrong, because when
I try "tcc ex2.c", I got the error messages:
"tcc: file 'AS_NEEDED' not found
/usr/lib/libc.so:3: filename expected
/usr/lib/libc.so:3: unrecognized file type
tcc: undefined symbol '__gcc_personality_v0'
tcc: undefined symbol '_Unwind_Resume'
tcc: undefined symbol '_Unwind_Backtrace'
tcc: undefined symbol '_Unwind_GetIP'
tcc: undefined symbol '_Unwind_GetGR'
tcc: undefined symbol '_Unwind_GetCFA'"

Because "emerge" wasn't working, I tried the manual installation too.
Here are the lines:
./configure > configure.output 2>configure.errors
make > make.output 2>make.errors
make test > make.test.output 2>make.test.errors
make install > make.install.output 2>make.install.errors

I've attached these files too.

Thank you.

Attachment: tcc.errors
Description: Binary data

Attachment: tcc.output
Description: Binary data

#include "tcclib.h"

#define N 20

int nb_num;
int tab[N];
int stack_ptr;
int stack_op[N];
int stack_res[60];
int result;

int find(int n, int i1, int a, int b, int op)
{
    int i, j;
    int c;

    if (stack_ptr >= 0) {
        stack_res[3*stack_ptr] = a;
        stack_op[stack_ptr] = op;
        stack_res[3*stack_ptr+1] = b;
        stack_res[3*stack_ptr+2] = n;
        if (n == result)
            return 1;
        tab[i1] = n;
    }
    
    for(i=0;i<nb_num;i++) {
        for(j=i+1;j<nb_num;j++) {
            a = tab[i];
            b = tab[j];
            if (a != 0 && b != 0) {

                tab[j] = 0;
                stack_ptr++;

                if (find(a + b, i, a, b, '+'))
                    return 1;
                if (find(a - b, i, a, b, '-'))
                    return 1;
                if (find(b - a, i, b, a, '-'))
                    return 1;
                if (find(a * b, i, a, b, '*'))
                    return 1;
                if (b != 0) {
                    c = a / b;
                    if (find(c, i, a, b, '/'))
                        return 1;
                }

                if (a != 0) {
                    c = b / a;
                    if (find(c, i, b, a, '/'))
                        return 1;
                }
                
                stack_ptr--;
                tab[i] = a;
                tab[j] = b;
            }
        }
    }

    return 0;
}

int main(int argc, char **argv)
{
    int i, res, p;
    
    if (argc < 3) {
        printf("usage: %s: result numbers...\n"
               "Try to find result from numbers with the 4 basic operations.\n", argv[0]);
        exit(1);
    }

    p = 1;
    result = atoi(argv[p]);
    printf("result=%d\n", result);
    nb_num = 0;
    for(i=p+1;i<argc;i++) {
        tab[nb_num++] = atoi(argv[i]);
    }

    stack_ptr = -1;
    res = find(0, 0, 0, 0, ' ');
    if (res) {
        for(i=0;i<=stack_ptr;i++) {
            printf("%d %c %d = %d\n", 
                   stack_res[3*i], stack_op[i],
                   stack_res[3*i+1], stack_res[3*i+2]);
        }
        return 0;
    } else {
        printf("Impossible\n");
        return 1;
    }
}

Attachment: configure.errors
Description: Binary data

Attachment: configure.output
Description: Binary data

Attachment: make.errors
Description: Binary data

Attachment: make.output
Description: Binary data

Attachment: make.test.errors
Description: Binary data

Attachment: make.test.output
Description: Binary data

Attachment: make.install.errors
Description: Binary data

Attachment: make.install.output
Description: Binary data

_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to