theopolis / build-anywhere

Scripts for building compilers that run anywhere, which build things that run anywhere
89 stars 10 forks source link

how to build https://github.com/Juan-Cortez3/pdd ? #5

Open mailinglists35 opened 4 years ago

mailinglists35 commented 4 years ago

I downloaded the tar.xz, extracted to /opt and ran the initialization script. Then I downloaded a small c file from https://github.com/Juan-Cortez3/pdd and ran ./autogen.sh, configure and make.

It fails like this:

# make
clang -DPACKAGE_NAME=\"pdd\" -DPACKAGE_TARNAME=\"pdd\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"pdd\ 1.0.0\" -DPACKAGE_BUGREPORT=\"juancortez0128@gmail.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pdd\" -DVERSION=\"1.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PTHREAD_H=1 -I.   --gcc-toolchain=/opt/x86_64-anywhere-linux-gnu --sysroot=/opt/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/sysroot  --gcc-toolchain=/opt/x86_64-anywhere-linux-gnu --sysroot=/opt/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/sysroot -march=x86-64 -fPIC -Oz  -MT pdd.o -MD -MP -MF .deps/pdd.Tpo -c -o pdd.o `test -f 'src/pdd.c' || echo './'`src/pdd.c
src/pdd.c:64:37: warning: incompatible pointer types initializing 'int *' with an expression of type 'uint8_t *'
      (aka 'unsigned char *') [-Wincompatible-pointer-types]
     {"verbose", no_argument,       &flag_verbose, 1},
                                    ^~~~~~~~~~~~~
src/pdd.c:86:5: warning: implicit declaration of function 'verify_global_var' is invalid in C99
      [-Wimplicit-function-declaration]
    verify_global_var();
    ^
src/pdd.c:112:15: warning: implicit declaration of function 'pthread_create' is invalid in C99
      [-Wimplicit-function-declaration]
        ret = pthread_create(&tinfo[i].thread_id, NULL, trans_data, &tinfo[i]);
              ^
src/pdd.c:120:15: warning: implicit declaration of function 'pthread_join' is invalid in C99
      [-Wimplicit-function-declaration]
        ret = pthread_join(tinfo[i].thread_id, &res);
              ^
src/pdd.c:266:1: error: conflicting types for 'verify_global_var'
verify_global_var(void)
^
src/pdd.c:86:5: note: previous implicit declaration is here
    verify_global_var();
    ^
src/pdd.c:316:76: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'int *';
      take the address with & [-Wint-conversion]
    while (-1 != (c_opt = getopt_long(argc, argv, short_opt, long_options, option_index))) {
                                                                           ^~~~~~~~~~~~
                                                                           &
/opt/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/sysroot/usr/include/getopt.h:177:49: note: passing
      argument to parameter '__longind' here
                        const struct option *__longopts, int *__longind)
                                                              ^
src/pdd.c:324:13: error: void function 'scan_args' should not return a value [-Wreturn-type]
            return 0;
            ^      ~
5 warnings and 2 errors generated.
Makefile:384: recipe for target 'pdd.o' failed
make: *** [pdd.o] Error 1

without build-anywhere, it succeeds like this:

gcc -DPACKAGE_NAME=\"pdd\" -DPACKAGE_TARNAME=\"pdd\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"pdd\ 1.0.0\" -DPACKAGE_BUGREPORT=\"juancortez0128@gmail.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pdd\" -DVERSION=\"1.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PTHREAD_H=1 -I.     -g -O2 -MT pdd.o -MD -MP -MF .deps/pdd.Tpo -c -o pdd.o `test -f 'src/pdd.c' || echo './'`src/pdd.c
src/pdd.c:64:37: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
      {"verbose", no_argument,       &flag_verbose, 1},
                                     ^
src/pdd.c:64:37: note: (near initialization for ‘long_options[0].flag’)
src/pdd.c: In function ‘main’:
src/pdd.c:86:5: warning: implicit declaration of function ‘verify_global_var’; did you mean ‘init_global_var’? [-Wimplicit-function-declaration]
     verify_global_var();
     ^~~~~~~~~~~~~~~~~
     init_global_var
src/pdd.c:112:15: warning: implicit declaration of function ‘pthread_create’; did you mean ‘timer_create’? [-Wimplicit-function-declaration]
         ret = pthread_create(&tinfo[i].thread_id, NULL, trans_data, &tinfo[i]);
               ^~~~~~~~~~~~~~
               timer_create
src/pdd.c:120:15: warning: implicit declaration of function ‘pthread_join’ [-Wimplicit-function-declaration]
         ret = pthread_join(tinfo[i].thread_id, &res);
               ^~~~~~~~~~~~
src/pdd.c: At top level:
src/pdd.c:266:1: warning: conflicting types for ‘verify_global_var’
 verify_global_var(void)
 ^~~~~~~~~~~~~~~~~
src/pdd.c:86:5: note: previous implicit declaration of ‘verify_global_var’ was here
     verify_global_var();
     ^~~~~~~~~~~~~~~~~
src/pdd.c: In function ‘scan_args’:
src/pdd.c:316:76: warning: passing argument 5 of ‘getopt_long’ makes pointer from integer without a cast [-Wint-conversion]
     while (-1 != (c_opt = getopt_long(argc, argv, short_opt, long_options, option_index))) {
                                                                            ^~~~~~~~~~~~
In file included from /usr/include/getopt.h:36:0,
                 from src/pdd.c:39:
/usr/include/x86_64-linux-gnu/bits/getopt_ext.h:66:12: note: expected ‘int *’ but argument is of type ‘int’
 extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
            ^~~~~~~~~~~
src/pdd.c:324:20: warning: ‘return’ with a value, in function returning void
             return 0;
                    ^
src/pdd.c:303:1: note: declared here
 scan_args(int argc, char *argv[])
 ^~~~~~~~~
mv -f .deps/pdd.Tpo .deps/pdd.Po
gcc  -g -O2   -o pdd pdd.o  -lpthread