Bug 140907 - Compile error on Solaris 8 - vcs/clearcase/clearcasemanipulator.cpp uses getline which is not available
Summary: Compile error on Solaris 8 - vcs/clearcase/clearcasemanipulator.cpp uses getl...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: VCS: Clearcase (show other bugs)
Version: 3.4.0
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-30 17:56 UTC by Steve Evans
Modified: 2008-03-04 18:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Enable provided getline implementation on Solaris (490 bytes, patch)
2008-01-24 14:35 UTC, Moinak Ghosh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Evans 2007-01-30 17:56:11 UTC
Version:           3.4.0 (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.6 
OS:                Solaris

I get this compile error on Solaris 8:

gmake[4]: Entering directory `/inta/cad4/stevee/kde_build/kdevelop-3.4.0/vcs/clearcase'
if /bin/bash ../../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../lib/interfaces -I../../lib/interfaces/extensions -I../../lib/util -I/opt/kde/include -I/opt/qt/include   -I/gorbag/exta/cad/externals/SOLARIS/gnome2/include/glib-2.0 -I/gorbag/exta/cad/externals/SOLARIS/include  -DQT_THREAD_SUPPORT -I/opt/kde/include  -I/gorbag/exta/cad/externals/SOLARIS/gnome2/include/glib-2.0 -I/gorbag/exta/cad/externals/SOLARIS/include -I/opt/qt/include -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4  -Wno-long-long -Wundef -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -I/opt/kde/include -I/gorbag/exta/cad/externals/SOLARIS/gnome2/include/glib-2.0 -I/gorbag/exta/cad/externals/SOLARIS/include -I/opt/qt/include -O2 -fomit-frame-pointer -DNeedVarargsPrototypes=1 -DNeedFunctionPrototypes=1 -pipe -fno-exceptions -mcpu=ultrasparc -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -MT clearcasemanipulator.lo -MD -MP -MF ".deps/clearcasemanipulator.Tpo" -c -o clearcasemanipulator.lo clearcasemanipulator.cpp; \
then mv -f ".deps/clearcasemanipulator.Tpo" ".deps/clearcasemanipulator.Plo"; else rm -f ".deps/clearcasemanipulator.Tpo"; exit 1; fi
clearcasemanipulator.cpp: In member function `VCSFileInfoMap* ClearcaseManipulator::retreiveFilesInfos(const QString&)':
clearcasemanipulator.cpp:98: error: `getline' was not declared in this scope

getline() is a gnu libc function that is not available in other libc implementations, so should not really be used in code that is intended to be portable. The man page for getline on linux says:

Both  getline() and getdelim() are GNU extensions.  They are available since libc 4.6.27.
Comment 1 Andreas Pakulat 2007-01-30 18:21:17 UTC
Can you provide a patch? The clearcase support is pretty much unmaintained, AFAIK and I doubt any of the core devs has access to Solaris machines. So unless you can come up with a patch, I guess this won't be fixed in kdevelop3. 

Of course you can easily disable clearcase support via configure --disable-clearcase
Comment 2 Steve Evans 2007-01-30 18:56:20 UTC
OK, I'll take the easy way out then and disable clearcase support as I don't need it.

Someone must have done some work on clearcase, because version 3.3.6 of kdevelop doesn't have the problem. In fact the source file clearcasemanipulator.cpp doesn't exist in that version :-)
Comment 3 Andreas Pakulat 2007-01-30 19:19:24 UTC
uhm, seems you're right. Alexander Dymo did some work during spring last year. I'll ping him later today on IRC and point him to this bugreport, maybe he can solve it...
Comment 4 Alexander Dymo 2007-01-30 21:58:05 UTC
Actually we have its getline implementation in the code and it's used when MACOSX is defined. So you could either call compiler with -DMACOSX or remove defines surrounding getline definition in clearcasemanipulator.cpp#26.

PS: define is called MACOSX because KDevelop was tested only on Linux and MacOS ;)
Comment 5 Aaron Williams 2007-07-20 02:51:45 UTC
There might be a memory leak using getline since the buffer is allocated on the heap. I don't see it getting freed anywhere unless somehow QString frees it.

In looking at the getline code I also am not sure what the behavior is on different platforms when calling realloc with a pointer on the stack. I could see this possibly causing a crash since this behavior is not described in the Solaris man page.
Comment 6 Aaron Williams 2007-07-20 03:06:21 UTC
Rather than calling realloc, why not use malloc/calloc?

Also, the man page for getline says it includes the EOL character which the source is removing.

Comment 7 Moinak Ghosh 2008-01-24 14:34:59 UTC
This problem causes a build failure on OpenSolaris (Solaris Express B78) using Gcc 3.4.3. The Q_OS_SOLARIS predefined macro from QT can be used in the preprocessor check. Patch attached.
Comment 8 Moinak Ghosh 2008-01-24 14:35:50 UTC
Created attachment 23235 [details]
Enable provided getline implementation on Solaris
Comment 9 Andreas Pakulat 2008-01-24 15:03:13 UTC
SVN commit 765689 by apaku:

Use our own getline also on Solaris which misses it as well.
BUG:140907


 M  +1 -1      clearcasemanipulator.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=765689
Comment 10 Michael Nottebrock 2008-03-04 17:07:28 UTC
Getline is pretty much a glibc-exclusive. It would be best to avoid it altogether. In any case, please add Q_OS_FREEBSD to that #ifdef as well please.
Comment 11 Andreas Pakulat 2008-03-04 18:37:07 UTC
SVN commit 782252 by apaku:

Also add Q_OS_FREEBSD as requested from Michael Nottebrock.
CCBUG:140907


 M  +1 -1      clearcasemanipulator.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=782252