Build failed on Ubuntu 14.04

Q&A's, tips, howto's

Build failed on Ubuntu 14.04

Postby csfreebird » Sat Apr 19, 2014 1:16 pm

When build 10.6.0 source code on Ubuntu 14.04 64bit, I get following error:
Code: Select all
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:
Code: Select all
# 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.
csfreebird
 
Posts: 107
Joined: Tue Jan 15, 2013 11:54 am
Location: China, Beijing

Re: Build failed on Ubuntu 14.04

Postby hugh.jf.chen » Sat Apr 19, 2014 2:18 pm

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. 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.
hugh.jf.chen
 
Posts: 7
Joined: Sun Aug 11, 2013 3:50 pm

Re: Build failed on Ubuntu 14.04

Postby csfreebird » Sat Apr 19, 2014 2:57 pm

I replaced gcc with clang, still got error:
Code: Select all
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.
csfreebird
 
Posts: 107
Joined: Tue Jan 15, 2013 11:54 am
Location: China, Beijing

Re: Build failed on Ubuntu 14.04

Postby Lutz » Sat Apr 19, 2014 6:02 pm

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

Code: Select all
typedef char     *CPFunction(const char *, int);
char **(const char *, int, int)


or simpler:

Code: Select all
typedef char *CPFunction ();
typedef char **CPPFunction ();


normally these definitions are found in either readline.h or rltypedefs.h
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Build failed on Ubuntu 14.04

Postby t3o » Tue Aug 05, 2014 8:22 pm

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
t3o
 
Posts: 7
Joined: Tue Dec 11, 2012 9:50 pm

Re: Build failed on Ubuntu 14.04

Postby Lutz » Tue Aug 05, 2014 8:54 pm

Please run qa-bigint on its own like this:

Code: Select all
~/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.
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Build failed on Ubuntu 14.04

Postby t3o » Tue Aug 05, 2014 9:02 pm

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
 
Posts: 7
Joined: Tue Dec 11, 2012 9:50 pm

Re: Build failed on Ubuntu 14.04

Postby t3o » Tue Aug 05, 2014 9:11 pm

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
t3o
 
Posts: 7
Joined: Tue Dec 11, 2012 9:50 pm

Re: Build failed on Ubuntu 14.04

Postby Lutz » Tue Aug 05, 2014 9:17 pm

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.
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Build failed on Ubuntu 14.04

Postby t3o » Wed Aug 06, 2014 5:29 am

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/ :-)

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
t3o
 
Posts: 7
Joined: Tue Dec 11, 2012 9:50 pm

Re: Build failed on Ubuntu 14.04

Postby Lutz » Wed Aug 06, 2014 1:58 pm

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/ and here: http://en.wikipedia.org/wiki/Pseudorand ... _generator
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron