LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem with GCC in Ubuntu 9.10 (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-gcc-in-ubuntu-9-10-a-766326/)

johnyjj2 11-02-2009 04:55 PM

problem with GCC in Ubuntu 9.10
 
Hello :-)

I've got problem with GCC in Ubuntu 9.10.

I installed SphinxBase (which is part of CMU Sphinx) correctly. Now I do:
Code:

mainacc@mainacc-laptop:~/tutorial/pocketsphinx-0.5.1$ ./configure
and it works. So I do:
Code:

mainacc@mainacc-laptop:~/tutorial/pocketsphinx-0.5.1$ sudo make
And I've got errors:
Code:

pocketsphinx.c:3282: warning: implicit declaration of function ‘Py_XDECREF’
error: command 'gcc' failed with exit status 1
make[1]: *** [pymod-build-stamp] Error 1
make[1]: Leaving directory `/home/mainacc/tutorial/pocketsphinx-0.5.1/python'
make: *** [all-recursive] Error 1

I googled for "error: command 'gcc' failed with exit status 1". I tried one of those suggestion and executed "./make" instead of "make" but it didn't help. I guess here (http://mail.python.org/pipermail/pyt...ay/011066.html) may be solution. It says about improper gcc. I followed those commands (maybe they would say something to you because they are no help for me):

Code:

mainacc@mainacc-laptop:~/tutorial/pocketsphinx-0.5.1$ gcc --version
gcc (Ubuntu 4.4.1-4ubuntu8) 4.4.1
Copyright (C) 2009 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.

mainacc@mainacc-laptop:~/tutorial/pocketsphinx-0.5.1$ gcc -no-cpp-precmp
gcc: unrecognized option '-no-cpp-precmp'
gcc: no input files
mainacc@mainacc-laptop:~/tutorial/pocketsphinx-0.5.1$

Greetings

johnsfine 11-02-2009 05:11 PM

Why did you use sudo make rather than just make?

I don't think that is the problem, but it is an odd thing to do and I don't think it is a good idea.

I think in quoting the area before failed with exit status 1 you left out the important part. I'm not certain the warning you quoted on the previous line isn't the important part, but I think it isn't, so the important part would have been one or more lines above that.

I don't know how to help without seeing the important part of the output.

Quote:

Originally Posted by johnyjj2 (Post 3741827)
I googled for "error: command 'gcc' failed with exit status 1". I tried one of those suggestion

In general, great approach to problem solving. In this case not. Please ignore everything you found in that google search. Not one bit of it is relevant.

I don't know whether some google search on "pocketsphinx.c" and/or "Py_XDECREF" might turn up the answer. I doubt it, but not nearly as much as I doubt anything useful could be found from the search you described.

I think something earlier in the output is the key to understanding the problem.

JohnGraham 11-02-2009 05:17 PM

Quote:

Originally Posted by johnyjj2 (Post 3741827)
Hello :-)

I've got problem with GCC in Ubuntu 9.10.

I installed SphinxBase (which is part of CMU Sphinx) correctly. Now I do:
Code:

mainacc@mainacc-laptop:~/tutorial/pocketsphinx-0.5.1$ ./configure
and it works. So I do:
Code:

mainacc@mainacc-laptop:~/tutorial/pocketsphinx-0.5.1$ sudo make
And I've got errors:
Code:

pocketsphinx.c:3282: warning: implicit declaration of function ‘Py_XDECREF’
error: command 'gcc' failed with exit status 1
make[1]: *** [pymod-build-stamp] Error 1
make[1]: Leaving directory `/home/mainacc/tutorial/pocketsphinx-0.5.1/python'
make: *** [all-recursive] Error 1


The output you posted above isn't enough - there will be errors before, most likely about a header file not being able to be found (probably something like "error: HeaderFile.h: file not found" or the like). That's the one we need to know about - always deal with the *first* error the compiler emits, and ignore the others until you've sorted it.

