Build failed on Ubuntu 14.04

Started by csfreebird, April 19, 2014, 06:16:47 AM

Previous topic - Next topic

csfreebird

When build 10.6.0 source code on Ubuntu 14.04 64bit, I get following error:

root@dean-Aspire-V7-481G:/usr/src/newlisp-10.6.0# make
make -f makefile_build
make[1]: Entering directory `/usr/src/newlisp-10.6.0'
gcc -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DREADLINE -DSUPPORT_UTF8 -DNEWLISP64 -DLINUX -DFFI -I/usr/local/lib/libffi-3.0.13/include  newlisp.c
newlisp.c: In function 'main':
newlisp.c:907:37: error: 'CPPFunction' undeclared (first use in this function)
 rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
                                     ^
newlisp.c:907:37: note: each undeclared identifier is reported only once for each function it appears in
newlisp.c:907:50: error: expected expression before ')' token
 rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
                                                  ^
newlisp.c: At top level:
newlisp.c:990:47: error: unknown type name 'CPFunction'
 char ** completion_matches(const char * text, CPFunction commands);
                                               ^
newlisp.c: In function 'newlisp_completion':
newlisp.c:995:1: warning: implicit declaration of function 'completion_matches' [-Wimplicit-function-declaration]
 return(completion_matches(text, (CPFunction *)command_generator));
 ^
newlisp.c:995:34: error: 'CPFunction' undeclared (first use in this function)
 return(completion_matches(text, (CPFunction *)command_generator));
                                  ^
newlisp.c:995:46: error: expected expression before ')' token
 return(completion_matches(text, (CPFunction *)command_generator));
                                              ^
newlisp.c:996:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[1]: *** [newlisp.o] Error 1


My GCC version:
# gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

hugh.jf.chen

#1
I met the same problem when I'd tried to build 10.6.0 under archlinux with the same version of gcc. Forturnately,I found this: http://pastebin.com/bY4hjEfZ">http://pastebin.com/bY4hjEfZ. I'm wondering if all linux distributions with gcc 4.8.2 have the smae problem. If yes,I think a patch need to be provided.

csfreebird

#2
I replaced gcc with clang, still got error:
 clang -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DREADLINE -DSUPPORT_UTF8 -DNEWLISP64 -DLINUX -DFFI -I/usr/local/lib/libffi-3.0.13/include  newlisp.c
newlisp.c:907:37: error: use of undeclared identifier 'CPPFunction'
rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
                                    ^
newlisp.c:907:50: error: expected expression
rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
                                                 ^
newlisp.c:990:47: error: unknown type name 'CPFunction'
char ** completion_matches(const char * text, CPFunction commands);
                                              ^
newlisp.c:995:34: error: use of undeclared identifier 'CPFunction'
return(completion_matches(text, (CPFunction *)command_generator));
                                 ^
newlisp.c:995:46: error: expected expression
return(completion_matches(text, (CPFunction *)command_generator));
                                             ^
5 errors generated.


Maybe some C code needs to be modified.

Lutz

#3
try to put this in to your newlisp.h or newlisp.c file:



typedef char     *CPFunction(const char *, int);
char **(const char *, int, int)


or simpler:



typedef char *CPFunction ();
typedef char **CPPFunction ();


normally these definitions are found in either readline.h or rltypedefs.h

t3o

#4
Hi,



adding the two typedefs helped to make 10.0.6 compile from source without errors on 14.04.



But I get an error when doing "make test":



...

>>>>> Time per proxy trip: 70 micro seconds

>>>>> Message API tested SUCCESSFUL

>>>>> ERROR in big integer/float conversion

make[1]: *** [check] Error 255





regards

 t3o

Lutz

#5
Please run qa-bigint on its own like this:



~/newlisp-10.6.1> ./newlisp qa-specific-tests/qa-bigint


... this will print out the error (for me to look at). Also, what processor is Ubuntu 14.04 running.



ps: or do it on 10.6.0 - shouldn't make a difference.

t3o

#6
Hi Lutz



t3o@pux:build/newlisp/newlisp-10.6.0% ./newlisp qa-specific-tests/qa-bigint

6,24444261148445e+48   6,24444261148445e+48 0

>>>>> ERROR in big integer/float conversion



t3o@pux:build/newlisp/newlisp-10.6.0% cat /proc/cpuinfo | grep "model name"

model name   : AMD E1-2500 APU with Radeon(TM) HD Graphics

model name   : AMD E1-2500 APU with Radeon(TM) HD Graphics    



t3o@pux:build/newlisp/newlisp-10.6.0% uname -a

Linux pux 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux



Hope that helps

t3o

t3o

#7
When running the test again I get the same numbers all the time:



6,24444261148445e+48   6,24444261148445e+48 0



I expected to get a different number on each call of (set 'f (pow (random 10 100) (+ 15 (rand 50)))) but probably I do not know enough about newlisp.



And... the test says 0 is bad. But an error of 0 ist the best you can get.. (not?)



t3o

Lutz

#8
It's running fine. The problem is in the qa-bigint code when comparing floats on the AMD platform.



The two floats printed out are the same and the difference is 0. So everything is fine. I have to change the small float value when comparing to 0.

t3o

#9
Hi Lutz



thanks so far.



I know that the following is not "Build failed" any more but I started this second diskussion above.



What about (random x y) returning the same number with each program run?

Is that wanted behaviour? (and: is it a good test?)



Here's a small test program:



t3o@pux:build/newlisp/newlisp-10.6.0% cat random | nl

     1   (println (random 10 10000))

     2   (exit)



t3o@pux:build/newlisp/newlisp-10.6.0% for i in 1 2 3 4; do ./newlisp random ; done

8411,8771715471

8411,8771715471

8411,8771715471

8411,8771715471



Another test:



t3o@pux:build/newlisp/newlisp-10.6.0% cat random2 | nl

     1   (println (random 10 10000))

     2   (println (random 10 10000))

     3   (println (random 10 10000))

     4   (exit)



And it prints the same three "random" numbers on each run:



t3o@pux:build/newlisp/newlisp-10.6.0% for i in 1 2 3 4; do ./newlisp random2 ; done

8411,8771715471

3953,82926819093

7840,99223758606

8411,8771715471

3953,82926819093

7840,99223758606

8411,8771715471

3953,82926819093

7840,99223758606

8411,8771715471

3953,82926819093

7840,99223758606



That reminds me of http://www.xkcd.com/221/">http://www.xkcd.com/221/ :-)



I am still new to newlisp but from my > 30 year programming experience point of view I did not expext to get the same three numbers on each program run..



Greetings

 t3o

Lutz

#10
newLISP uses a pseudorandom number generator (PRNG) which produces the same sequence on every program run. During the run of the program, repeated calling rand produces numbers in a random appearing order. On each new run the sequence is repeated. To start a different sequence use the seed function.



The ability to repeat random number sequences is important for debugging modeling and simulation applications. The seed function lets you choose either another sequence or repeat the same during the same program run.



For a more thorough discussion of this topic see: http://www.random.org/randomness/">http://www.random.org/randomness/ and here: http://en.wikipedia.org/wiki/Pseudorandom_number_generator">http://en.wikipedia.org/wiki/Pseudorand ... _generator">http://en.wikipedia.org/wiki/Pseudorandom_number_generator