Re: [gentoo-user] Re: bloated by gcc
On Sun, Sep 28, 2014 at 10:56 PM, walt wrote: > On 09/28/2014 01:44 AM, Jorge Almeida wrote: >> I'm having a somewhat disgusting issue on my Gentoo: binaries are >> unaccountably large. >> > Are you cross-compiling for different hardware? I'm just curious what results > you get with --march=native. Nope. Actually, I compiled with --march=native, with no difference (probably because my code is not fancy enough to make use of whatever stuff that pulls), but then tried i686 just to enable comparing with non-Gentoo systems. The purpose is to have small static binaries compiled against dietlibc to be used in the same computer (compile once and forget about future software incompatibilities!). I compiled against glibc to make sure the problem is not with dietlibc. > > Also, I looked up data-sections and function-sections (which I'd never heard > of before today :) The gcc man page says the resulting executable will be > larger and slower, and not to use them "unless there are significant benefits" > but then doesn't say what those benefits might be. Hm, cryptic. > I found those flags in the net (probably StackOverflow), looking for ways to optimize size. Maybe what you read was not meant to static compiling? Anyway, I used these flags in 4 systems (including LFS in the same computer as Gentoo) and only the Gentoo system has this behaviour... Thanks, Jorge >
Re: [gentoo-user] Running a program on a headless computer ?
On 28/09/2014 15:13, meino.cra...@gmx.de wrote: Hi, I want to run programs, which insist on haveing a terminal to write their status to and which are writing files which their results on a headless computer (beaglebone). I tried things like my_program -o file.txt -parameter value > /dev/null &2>&1 & but this results in a idle copy of this process and a defunct child. The program does not use X11 in any way... Is there any neat trick to accomplish what I am trying to do here? Take a look at daemonize. It is available in portage. http://software.clapper.org/daemonize/ --Kerin
[gentoo-user] Re: bloated by gcc
On 09/28/2014 01:44 AM, Jorge Almeida wrote: > I'm having a somewhat disgusting issue on my Gentoo: binaries are > unaccountably large. > > I'm talking about C programs of my own, so no version related issues > whatsoever. The computer is a core i3 with a 32 bit system. > > Example, for the same program: > > 10275 B on an atom running Slackware 14.1 (gcc 4.8.2) > 5896 B (same, stripped with strip --strip-unneeded) > > 11675 B on i3, Gentoo, gcc 4.8.3 (with default gcc it was worse) > 9704 B stripped > > 8207 B on *the same i3 box* running LFS (gcc 4.9.1) > 5768 B stripped > > When compiling against dietlibc, the difference is even more shocking > (almost double size in Gentoo after stripping). > > Compiled with: > gcc -Os -march=i686 -fomit-frame-pointer -pipe -Wall -pedantic > -fdata-sections -ffunction-sections -Wl,--gc-sections > -fno-asynchronous-unwind-tables -std=c99 > > Gentoo: > $ gcc -v > Using built-in specs. > COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3/gcc > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/lto-wrapper > Target: i686-pc-linux-gnu > Configured with: > /var/tmp/portage/sys-devel/gcc-4.8.3/work/gcc-4.8.3/configure > --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --prefix=/usr > --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3 > --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include > --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3 > --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/man > --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/info > --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include/g++-v4 > --with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.8.3/python > --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt > --disable-werror --with-system-zlib --disable-nls > --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ > --with-pkgversion='Gentoo 4.8.3' --enable-libstdcxx-time > --enable-shared --enable-threads=posix --enable-__cxa_atexit > --enable-clocale=gnu --disable-multilib --disable-altivec > --disable-fixed-point --with-arch=i686 --enable-targets=all > --disable-libgcj --enable-libgomp --disable-libmudflap > --disable-libssp --enable-lto --without-cloog > Thread model: posix > gcc version 4.8.3 (Gentoo 4.8.3) > > LFS: > ## gcc -v > Using built-in specs. > COLLECT_GCC=gcc > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.9.1/lto-wrapper > Target: i686-pc-linux-gnu > Configured with: ../gcc-4.9.1/configure --prefix=/usr > --enable-languages=c,c++ --disable-multilib --disable-bootstrap > --with-system-zlib > Thread model: posix > gcc version 4.9.1 (GCC) > > Slackware: > Reading specs from /slash/usr/bin/../lib/gcc/i486-slackware-linux/4.8.2/specs > COLLECT_GCC=gcc > COLLECT_LTO_WRAPPER=/slash/usr/bin/../libexec/gcc/i486-slackware-linux/4.8.2/lto-wrapper > Target: i486-slackware-linux > Configured with: ../gcc-4.8.2/configure --prefix=/usr > --libdir=/usr/lib --mandir=/usr/man --infodir=/usr/info > --enable-shared --enable-bootstrap > --enable-languages=ada,c,c++,fortran,go,java,lto,objc > --enable-threads=p osix --enable-checking=release --enable-objc-gc > --with-system-zlib --with-python-dir=/lib/python2.7/site-packages > --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp > --enable-lto --with-gnu-ld --verbose --enable-java-home > --with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm > --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory=i386 > --with-antlr-jar=/root/slackware-current/source/d/gcc/antlr-runtime-3.4.jar > --enable-java-awt=gtk --disable-gtktest --with-arch=i486 > --target=i486-slackware-linux --build=i486-slackware-linux > --host=i486-slackware-linux > Thread model: posix > gcc version 4.8.2 (GCC) > > I'm not elfwise, but I could post something to google drive if needed. Are you cross-compiling for different hardware? I'm just curious what results you get with --march=native. Also, I looked up data-sections and function-sections (which I'd never heard of before today :) The gcc man page says the resulting executable will be larger and slower, and not to use them "unless there are significant benefits" but then doesn't say what those benefits might be. Hm, cryptic.
Re: [gentoo-user] Running a program on a headless computer ?
I was deciding whether to reply earlier, and my worst fears were realized: you plan to start this automatically with no human intervention. Here is a snippet which should do what you want: `nohup my-program > /dev/null 2>&1 &` Screen and tmux will/should work, but at the very least I would suggest wrapping the program with a program of your own where you execute the other and have more and explicit control over the file descriptors. The best solution is modifying your programs to work headlessly. This also means you can ensure logging is done properly (you were logging, right?), and not in some ad-hoc fashion like reading all the messages your black box produces and keeping the ones that "look important." It's tempting to glue some things together with the shell, but I would avoid reliance on programs which are not yours as much as possible. "Not Invented Here" is often (rightfully) mocked, but this is one of the situations in which it has some relevance. On Sun, Sep 28, 2014 at 2:15 PM, Todd Goodman wrote: > * meino.cra...@gmx.de [140928 10:14]: > > Hi, > > > > I want to run programs, which insist on haveing a terminal > > to write their status to and which are writing files which > > their results on a headless computer (beaglebone). > > > > I tried things like > > > > my_program -o file.txt -parameter value > /dev/null &2>&1 & > > > > but this results in a idle copy of this process and a defunct > > child. > > > > The program does not use X11 in any way... > > > > Is there any neat trick to accomplish what I am trying to do here? > > > > Thank you very much in advance for any help! > > Best regards, > > mcc > > You probably want 2>&1 & > >
Re: [gentoo-user] Running a program on a headless computer ?
* meino.cra...@gmx.de [140928 10:14]: > Hi, > > I want to run programs, which insist on haveing a terminal > to write their status to and which are writing files which > their results on a headless computer (beaglebone). > > I tried things like > > my_program -o file.txt -parameter value > /dev/null &2>&1 & > > but this results in a idle copy of this process and a defunct > child. > > The program does not use X11 in any way... > > Is there any neat trick to accomplish what I am trying to do here? > > Thank you very much in advance for any help! > Best regards, > mcc You probably want 2>&1 &
Re: [gentoo-user] Running a program on a headless computer ?
On Sun, 28 Sep 2014 16:13:51 +0200, meino.cra...@gmx.de wrote: > I want to run programs, which insist on haveing a terminal > to write their status to and which are writing files which > their results on a headless computer (beaglebone). > > I tried things like > > my_program -o file.txt -parameter value > /dev/null &2>&1 & > > but this results in a idle copy of this process and a defunct > child. nohup may do what you want. Or you can do it with at, if atd is running echo "my_program -o file.txt -parameter value" | at now -- Neil Bothwick A wok is what you throw at a wabbit. signature.asc Description: PGP signature
Re: [gentoo-user] Running a program on a headless computer ?
2014-09-28 10:08 GMT-06:00 : > > Randolph Maaßen [14-09-28 16:24]: >> On Sep 28, 2014 4:14 PM, wrote: >> > >> > Hi, >> > >> > I want to run programs, which insist on haveing a terminal >> > to write their status to and which are writing files which >> > their results on a headless computer (beaglebone). >> > >> > I tried things like >> > >> > my_program -o file.txt -parameter value > /dev/null &2>&1 & >> > >> > but this results in a idle copy of this process and a defunct >> > child. >> > >> > The program does not use X11 in any way... >> > >> > Is there any neat trick to accomplish what I am trying to do here? >> > >> > Thank you very much in advance for any help! >> > Best regards, >> > mcc >> > >> > >> > >> >> I would suggest to run the program in a screen session, you can disconnect >> frim the session and reconnect later. >> >> http://www.gnu.org/software/screen/ >> >> -- >> Best regards >> Randolph Maaßen > > Hi Randolph, > > ...the headless device will be booted and the programm will be startet > via a kind of autostart script. No human intervention is > wanted/possible... > You can use ">&-" in the script to run the program with stdout closed by default, but this might result in an error if the program relies on stdout open example: --- $ echo "Hello" >&- bash: echo: write error: Bad file descriptor --- but if I do this(stdout and stderr closed): -- $ echo "Hello" 2>&- >&- -- nothing is printed but -- $ echo $? 1 -- However if I try to run an application that uses X it starts normally. more info on this stuff on [1] in page 15 it's kind of explained the case of programs running with ">&-" https://www.gnu.org/ghm/2011/paris/slides/jim-meyering-goodbye-world.pdf > Best regards, > mcc > > >
Re: [gentoo-user] Running a program on a headless computer ?
Stroller [14-09-28 18:52]: > > On Sun, 28 September 2014, at 5:08 pm, meino.cra...@gmx.de wrote: > >>> ... > >>> I want to run programs, which insist on haveing a terminal > >>> to write their status to and which are writing files which > >>> their results on a headless computer (beaglebone). > >> > >> I would suggest to run the program in a screen session, you can disconnect > >> frim the session and reconnect later. > > > > ...the headless device will be booted and the programm will be startet > > via a kind of autostart script. No human intervention is > > wanted/possible... > > It's certainly possible to write such scripts to start automatically. > > E.G. from tmux's manpage: > >tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach > > Tested here: > >#!/bin/bash >tmux new-session -n meino -d >tmux send -t meino ls ENTER > > You would be able to access this: > >$ tmux list-w >0: meino* (1 panes) [80x39] [layout c85d,80x39,0,0,0] @0 (active) >$ tmux a > > > I'm not saying that a terminal multiplexer is the best way to solve your > problem - I don't understand why the output of your program is not directable > to a text file - but it's definitely possible to script the process of > running a program in a terminal multiplexer window or session. > > You could write a script to see if a specific named session exists, and start > one if it doesn't. You could then call this every 5 minutes in cron. > > Note that, in the example above I've named the window "meino" - I think you > might be advised to name both window and session. You can attach sessions by > name. > > I referred to this page: > http://serverfault.com/questions/339390/run-command-in-detached-tmux-session > It's a top google hit for "run command in tmux" > > Stroller. > I tried to redirect the output, which technically is comparable with what can be seen by running "top". The result as mentioned is a somewhat locked process and its zombie child. Starting of whatever will accomplish what I am trying to do is already implemented (somewhow uglyish...;) and works...beside of the sideeffect that the program goes zombie. I definately will try the screen or tmux version (or both ;) ) ! Thank you very much for all help ! Best regards, mcc
Re: [gentoo-user] Running a program on a headless computer ?
On Sun, 28 September 2014, at 5:08 pm, meino.cra...@gmx.de wrote: >>> ... >>> I want to run programs, which insist on haveing a terminal >>> to write their status to and which are writing files which >>> their results on a headless computer (beaglebone). >> >> I would suggest to run the program in a screen session, you can disconnect >> frim the session and reconnect later. > > ...the headless device will be booted and the programm will be startet > via a kind of autostart script. No human intervention is > wanted/possible... It's certainly possible to write such scripts to start automatically. E.G. from tmux's manpage: tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach Tested here: #!/bin/bash tmux new-session -n meino -d tmux send -t meino ls ENTER You would be able to access this: $ tmux list-w 0: meino* (1 panes) [80x39] [layout c85d,80x39,0,0,0] @0 (active) $ tmux a I'm not saying that a terminal multiplexer is the best way to solve your problem - I don't understand why the output of your program is not directable to a text file - but it's definitely possible to script the process of running a program in a terminal multiplexer window or session. You could write a script to see if a specific named session exists, and start one if it doesn't. You could then call this every 5 minutes in cron. Note that, in the example above I've named the window "meino" - I think you might be advised to name both window and session. You can attach sessions by name. I referred to this page: http://serverfault.com/questions/339390/run-command-in-detached-tmux-session It's a top google hit for "run command in tmux" Stroller.
Re: [gentoo-user] Running a program on a headless computer ?
2014-09-28 18:08 GMT+02:00 : > > Randolph Maaßen [14-09-28 16:24]: >> On Sep 28, 2014 4:14 PM, wrote: >> > >> > Hi, >> > >> > I want to run programs, which insist on haveing a terminal >> > to write their status to and which are writing files which >> > their results on a headless computer (beaglebone). >> > >> > I tried things like >> > >> > my_program -o file.txt -parameter value > /dev/null &2>&1 & >> > >> > but this results in a idle copy of this process and a defunct >> > child. >> > >> > The program does not use X11 in any way... >> > >> > Is there any neat trick to accomplish what I am trying to do here? >> > >> > Thank you very much in advance for any help! >> > Best regards, >> > mcc >> > >> > >> > >> >> I would suggest to run the program in a screen session, you can disconnect >> frim the session and reconnect later. >> >> http://www.gnu.org/software/screen/ >> >> -- >> Best regards >> Randolph Maaßen > > Hi Randolph, > > ...the headless device will be booted and the programm will be startet > via a kind of autostart script. No human intervention is > wanted/possible... This is possilble with screen. yust start a screen session in your script screen -dmS "SessionName" and run the program you want screen -S "SessionName" -p 0 -X stuff "$program\n" where -p gives the screen window number > > Best regards, > mcc > > > -- Mit freundlichen Grüßen / Best regards Randolph Maaßen
Re: [gentoo-user] Running a program on a headless computer ?
On Sun, 28 September 2014, at 3:22 pm, Randolph Maaßen wrote: > ... > I would suggest to run the program in a screen session, you can disconnect > frim the session and reconnect later. > > http://www.gnu.org/software/screen/ If someone has never used `screen` before, I recommend using `tmux` instead. It has innumerable small improvements over `screen` and is very actively maintained. Stroller.
Re: [gentoo-user] Running a program on a headless computer ?
Randolph Maaßen [14-09-28 16:24]: > On Sep 28, 2014 4:14 PM, wrote: > > > > Hi, > > > > I want to run programs, which insist on haveing a terminal > > to write their status to and which are writing files which > > their results on a headless computer (beaglebone). > > > > I tried things like > > > > my_program -o file.txt -parameter value > /dev/null &2>&1 & > > > > but this results in a idle copy of this process and a defunct > > child. > > > > The program does not use X11 in any way... > > > > Is there any neat trick to accomplish what I am trying to do here? > > > > Thank you very much in advance for any help! > > Best regards, > > mcc > > > > > > > > I would suggest to run the program in a screen session, you can disconnect > frim the session and reconnect later. > > http://www.gnu.org/software/screen/ > > -- > Best regards > Randolph Maaßen Hi Randolph, ...the headless device will be booted and the programm will be startet via a kind of autostart script. No human intervention is wanted/possible... Best regards, mcc
Re: [gentoo-user] Running a program on a headless computer ?
On Sep 28, 2014 4:14 PM, wrote: > > Hi, > > I want to run programs, which insist on haveing a terminal > to write their status to and which are writing files which > their results on a headless computer (beaglebone). > > I tried things like > > my_program -o file.txt -parameter value > /dev/null &2>&1 & > > but this results in a idle copy of this process and a defunct > child. > > The program does not use X11 in any way... > > Is there any neat trick to accomplish what I am trying to do here? > > Thank you very much in advance for any help! > Best regards, > mcc > > > I would suggest to run the program in a screen session, you can disconnect frim the session and reconnect later. http://www.gnu.org/software/screen/ -- Best regards Randolph Maaßen
[gentoo-user] Running a program on a headless computer ?
Hi, I want to run programs, which insist on haveing a terminal to write their status to and which are writing files which their results on a headless computer (beaglebone). I tried things like my_program -o file.txt -parameter value > /dev/null &2>&1 & but this results in a idle copy of this process and a defunct child. The program does not use X11 in any way... Is there any neat trick to accomplish what I am trying to do here? Thank you very much in advance for any help! Best regards, mcc
[gentoo-user] bloated by gcc
I'm having a somewhat disgusting issue on my Gentoo: binaries are unaccountably large. I'm talking about C programs of my own, so no version related issues whatsoever. The computer is a core i3 with a 32 bit system. Example, for the same program: 10275 B on an atom running Slackware 14.1 (gcc 4.8.2) 5896 B (same, stripped with strip --strip-unneeded) 11675 B on i3, Gentoo, gcc 4.8.3 (with default gcc it was worse) 9704 B stripped 8207 B on *the same i3 box* running LFS (gcc 4.9.1) 5768 B stripped When compiling against dietlibc, the difference is even more shocking (almost double size in Gentoo after stripping). Compiled with: gcc -Os -march=i686 -fomit-frame-pointer -pipe -Wall -pedantic -fdata-sections -ffunction-sections -Wl,--gc-sections -fno-asynchronous-unwind-tables -std=c99 Gentoo: $ gcc -v Using built-in specs. COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/lto-wrapper Target: i686-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.8.3/work/gcc-4.8.3/configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include/g++-v4 --with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.8.3/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.3' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-altivec --disable-fixed-point --with-arch=i686 --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --enable-lto --without-cloog Thread model: posix gcc version 4.8.3 (Gentoo 4.8.3) LFS: ## gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.9.1/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../gcc-4.9.1/configure --prefix=/usr --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-system-zlib Thread model: posix gcc version 4.9.1 (GCC) Slackware: Reading specs from /slash/usr/bin/../lib/gcc/i486-slackware-linux/4.8.2/specs COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/slash/usr/bin/../libexec/gcc/i486-slackware-linux/4.8.2/lto-wrapper Target: i486-slackware-linux Configured with: ../gcc-4.8.2/configure --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap --enable-languages=ada,c,c++,fortran,go,java,lto,objc --enable-threads=posix --enable-checking=release --enable-objc-gc --with-system-zlib --with-python-dir=/lib/python2.7/site-packages --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp --enable-lto --with-gnu-ld --verbose --enable-java-home --with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory=i386 --with-antlr-jar=/root/slackware-current/source/d/gcc/antlr-runtime-3.4.jar --enable-java-awt=gtk --disable-gtktest --with-arch=i486 --target=i486-slackware-linux --build=i486-slackware-linux --host=i486-slackware-linux Thread model: posix gcc version 4.8.2 (GCC) I'm not elfwise, but I could post something to google drive if needed. TIA Jorge Almeida