Bug 87200 - compile-time break: memory.cpp on Solaris 8 (swap.h reports swapctl incompatible w/ large files)
Summary: compile-time break: memory.cpp on Solaris 8 (swap.h reports swapctl incompati...
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Daniel Molkentin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-14 15:32 UTC by Christopher Layne
Modified: 2008-08-01 13:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Layne 2004-08-14 15:32:53 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.1 Reading specs from /tools/stow/solx86/tool-static-gcc-3_4_1_20040807.RELEASE.i386.solaris.5_8/bin/../lib/gcc/i386-pc-solaris2.8/3.4.1/specs  Configured with: ./configure --prefix=/usr/local --enable-threads=posix --enable-languages=c,c++,f77,f95,objc : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix  Thread model: posix  gcc version 3.4.1  
OS:                Solaris

if /bin/ksh ../../libtool --silent --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/kde/include -I/usr/local/include -I/usr/local/X11R6/include   -DQT_THREAD_SUPPORT  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4 -D_FILE_OFFSET_BITS=64  -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -O2 -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -D_GNU_SOURCE  -MT memory.lo -MD -MP -MF ".deps/memory.Tpo" -c -o memory.lo memory.cpp; \
then mv -f ".deps/memory.Tpo" ".deps/memory.Plo"; else rm -f ".deps/memory.Tpo"; exit 1; fi
In file included from memory_solaris.cpp:11,
                 from memory.cpp:460:
/usr/include/sys/swap.h:47:2: #error "Cannot use swapctl in the large files compilation environment"
In file included from memory.cpp:460:
memory_solaris.cpp: In member function `void KMemoryWidget::update()':
memory_solaris.cpp:32: warning: deprecated conversion from string constant to `char*'
memory_solaris.cpp:32: warning: deprecated conversion from string constant to `char*'
memory_solaris.cpp:49: warning: deprecated conversion from string constant to `char*'
In file included from memory.cpp:460:
memory_solaris.cpp:53:2: warning: #warning "FIXME: Memory_Info[CACHED_MEM]"
make[3]: *** [memory.lo] Error 1
make[3]: Leaving directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0/kcontrol/info'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0/kcontrol'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0'
make: *** [all] Error 2
Comment 1 Christopher Layne 2004-08-14 15:33:17 UTC
Will try and fix on my own and see what I come up with.
Comment 2 Christopher Layne 2004-08-14 16:27:51 UTC
build02-sol8-x86 :: ~/src/kde3.3rc2/kdebase-3.3.0/kcontrol/info > head -47 /usr/include/sys/swap.h | tail -2
#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
#error  "Cannot use swapctl in the large files compilation environment"


Here is a questionable patch that works:

--- /home/clayne/src/kde/kdebase/kcontrol/info/memory_solaris.cpp       Tue Feb 24 03:30:07 2004
+++ /home/clayne/src/kde3.3rc2/kdebase-3.3.0/kcontrol/info/memory_solaris.cpp   Sat Aug 14 07:22:53 2004
@@ -7,9 +7,15 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <kstat.h>
 #include <sys/stat.h>
-#include <sys/swap.h>
+
+#ifdef _FILE_OFFSET_BITS
+#  undef _FILE_OFFSET_BITS
+#  include <sys/swap.h>
+#else
+#  include <sys/swap.h>
+#endif
 
 #define PAGETOK(a) (( (t_memsize) sysconf( _SC_PAGESIZE )) *  (t_memsize) a)
 
 void KMemoryWidget::update() {
Comment 3 Christopher Layne 2004-08-14 16:32:35 UTC
I don't think this is going to work, however, even if it compiles alright after making those changes.

As found on USENET:

From: Dave Thompson (thompd@guppi.net)
Subject: swapctl() equivalent with _FILE_OFFSET_BITS=64? 

This is the only article in this thread 	
View: Original Format	
Newsgroups: comp.unix.solaris
Date: 2001-10-23 12:07:19 PST 
	

I notice that I cannot use swapctl() in a C program if _FILE_OFFSET_BITS is set
to 64 (actually, I cannot even #include<swap.h>).  Is there a way to get swap
information from a C program that will give me the same information as
swapctl() when _FILE_OFFSET_BITS is 64, or am I SOL?  Unfortunately, I also am
getting some filesystem information that does not come out correctly
otherwise...

Thanks in advance!

Dave Thompson
dave@guppi.net
Comment 4 Christopher Layne 2004-08-14 17:20:07 UTC
Alright, I'm thinking that _FILE_OFFSET_BITS=64 has to be undef'd altogether.

Just got another:

if /bin/ksh ../../../libtool --silent --mode=compile --tag=CC gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include   -DOS_Solaris -I./../../fonts -I/usr/local/kde/include -I/usr/local/include -I/usr/local/X11R6/include  -D_LARGEFILE64_SOURCE -DQT_THREAD_SUPPORT  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4 -D_FILE_OFFSET_BITS=64  -O2   -D_GNU_SOURCE -MT GetPid.lo -MD -MP -MF ".deps/GetPid.Tpo" -c -o GetPid.lo GetPid.c; \
then mv -f ".deps/GetPid.Tpo" ".deps/GetPid.Plo"; else rm -f ".deps/GetPid.Tpo"; exit 1; fi
In file included from /usr/include/procfs.h:26,
                 from GetPid.c:246:
/usr/include/sys/procfs.h:44:2: #error "Cannot use procfs in the large file compilation environment"
Comment 5 Christopher Layne 2004-08-14 19:42:29 UTC
Ended up doing something similar for GetPid.c, i.e.:

#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif

Build continuing.
Comment 6 Christopher Layne 2004-08-14 21:32:45 UTC
ksysguardd as well:

make[4]: Entering directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0/ksysguard/ksysguardd/Solaris'
if gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -I./../../CContLib -I./..  -DQT_THREAD_SUPPORT  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4 -D_FILE_OFFSET_BITS=64  -O2   -D_GNU_SOURCE -MT Memory.o -MD -MP -MF ".deps/Memory.Tpo" -c -o Memory.o Memory.c; \
then mv -f ".deps/Memory.Tpo" ".deps/Memory.Po"; else rm -f ".deps/Memory.Tpo"; exit 1; fi
In file included from Memory.c:27:
/usr/include/sys/swap.h:47:2: #error "Cannot use swapctl in the large files compilation environment"
make[4]: *** [Memory.o] Error 1
make[4]: Leaving directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0/ksysguard/ksysguardd/Solaris'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0/ksysguard/ksysguardd'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0/ksysguard'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/clayne/src/kde3.3rc2/kdebase-3.3.0'
make: *** [all] Error 2
Comment 7 Christopher Layne 2004-08-16 07:25:33 UTC
BTW:

The FILE_OFFSET is being inherited from the Qt.

I've since built Qt 3.3.3 (just released) w/ -no-largefile and am rebuilding kdelibs/kdebase now.
Comment 8 Christopher Layne 2004-08-17 00:56:20 UTC
As mentioned in another bug. I'll be trying to fix the autoconf/automake for this issue.
Comment 9 John Talbot 2004-09-14 16:58:15 UTC
I just finished compiling my fix for this,
(Solaris 2.8).
I compiled QT with -no-largefile and kdebase
with --disable-largefile.  After this though
each makefile did not properly define 
D_FILE_OFFSET_BITS, so I created a small perl
script to fix it
#!/usr/bin/perl
@tries=`find . -name Makefile -print`;
foreach(@tries) {
   chop($_);
   system("cp $_ $_.orig");
   system("sed 's/BITS=/BITS=32/' $_ > $_.1");
   system("cp $_.1 $_");
}
This fixed all my compile problems and is a good temporary
fix if you need it.
Comment 10 steve 2004-11-11 10:58:04 UTC
I'm sorry, but turning off large file support isn't an option for me and is a poor workaround.

Here's my workaround (OK, a kludge but it's relatively clean and doesn't affect the rest of the system):-

--- memory_solaris.cpp.orig     Thu Nov 11 09:24:27 2004
+++ memory_solaris.cpp  Thu Nov 11 09:39:48 2004
@@ -4,6 +4,14 @@
  *  Torsten Kasch <tk@Genetik.Uni-Bielefeld.DE>
  */
 
+#ifdef _LARGEFILE64_SOURCE
+#undef _LARGEFILE64_SOURCE
+#endif
+
+#ifdef _FILE_OFFSET_BITS
+#undef _FILE_OFFSET_BITS
+#endif
+
 #include <unistd.h>
 #include <stdlib.h>
 #include <kstat.h>
Comment 11 Christopher Layne 2004-11-12 11:08:45 UTC
This was resolved a long time ago.

Check CVS rlog on that file.

Comment 12 steve 2004-11-15 15:39:09 UTC
It's still in the 3.3.1 release version, or at least the problem is.
Comment 13 groot 2008-08-01 13:38:47 UTC
Fixed in KDE 3.4.3 packages; not relevant in KDE4 which handles largefile stuff slightly differently.