LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-06-2012, 10:45 AM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
Problem compiling application newspost


Normally I install software from my distro (ubuntu 10.04) repositories. However, I have need for an app which is not in the distros. I downloaded the latest version from http://newspost.unixcab.org/

I extracted the source code. The instructions say to run make and make install. make produces the following error
Quote:
ken@taylor12:~/Desktop/newspost-2.1.1$ make
make main CFLAGS="-O2 -Wall" LIBS=""
make[1]: Entering directory `/home/ken/Desktop/newspost-2.1.1'
cd base ; make CC="gcc" CFLAGS="-O2 -Wall"
make[2]: Entering directory `/home/ken/Desktop/newspost-2.1.1/base'
gcc -O2 -Wall -o test test.c
In file included from newspost.h:40,
from test.c:20:
utils.h:29: error: conflicting types for ‘getline’
/usr/include/stdio.h:651: note: previous declaration of ‘getline’ was here
make[2]: *** [test] Error 1
make[2]: Leaving directory `/home/ken/Desktop/newspost-2.1.1/base'
make[1]: *** [main] Error 2
make[1]: Leaving directory `/home/ken/Desktop/newspost-2.1.1'
make: *** [opt] Error 2
As I read the the offending files...

stdio.h
Code:
/* Like `getdelim', but reads up to a newline.

   This function is not part of POSIX and therefore no official
   cancellation point.  But due to similarity with an POSIX interface
   or due to the implementation it is a cancellation point and
   therefore not marked with __THROW.  */
extern _IO_ssize_t getline (char **__restrict __lineptr,
			    size_t *__restrict __n,
			    FILE *__restrict __stream) __wur;
utils.h
Code:
Buff * getline(Buff *buff, FILE *file);
So I guess my question is... is the problem with the application source or something in my environment? What should my next steps be?

TIA,

Ken
 
Old 04-06-2012, 11:05 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
It's a problem with the code.

I got the same error when I tried to compile it. I "fixed" it by changing the name of the funtion defined in utils.h to avoid the conflict, and changed any later references in the code to use the new name.

Specifically, I changed the "getline" in utils.h to "myGetline" and so on.

Here's a list of the references you would need to change:
  1. line 29: base/utils.h
  2. line 46: base/utils.c
  3. line 345: base/newspost.c
  4. line 335: ui/options.c
  5. line 432: ui/options.c

The reason I said "fixed" was because, with the above changes, the code compiles cleanly. I did not test whether it functions correctly.

EDIT:
If you make the changes and still get an error (of some sort) during compile, then I can probably post a patch file to make the process automated... I may have missed a reference (hopefully not) or might not have been clear (much more likely).

Last edited by Dark_Helmet; 04-06-2012 at 11:09 AM.
 
Old 04-06-2012, 11:06 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
I think the problem is with the software. They declared a function getline which has the same name as the standard in stdio.h. You can try to change the name to something else and compile again. For example, from inside the main installation directory:
Code:
find . \( -name \*.c -o -name \*.h \) -exec sed -i 's/\<getline\>/getline_/' {} \;
This will change every occurrence of getline with getline_. Notice the word boundaries in the sed expression to match only the whole word and excluding some other function names containing the string getline (if any). Then issue make again.

Edit: Dark_Helmet beated me!
 
Old 04-06-2012, 11:22 AM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
Originally Posted by colucix
Edit: Dark_Helmet beated me!
Every once in a while, the unthinkable happens...

Ok, so I lied above. I decided not to wait in case your changes should cause an error.

Here's a patch file. Apply it by cd'ing to the top of the source directory and:
Code:
patch -Np1 < /path/to/patch/file
Attached Files
File Type: txt newspost-2.1.1.getline.patch.txt (2.0 KB, 27 views)
 
1 members found this post helpful.
Old 04-09-2012, 11:48 AM   #5
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
Thanks folks. I didn't really expect someone to do the work and fix this for me. As the problem is with the software source and not my environment I will raise the issue with the developers. I am not sure what they use for bug tracking but I will make the effort to find out. With your permission I will pass along the information and fixes you have provided so that the problem can be properly and completely addressed.

Thanks again,

Ken

p.s. It seems that the last update was May 2003 so I suspect the app may no longer be supported. I have an email address for the developer and I will send a link to this thread.

Last edited by taylorkh; 04-09-2012 at 11:51 AM.
 
Old 04-09-2012, 01:34 PM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by taylorkh View Post
As the problem is with the software source and not my environment I will raise the issue with the developers.
Thank you! This is the right track to follow. I would have suggested the same, even if - as you already noticed - the software is no longer maintained.
 
  


Reply



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 when compiling my application amit_pansuria Programming 3 06-09-2007 10:33 AM
utility other than newspost piforever Linux - Software 1 03-31-2006 07:27 AM
Problem when compiling autogenerated KDevelop application SteQve Linux - Software 0 12-22-2005 12:00 PM
C++ application with Glade: compiling problem dr_berta Linux - Software 10 10-03-2005 07:09 PM
Application Compiling Daxziz Linux - General 3 02-20-2002 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:30 PM.

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
Open Source Consulting | Domain Registration