Where did you install SphinxBase? Have a look in your config.log and search for SphinxBase - it probably hasn't been able to find the headers but has continued anyway, and the source hasn't taken this into account. Have a look at the INSTALL and README files, and at the output of `configure --help'. There'll probably be an option like `--with-sphinxbase=/path/to/base' to tell the configure script where SphinxBase is.

If this (i.e. configure not finding the SphinxBase package) is your problem, run configure again with different options until it finds it. If it claims to have found it, you might need to alter the -I options passed to gcc to tell it where to find the header files.

Sorry if that was all a bit confusing - if in doubt, run `make' and then post the *complete* output of running `make' again (which should be much shorter than the original output of `make'!), and also post the contents of your config.log file.

johnsfine 11-02-2009 05:35 PM

Quote:

Originally Posted by JohnGraham (Post 3741852)
That's the one we need to know about - always deal with the *first* error the compiler emits, and ignore the others until you've sorted it.

I agree, and realized after reading the above that my answer might have given a different impression.

We want to see the first error during the compile of pocketsphinx.c

I'm used to scanning the output backwards from a failure point to find the first error in the same .c file. I'm used to big make runs so scanning forward from the very top would go through too many warnings from other .c files (not sure if that is the case here).

Quote:

if in doubt, run `make' and then post the *complete* output of running `make' again (which should be much shorter than the original output of `make'!)
Another good idea. When you run make again, it should redo only the part that failed, so there should be far less stuff to ignore between the beginning of the output and the important part. So the important part should be much easier to find.

BTW, if you decide to follow my earlier advice about the sudo, it is probably not a good idea to just drop the sudo when rerunning make with partial results from an earlier make with sudo. That would tend to cause problems of mixed protection. Either keep the sudo or start clean.

knudfl 11-02-2009 05:45 PM

The problem is, that the c code is a year old,
and may not compile with gcc-4.4.1 .

EDIT--EDIT : Please see post # 12

You have just been lucky with 'sphinxbase'. ?
And about 'pocketsphinx' : you can either fix
the code for gcc-4.4 :
Quote:

You might want to read the gcc porting guide
to gcc 4.3
http://gcc.gnu.org/gcc-4.3/porting_to.html

and to gcc 4.4
http://gcc.gnu.org/gcc-4.4/porting_to.html

manuals
http://gcc.gnu.org/onlinedocs/
Or use one of these : gcc-4.1, gcc-4.2, gcc-4.3 .
> > sudo apt-get install gcc-4.1 gcc-4.2 gcc-4.3
( You can have as many compilers installed, as you want.)

.. It will for sure work with 4.1 :
./configure CC=gcc-4.1
make CC=gcc-4.1
.....
Or edit pocketsphinx-0.5.1/Makefile.in , line 91
from : CC = @CC@
to : CC = gcc-4.1
... and just run ./configure && make .
.....

johnyjj2 11-02-2009 08:10 PM

2 Attachment(s)
Thanks for your answers :-)!

You say that "sudo make" is odd thing. But some time ago I had to follow command "make install" and it caused one major error:
Code:

