LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 10-03-2006, 12:31 PM   #1
Diomedes
Member
 
Registered: Dec 2004
Distribution: Slackware 13
Posts: 113

Rep: Reputation: 16
Error when building


I am using Ubuntu 6.06, and am trying to install some new software. For example, one program I am trying to install is Baduki, a Go program. I untarred the tar.gz into /usr/local/src, cd'd to the new directory and entered ./configure. Everything configured smoothly, but when I try to 'make' it gives me a series of identical errors reading "patternsdat.h:400: error: initializer-string for array of chars is too long". After this it halts the make, and I can go no further. It pretty much does this when I try to make any piece of software. It is rather frustrating. I dunno if it makes a difference, but I had to apt-get the basic compiler packs (can't remember the pkg name at the moment) before I could even attempt this, as Ubuntu does not seem to come with gcc or anything of the sort.
Anyway, I would very much appreciate any help.

Thanks in advance,
Diomedes
 
Old 10-03-2006, 02:14 PM   #2
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 572

Rep: Reputation: 64
Look for a file named patternsdat.h and look at line 400.

It's a little odd that something would be initialized in a header file in C (though C++ developers don't seem to mind), but hopefully you will see something like this:

char variable[4] = "abcd";

I think that would compile with no error with compiler gcc 2.9x. But recent versions of gcc have gotten very good at catching all manner of even insignificant errors.

If it is something as simple as my example, you can just change the 4 to a 5. But it's probably not that simple.

You could post it here and ask for comments. There may be a switch you can put in an environment variable and pass to configure or make to ignore the error. If you are desparate, you could see if there is an older version of gcc available.
 
Old 10-03-2006, 10:38 PM   #3
Diomedes
Member
 
Registered: Dec 2004
Distribution: Slackware 13
Posts: 113

Original Poster
Rep: Reputation: 16
Thanks for the response. I checked out line 400 (I am familiar with C to an extent, but it has been a while) and expected to find something simple. But as it turns out, line 400 is the final line in the file, containing only "};". At the top of the document there was a comment saying it was generated automatically by ./patterns.h, so I think I will check that out.
 
Old 10-03-2006, 10:50 PM   #4
Diomedes
Member
 
Registered: Dec 2004
Distribution: Slackware 13
Posts: 113

Original Poster
Rep: Reputation: 16
Grr... nothing yet. I looked into patterns.h, and the only char I found was pat[MAX_PATTERN_SIZE]. MAX_PATTERN_SIZE is defined in the first line of this excerpt.

Code:
...
#define MAX_PATTERN_SIZE	36	/* x_size * y_size */

#define PT_WHOLE	(1 << 0)
#define PT_CENTER	(1 << 1)
#define PT_SIDE		(1 << 2)
#define PT_CORNER	(1 << 3)
#define PT_IGNORE_D1	(1 << 4)
#define PT_IGNORE_D2	(1 << 5)
#define PT_IGNORE_D3	(1 << 6)
#define PT_IGNORE_D4	(1 << 7)
#define PT_IGNORE_D5	(1 << 8)
#define PT_IGNORE_D6	(1 << 9)
#define PT_IGNORE_D7	(1 << 10)

#define P_IGNORE_D	3

struct pattern_type {
  int id;
  int type;
  int x_size;
  int y_size;
  int x_pos;
  int y_pos;
  float value;
  char pat[MAX_PATTERN_SIZE];
};
Do you think perhaps there is a problem with defining the variable indirectly like that? I tried replacing pat[MAX_PATTERN_SIZE] with pat[36] and just getting rid of the line defining MAX_PATTERN_SIZE, but it gave me the same error messages when I tried to build it again. Any ideas?
 
Old 10-03-2006, 11:13 PM   #5
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 572

Rep: Reputation: 64
Replacing MAX_PATTERN_SIZE with 36 wouldn't make any difference, but you might try 37.

Of course that could break something if the author made the assumption that the length would be 36, but it's worth a try.

There is probably an initializer somewhere something like this:
Code:
struct pattern_type pt = { 1,1,6,6,1,1,1.5, "abcdefghijklmnopqrstuvwxyz0123456789" };
In this example, there are exactly 36 characters in the array of 36 characters. But that leaves no room for the terminating NUL character that the compiler automatically adds to strings. Increasing the array size to 37 would give the needed space.
 
Old 10-04-2006, 01:18 AM   #6
Diomedes
Member
 
Registered: Dec 2004
Distribution: Slackware 13
Posts: 113

Original Poster
Rep: Reputation: 16
It worked! Thank you very much. I will keep this solution in mind for future reference.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error in Building gcc-4.0.2 newcomer4 Linux - Software 2 01-31-2006 03:44 AM
Error building GCC Lunar_Lamp Linux From Scratch 1 01-18-2006 06:30 AM
Error building kdevelop danielg Linux - Software 1 11-22-2004 08:37 PM
Error while building kernel linuxboy69 Linux - Software 10 08-26-2004 01:09 PM
mpegrec building error jinneemop Linux - General 2 04-27-2003 01:03 AM


All times are GMT -5. The time now is 10:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration