Hi,
when I redirect the output of a program to a file, e.g.
myprog > file.txt, the shell seems to buffer the output
before writing to the file. From my observation on
my machine, the buffer seems to be 4K.
Is there a way to let bash immediately write any output
strings to file (not using buffer at all)? TIA.
--
Regards,
Verdi
--
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl
Suppose I want all my source files to be placed under
$(top_srcdir)/include/name/space/name,
and therefore want something like the results of
AM_CPPFLAGS = -I$(top_srcdir)/include
in all my gcc invocations. One way I've found, which seems to work is to
create a $(top_srcdir)/Makefile.project with the AM_CPPFLAGS line, then
include $(top_srcdir)/Makefile.project in all the Makefile.am instances. The
only drawback to this is that I need to be sure the line is in all the
Makefile.ams. It's not that big of a deal if I'm maintaining by hand, but if
I use a tool that manages my Autotools configuration, it may not cooperate.
I've read that it's not a good idea to change the CPPFLAGS variable itself,
as might be done with autoconf AC_SUBST (VARIABLE, [VALUE]).
Is there a way to accomplish this without messing with each Makefile.am?
--
Regards,
Steven
I posted this to gnu.gcc.help, but it seems worth asking on this list as well.
Particularly since it was strongly suggested by participants that I read this
book. This is on SuSE 9.3.
--------------- Forwarded message (begin)
Subject: "Formal" solution: parser.y:7: error: `stderr' undeclared (first use
in this function)
From: Hattuari <susudata(a)setidava.kushan.aa>
Date: Sat, 27 Aug 2005 00:16:10 -0400
Newsgroup: gnu.gcc.help
I'm going through the Goat Book http://sources.redhat.com/autobook/, and
when I followed the instructions on how to build the first example, I
received the following message:
Fri Aug 26 23:47:43:> make
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\"
-DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT parser.o -MD
-MP -MF ".deps/parser.Tpo" -c -o parser.o parser.c; \
then mv -f ".deps/parser.Tpo" ".deps/parser.Po"; else rm -f
".deps/parser.Tpo"; exit 1; fi
parser.y: In function `yyerror':
parser.y:7: error: `stderr' undeclared (first use in this function)
parser.y:7: error: (Each undeclared identifier is reported only once
parser.y:7: error: for each function it appears in.)
make: *** [parser.o] Error 1
I may (probably can) get this to compile by some trial and error. But
that's why I'm reading the Goat Book! I've been using the other method for
years, and I decided to start doing things right.
Starting from scratch in §5.2 this is exactly what I did, and what was
output:
$ aclocal
$ automake --add-missing
configure.in: installing `./install-sh'
configure.in: installing `./missing'
Makefile.am: installing `./INSTALL'
Makefile.am: required file `./NEWS' not found
Makefile.am: required file `./README' not found
Makefile.am: required file `./AUTHORS' not found
Makefile.am: required file `./ChangeLog' not found
Makefile.am: installing `./COPYING'
Makefile.am: installing `./depcomp'
# Hey, they told me to do it that way!
$ touch NEWS README AUTHORS ChangeLog
$ automake --add-missing
$ ls
AUTHORS Makefile.in configure main.c
COPYING NEWS configure.in missing
ChangeLog README depcomp nly.c
INSTALL aclocal.m4 foo.c parser.y
Makefile.am autom4te.cache install-sh scanner.l
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for flex... flex
checking for yywrap in -lfl... yes
checking lex output file root... lex.yy
checking whether yytext is a pointer... yes
checking for bison... bison -y
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
$ make all
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\"
-DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT main.o -MD -MP
-MF ".deps/main.Tpo" -c -o main.o main.c; \
then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo";
exit 1; fi
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\"
-DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT foo.o -MD -MP
-MF ".deps/foo.Tpo" -c -o foo.o foo.c; \
then mv -f ".deps/foo.Tpo" ".deps/foo.Po"; else rm -f ".deps/foo.Tpo"; exit
1; fi
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\"
-DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT nly.o -MD -MP
-MF ".deps/nly.Tpo" -c -o nly.o nly.c; \
then mv -f ".deps/nly.Tpo" ".deps/nly.Po"; else rm -f ".deps/nly.Tpo"; exit
1; fi
flex scanner.l
sed '/^#/ s|lex.yy\.c|scanner.c|' lex.yy.c >scanner.c
rm -f lex.yy.c
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\"
-DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT scanner.o -MD
-MP -MF ".deps/scanner.Tpo" -c -o scanner.o scanner.c; \
then mv -f ".deps/scanner.Tpo" ".deps/scanner.Po"; else rm -f
".deps/scanner.Tpo"; exit 1; fi
bison -y parser.y
if test -f y.tab.h; then \
to=`echo "parser_H" | sed \
-e
'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \
sed -e "/^#/!b" -e "s/Y_TAB_H/$to/g" -e "s|y\.tab\.h|parser.h|" \
y.tab.h >parser.ht; \
rm -f y.tab.h; \
if cmp -s parser.ht parser.h; then \
rm -f parser.ht ;\
else \
mv parser.ht parser.h; \
fi; \
fi
if test -f y.output; then \
mv y.output parser.output; \
fi
sed '/^#/ s|y\.tab\.c|parser.c|' y.tab.c >parser.ct && mv parser.ct parser.c
rm -f y.tab.c
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\"
-DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT parser.o -MD
-MP -MF ".deps/parser.Tpo" -c -o parser.o parser.c; \
then mv -f ".deps/parser.Tpo" ".deps/parser.Po"; else rm -f
".deps/parser.Tpo"; exit 1; fi
parser.y: In function `yyerror':
parser.y:7: error: `stderr' undeclared (first use in this function)
parser.y:7: error: (Each undeclared identifier is reported only once
parser.y:7: error: for each function it appears in.)
make: *** [parser.o] Error 1
I have not tried to fix this yet. The reason I'm asking is not that I want
the program to compile. I don't even know what it does. I want to know
the _right_ way to solve these kinds of problems. Any suggestions?
--
STH
--------------- Forwarded message (end)
--
Regards,
Steven
Here's a puzzle: I'd like to define something like
typedef std::pair<int,P*> P;
I can obviously do
class P : public std::pair<int,P*>{};
or
typedef std::pair<int,void*> P;
The first gives me objects of class P where P.second is a pointer to a
subclass of what I really want. The second gives me something where,
with careful use of reinterpret_cast, I can create pointers to what I
really want.
The puzzle is can I create a standard pair where pair.second is a
pointer to an element of the class I've created without using
reinterpret_cast in some way?
There is a real point to this: I'd like to avoid reinterpret_cast so
that g++ can detect errors better in a complicated template class (a
protected subclass of std::multimap that can act like a linked list) but
am constrained to use std::pair and not some convenient derived class.
--
JDL
I've been trying to compile MonoDevelop from svn for several days (weeks?) and
keep getting the following error:
Making all in MonoDevelop.Gui.Utils
make[3]: Entering directory
`/download/org/go-mono/MonoDevelop/Core/src/MonoDevelop.Gui.Utils'
/home/hattons/opt/org/go-mono/bin/mcs -langversion:ISO-1
-out:../../../build/bin/MonoDevelop.Gui.Utils.dll /target:library /r:System.Drawing /r:ICSharpCode.SharpZipLib
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/glib-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/pango-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/atk-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/gdk-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/gtk-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/glib-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/pango-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/atk-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/gdk-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/gtk-sharp.dll
-r:/home/hattons/opt/org/go-mono/lib/mono/gtk-sharp-2.0/art-sharp.dll
-r:/usr/lib/mono/gtk-sharp-2.0/gnome-sharp.dll /resource:icons/gnome-fs-regular.png\
./FileIcons/FileIconLoader.cs\
./ReportingStream/ReportingStream.cs\
./DirectoryArchive/Decompressor.cs\
./DirectoryArchive/TarDecompressor.cs\
./DirectoryArchive/ZipDecompressor.cs\
./DirectoryArchive/Bz2Support.cs\
./DirectoryArchive/GzSupport.cs AssemblyInfo.cs
./FileIcons/FileIconLoader.cs(41,24): error CS1502: The best overloaded method
match for `Gnome.Icon.LookupSync(Gtk.IconTheme, Gnome.ThumbnailFactory,
string, string, Gnome.IconLookupFlags, out Gnome.IconLookupResultFlags)' has
some invalid arguments
./FileIcons/FileIconLoader.cs(41,24): error CS1503: Argument 1: Cannot convert
from `Gtk.IconTheme' to `Gtk.IconTheme'
Compilation failed: 2 error(s), 0 warnings
make[3]: *** [../../../build/bin/MonoDevelop.Gui.Utils.dll] Error 1
make[3]: Leaving directory
`/download/org/go-mono/MonoDevelop/Core/src/MonoDevelop.Gui.Utils'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/download/org/go-mono/MonoDevelop/Core/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/download/org/go-mono/MonoDevelop/Core'
make: *** [all-recursive] Error 1
I'm not sure if the problem is related to the
`-r:/usr/lib/mono/gtk-sharp-2.0/gnome-sharp.dll' argument or not. For some
reason, I have not been able to persuade the gtk-sharp build to install
gnome-sharp.dll when I do a `make install'.
Does anybody have this building on their system?
--
Regards,
Steven
Hi
I would like to know how the readline libraries
included in the following packages were compiled
and archived.
readline-5.0-1.2.i586.rpm
readline-devlevel-5.0-12.i586.rpm
Is there any way to know the compile option of
there libraries?
Thanks
ST
Adolph,
I don't know how much trouble this would be but you could create
symbolic links on your machine to point to the NFS mounted libraries.
That way you could guarantee that you were picking them up correctly.
Jerry.
-----Original Message-----
From: Adolph & Sharon Weidanz [mailto:timetopaws@gmail.com]
Sent: Saturday, August 06, 2005 3:08 PM
Cc: suse-programming-e
Subject: Re: [suse-programming-e] Remote programming (May be OT)
Black, Alain wrote:
> telnet/ssh/rsh/rlogin
>
> -----Original Message-----
Yep I can get in that way for text based stuff. But what I want to do is
able to use MY IDE but the other systems compiler/debugger. As Jerry
mentioned, I tried using NFS. I put a new project on the shared drive
(physically on the desktop) and #included <mysql++>, which I know is NOT
on my desktop. It compiled fine, so it was using my laptop's libraries.
Not what I wanted..
--
Quis custodiet ipsos custodes
"To announce that there must be no criticism of the president, or that
we are to stand by the president, right or wrong, is not only
unpatriotic and servile, but is morally treasonable to the American
public." [Theodore Roosevelt] 1918
Adolph & Sharon Weidanz SuSE 9.2
'78 43' Endeavour Ketch Folding@Home Team 45
S/V Time To Paws
--
To unsubscribe, email: suse-programming-e-unsubscribe(a)suse.com
For additional commands, email: suse-programming-e-help(a)suse.com
Archives can be found at:
http://lists.suse.com/archive/suse-programming-e
CONFIDENTIALITY NOTICE
This message and any included attachments
are from Cerner Corporation and are intended
only for the addressee. The information
contained in this message is confidential and
may constitute inside or non-public information
under international, federal, or state
securities laws. Unauthorized forwarding,
printing, copying, distribution, or use of such
information is strictly prohibited and may be
unlawful. If you are not the addressee, please
promptly delete this message and notify the
sender of the delivery error by e-mail or you
may call Cerner's corporate offices in Kansas
City, Missouri, U.S.A at (+1) (816)221-1024.
---------------------------------------- --
telnet/ssh/rsh/rlogin
-----Original Message-----
From: Adolph & Sharon Weidanz [mailto:timetopaws@gmail.com]
Sent: Friday, August 05, 2005 1:30 PM
To: suse-programming-e
Subject: Re: [suse-programming-e] Remote programming (May be OT)
Fowler,Jerry wrote:
> Adolph,
>
> Why not NFS mount the filesystem containing the source code on the
other
> box to your machine?
>
>
> Jerry Fowler | Technology Architect, Technical Architecture - Host
Actually I was wondering about that. I have NFS server setup on my
desktop and the client on my laptop. Currently, I just use it swap files
back and forth. I'll have to try setting a kdevelop project up on. The
big question is to where the gcc would run. If I do a linux/linux NFS
running on my system should be a problem, but if I want to compile it ON
the solaris machine....
--
Quis custodiet ipsos custodes
"To announce that there must be no criticism of the president, or that
we are to stand by the president, right or wrong, is not only
unpatriotic and servile, but is morally treasonable to the American
public." [Theodore Roosevelt] 1918
Adolph & Sharon Weidanz SuSE 9.2
'78 43' Endeavour Ketch Folding@Home Team 45
S/V Time To Paws
--
To unsubscribe, email: suse-programming-e-unsubscribe(a)suse.com
For additional commands, email: suse-programming-e-help(a)suse.com
Archives can be found at:
http://lists.suse.com/archive/suse-programming-e
I'm trying to parse an ELF file to build a human readable representation. I
know it's been done before, and there are tools such as objdump, nm,
readelf, c++filt, etc. I can look at the source to see how they are
implemented. In most cases, that means reading C, not C++. I do have an
example of C++ code that works. I thought it might be a good idea to take
a different approach than that code takes.
Rather than processing the data from in std::ifstream as ELFIO does, I
wanted to read it into a buffer, and work on it from there. One option is
to use a std::stringstream, and treat it like and do basically the same
thing ELFIO does with the std::ifstream. What I currently have is a
std::vector<char>, which I thought would be a good thing to use. But if I
try to do that, I have to find a different way to do things such as
m_pStream->read( reinterpret_cast<char*>( &m_header ), sizeof( m_header ) );
My intent was to work on the file from the point of view of it just being
data, rather than a stream. Is that simply "not the way it's done"?
Another question I have is this: The ELF file starts with an identification
tag which carries such information as encoding type (big endian, little
endian), the class of the machine(32 or 64-bit), etc. That's all in
specifically ordered bytes. That leaves a question opened. Doesn't the
host encoding determine which byte is treated as 0? IOW, the first four
bytes are specified as '0x7f', 'E', 'L', 'F'. If that were read by a
machine that uses the opposite endian, would that not come across as
'F','L','E','0x7f'? Even more perplexing is this: the rest of the ELF
header is formed of heterogeneous data types. See below. Does that mean
some of the data might be put into the wrong location by the
reinterpret_cast<> above?
// Platform specific definitions.
typedef unsigned long Elf32_Addr;
typedef unsigned short Elf32_Half;
typedef unsigned long Elf32_Off;
typedef signed long Elf32_Sword;
typedef unsigned long Elf32_Word;
// ELF file header
struct Elf32_Ehdr {
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type;
Elf32_Half e_machine;
Elf32_Word e_version;
Elf32_Addr e_entry;
Elf32_Off e_phoff;
Elf32_Off e_shoff;
Elf32_Word e_flags;
Elf32_Half e_ehsize;
Elf32_Half e_phentsize;
Elf32_Half e_phnum;
Elf32_Half e_shentsize;
Elf32_Half e_shnum;
Elf32_Half e_shstrndx;
};
--
Regards,
Steven