/usr/bin/install: cannot create regular file `/usr/local/lib/libsphinxbase.so.1.0.0': Permission denied
The above was about installing SphinxBase and it worked properly for "sudo make install". It is Ubuntu so "su -" doesn't work because, what was surprise for me, there is no root in Ubuntu, but first account is admin account. (If I understood it properly :-)).

In general I'm used to hearing from people on the forums "if you don't know something, let's use google". It is first time when I hear that googling isn't the best behaviour. It may be right. However, what can you suggest, instead of using google?

I didn't look for "pocketsphinx.c" or "Py_XDECREF" but I tried to google for "error: command 'gcc' failed with exit status 1" because I thought this line is relevant.

You asked me for the previous output:
//included with this post as previous_output.txt

I know it is simple thing, but how to redirect the whole output to text file? I tried "cat > file.txt" but it shown only my inputs, not resulting outputs.

I include with this post config.log of SphinxBase.

You ask where I installed SphinxBase. I copied all of those tar.gz to directory /home/mainacc/tutorial and gunzipped them. Later I entered the directory and looked at install file. It said me to ./configure, make, make install. That's what I did.

I run configure --help in both /tutorial/sphinxbase and /tutorial/pocketsphinx-0.5.1 and in both cases it said "configure: command not found".

This PocketSphinx and SphinxBase are part of ASR called CMU Sphinx.

You say "either keep the sudo or start clean". I haven't done any "start clean" so if I do every time "sudo ..." it should be fine, am I right? I guess in Ubuntu I cannot simply write "su -" and write password so I need to write "sudo" every time if I want to run anything from admin account (root).

And in the last post I see there are some practical advices :-). I'm going to check it later, now I'm too sleepy :-). Which of your alternatives should I try as first one? Is it really this old, this whole CMU Sphinx (or rather PocketSphinx)? In general, I'd like to run PocketSphinx on mobile phone. But first of all I thought it may be good idea, first to run it on ordinary PC, and later to run on mobile phone. Can you give me any suggestions how to run it on mobile phone, after proper compiling of PocketSphinx and then proper running example from PocketSphinx, like e.g. HelloWorld.jar?

Thanks very much for so great answers :-)! I didn't expect so many comprehensive answers in this short time :-).

Greetings :-)!

paulsm4 11-02-2009 08:28 PM

Hi -

Quote:

pocketsphinx.c:3282: warning: implicit declaration of function ‘Py_XDECREF’
error: command 'gcc' failed with exit status 1
make[1]: *** [pymod-build-stamp] Error 1
<= You already know this ... but it's worth repeating ...
... this only says that an error occurred
... it DOESN'T tell us what the actual error was.
We need more information
Quote:

sudo make
<= You're correct: you can't "su - root" on Ubuntu.
But I believe you CAN "sudo -s". Which should be equivalent.
Quote:

That's the one we need to know about - always deal with the *first* error the compiler emits, and ignore the others until you've sorted it.
<= Good advice. Our focus should be on *finding* that "first error".
Quote:

I run configure --help in both /tutorial/sphinxbase and /tutorial/pocketsphinx-0.5.1 and in both cases it said "configure: command not found".
<= The combination of "sudu -s" and "./configure" should get you past this. "make clean" is another command you'll want to run.
Or (as was also suggested), "./configure && make distclean && make" should do the job.
Quote:

I didn't look for "pocketsphinx.c" or "Py_XDECREF"...
<= Good - it looks like it's just a warning, not the actual problem.

... but I tried to google for "error: command 'gcc' failed with exit status 1" because I thought this line is relevant.
<= Unfortunately, it's just a generic "make failed for some reason"
It doesn't tell us anything useful
Please definitely let us know what happens!

r3sistance 11-02-2009 08:29 PM

Since this is one of the parts of ubuntu that ticks me off to no end... a few methods of getting root shells in Ubuntu.

Easiest Method:

sudo /bin/sh
alternatively 'sudo /bin/bash' or 'sudo /bin/dash' will get similar results, please note the default shell in Ubuntu is dash.

enable terminal root account logins:

sudo passwd root
This should allow you to use a certain key combo to switch to a dash screen (i forget the key combo). Also once root account has a password you can then enable ssh logins in sshd (assuming it is installed) via editting /etc/ssh/sshd_config and setting the following line

enabling root logins via ssh:

permitrootlogins yes
ensure this line is not commented out with a preceeding #.

johnyjj2 11-02-2009 09:04 PM

Thanks :-)!

I'm going to try those commands from post #5 at 4pm (now it is 4am in my timezone).

You ask me "Please definitely let us know what happens!" -> I show it in post #6 in included files. However I don't know how to redirect output so that all the output is saved to the file, not just some of it.

And about #8, some of those things which you say sound a little bit too confusing for me. But let it wait for some time - I'll be back in 12 hours :-).

Greetings :-)!

PS Can you give me any tips, please, how to run later this PocketSphinx on mobile phone?

johnsfine 11-02-2009 09:12 PM

Quote:

Originally Posted by knudfl (Post 3741880)
The problem is, that the c code is a year old,
and cannot be compiled with gcc-4.4.1

I don't know whether to trust that answer.

If knudfl is correct, then most of the rest of what has been said here would not be of any use to a beginner and knudfl's suggestion of using an older compiler, while far from easy for a beginner, probably is easier than fixing whatever is wrong in the original source code.

But for now, I don't quite trust that answer, so ...

I looked at the beginning of the previous_output.txt file johnyjj2 posted and the first line was:
Code:

pocketsphinx.c:166: error: expected specifier-qualifier-list before ‘PyObject’
Then I downloaded an archive version 0.5.1 containing python/pocketsphinx.c from http://sourceforge.net/projects/cmus.../pocketsphinx/ and I looked at line 166 which does start with PyObject as you might expect from the error message.

That line looks very unlikely to be a first error in a compile. If PyObject is already defined that error makes no sense. But if it isn't then the error couldn't be first.

So I expect we still aren't seeing the first error.

Perhaps the first error is way up on the line
Code:

#include "Python.h"
If I understand correctly, that Python.h file is not part of pocketsphinx, so it is part of something that should have been installed before pocketsphinx. So is the error not installing that, or did the pocketsphinx make need to be told where to find that?

I don't use Ubuntu myself, by I know how to use the page at http://packages.ubuntu.com/

So I used that to see where you should have gotten Python.h from. It lists a sequence of versions from python2.4-dev through python3.1-dev

This is getting rather deep into a guess at the problem. But anyway you need to have at least one of those installed (with a version that I expect must be consistent with other Python things you have installed).

But I also found this in the config log you posted
Code:

configure:24965: checking for python
configure:24983: found /usr/bin/python
configure:24996: result: /usr/bin/python
configure:25006: checking for python-config
configure:25037: result: bogus
configure:25188: WARNING: Disabling python since development headers were not found

But it obviously failed to disable python. Maybe that is a bug in the makefile. No one ever tested it with missing python headers, so it contains an attempt to work around that which doesn't work.

So which version of python did you install to get the file /usr/bin/python ? Install the corresponding version of python#.#-dev

On that sudo side topic, it is common to need sudu for make install but not for make.

I think you do need to start clean before reconfiguring. I've never done sudu make, but I expect it can be cleaned up with
Code:

sudu make clean
Once that is done and you have installed the right python-dev package, I think you need to reconfigure, then remake (which I think should be just make, not sudo make). If all that works right, then sudu make install.

johnyjj2 11-03-2009 03:45 AM

Thanks for going so deeply in my problem :-)

Let me use some short time (I'm during lab at the university :-P) to clarify one thing:

I didn't install Python on its own. What I installed is: 1) Ubuntu 9.10, 2) JDK 6 Update 16 with NetBeans 6.7.1, 3) some other requirements of CMU Sphinx -> Ant, I didn't install svn, 4) as explained in the tutorial (installing CMU Sphinx requires installing some of its parts in the proper order) -> http://cmusphinx.sourceforge.net/sph...ad_and_install -> SphinxBase, etc.

Maybe that would be good idea to try the same but in other distribution of Linux than Ubuntu? What distribution can you suggest?

Greetings :-)!

knudfl 11-03-2009 05:22 AM

This time Ubuntu 9.10 is used :

@ johnsfine : My assumptions were based on this :
'pocketsphinx-0.5.1' depends on 'sphinxbase ( -0.4.1 )'.
'sphinxbase-0.4.1' will not configure without " python-devel ".
.. So I guessed, it was installed.
.. And too sleepy : I was actually using gcc-4.4.1 for the first test !

But you are right ... :) ...
and the two "sphinx" will compile with with gcc-4.4.1 , when
the package ' python2.6-dev ' is installed.

sudo apt-get install python2.6-dev
.. will do.

So i have no idea, how the OP got sphinxbase ( -0.4.1 ? ) to work.
.....

And good luck to @johnyjj2 !
.....

johnsfine 11-03-2009 08:26 AM

Quote:

Originally Posted by johnyjj2 (Post 3742348)
I didn't install Python on its own.

But Python is installed in your system. At this point it is not important how it got installed. It is important which version of Python is installed.

Knudfl seems to be assuming you have python2.6 installed. Since I don't have either Ubuntu or Sphinx installed, it is very possible he can know your version of Python from what you already posted, but I missed it.

I would use Synaptic to check which version of Python is installed and to install the corresponding version of Python#.#-dev

Synaptic is a GUI front end to the apt commands. If you know the version you need, Knudfl's suggestion
Code:

sudo apt-get install python2.6-dev
would install it as easily and well as Synaptic. If you don't know the version, I'm sure there is an apt command for that as well. I don't know that apt command. In Synaptic it is obvious.

Quote:

Maybe that would be good idea to try the same but in other distribution of Linux than Ubuntu? What distribution can you suggest?
There is nothing wrong with Ubuntu for this task and it certainly isn't worth side tracking into some other distribution.

You current problem is that the configure for pocketsphinx went wrong due to the lack of Python#.#-dev, so the obvious fix is install the right Python#.#-dev and then start over with configuring and making pocketsphinx.

knudfl 11-03-2009 02:35 PM

By a clean install of Ubuntu, python2.6 is included.
So I just installed python2.6-dev .

No reason to consider python2.5-dev .

' dpkg --get-selections | grep python '
.. will show , what is installed.
.....

johnyjj2 11-04-2009 10:26 AM

2 Attachment(s)
Thanks very much to all of you :-)!

Summing up, I followed this (steps 1-8):
I. Some general things in Ubuntu 9.10
1. install JDK 6 Update 16 with NetBeans 6.7.1
2. myacc@myacc-laptop:~$echo "export PATH=\$PATH:/usr/local/jdk1.6.0_16/bin" >> ~/.bashrc
myacc@myacc-laptop:~$. ~/.bashrc
II. Install SphinxBase
3. enter main directory of SphinxBase
4. sudo make clean //to clean after previous, valid installation
5. dpkg --get-selections | grep python //to check python available for installing
6. sudo apt-get install python2.6-dev //it downloads and installs python
7. install SphinxBase (./configure, make, sudo make install)
III. Install PocketSphinx
8. install PocketSphinx (./configure, make, sudo make install)
IV. Install Sphinx4
9. install shortutils package (which contains uudecode) //I don't know how to do it
10. follow doc/jsapi_setup.html in order to have jsapi.jar file in the given directory, check if the file is in the directory

And I couldn't do it without your help so I appreciate it :-).

Let me say something more about what I need this CMU Sphinx for. In general I'd like to create application for mobile phone which works according to the following:
1. user runs the proper application on the mobile phone
2. user speaks "one three seven next three two one end" (or something similar)
3. mobile phone recognizes it, responds according to control sum calculated from those numbers
4. mobile phone sends this little file to server (I thought about post method of httpconnection and tomcat on server)

This is why I had to install CMU Sphinx. In general I found two tutorials about installing it:
a. http://www.speech.cs.cmu.edu/sphinx/tutorial.html (Sphinx3)
b. http://cmusphinx.sourceforge.net/sph...ad_and_install (Sphinx4)
I couldn't find anything specifically about installing PocketSphinx and this is why I decided that first of all I'd like to install those Sphinx3 and Sphinx4 and later to try installation of PocketSphinx.

At this moment I've got installed PocketSphinx. There are examples with PocketSphinx included inside the pocketsphinx/scripts, e.g. pocketsphinx_tidigits. I include with this post two files:
a. pocketsphinx_tidigits.in
b. pocketsphinx_tidigits
I'd like to do two things and I would be really greatful if you can help me :-):
1. run examplary application of PocketSphinx in Ubuntu
2. the same for mobile phone -> for example in SonyEricsson k750i

Thanks very much once more :-)!
Greetings :-)!


All times are GMT -5. The time now is 06:16 AM.