Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: jls on May 01, 2009, 08:55:23 AM
-
I've used
g++ countdown.cxx `fltk-config --ldflags` -o countdown && ./countdown
but this generates a big executable compared to the ones present in the base system
-
Using fltk-config creates static executeables.
Tiny Core has the fltk libs in the base, so compile to use shared libs will be much smaller.
g++ -Os -fno-exceptions -fno-rtti -lfltk -o countdown countdown.cxx
strip countdown
will usually work.
Depending on the source you may also need to add
-lfltk_images -lfltk_forms
-
g++ -Os -fno-exceptions -fno-rtti -lfltk -lfltk_images -lfltk_forms -o appbrowser appbrowser.cxx
/tmp/cc0t9Vm1.o: In function `btn_callback(Fl_Widget*, void*)':
appbrowser.cxx:(.text+0x9a): undefined reference to `Fl_Browser::load(char const*)'
appbrowser.cxx:(.text+0xa6): undefined reference to `Fl_Widget::deactivate()'
appbrowser.cxx:(.text+0xb2): undefined reference to `Fl_Widget::deactivate()'
appbrowser.cxx:(.text+0xbe): undefined reference to `Fl_Widget::activate()'
.....
-
might need to set CPPFLAGS for the fltk headers? Just guessing.
-
appbrowser compiles fine for me on both 1.x (compiletc) and 2.x (gcc-binutils) with:
tc@dev:~$ g++ -Os -fno-exceptions -fno-rtti -lfltk -o appbrowser appbrowser.cxx
tc@dev:~$
Be sure that you have both the .cxx and .h files together.
-
How do I set CPPFLAGS for the fltk headers?
-
Robert: I've used your command and both the .cxx and .h files together. But I got the error above.
-
Actually I got the same error also using the command that before was working:
g++ appbrowser.cxx `fltk-config --ldflags` -o appbrowser.
I'm in PPI mode with compiletc.tcz installed.
Last time I've used PPR/TCZ, I'll reboot and try this
-
g++ appbrowser.cxx `fltk-config --ldflags` -o appbrowser
ok
g++ -Os -fno-exceptions -fno-rtti -lfltk -o appbrowser appbrowser.cxx
error
-
g++ appbrowser.cxx -Os -fno-exceptions -fno-rtti -lfltk -o appbrowser
/tmp/tcloop/compiletc/usr/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/../../../libfltk.a(Fl.o): In function `Fl::flush()':
(.text+0x7f6): undefined reference to `XDestroyRegion'
/tmp/tcloop/compiletc/usr/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/../../../libfltk.a(Fl.o): In function `Fl::flush()':
(.text+0x81c): undefined reference to `XFlush'
/tmp/tcloop/compiletc/usr/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/../../../libfltk.a(Fl.o): In function `Fl_Window::hide()':
(.text+0x162c): undefined reference to `XDestroyRegion'
/tmp/tcloop/compiletc/usr/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/.......
g++ appbrowser.cxx -Os -fno-exceptions -fno-rtti -lfltk -lXext -o appbrowser
the second command is ok but produces a big file
-
If I boot TC 2.0rc1 with base norestore nolocal, i.e., pristine state.
Then grab gcc-binutils.tce from appbrowser, so that I get the .deps, then
appbrowser compiles fine.
I even grabbed the source from ibiblio, to be sure that my source is not different.
-
Ok now in 2.0RC1 your way works, but the size of the binary is still huge compared to the one in the base system.
g++ -Os -fno-exceptions -fno-rtti -lfltk -o add2file add2file.cxx
strip add2file
results an add2fle of 386824 KB, where the one in the base system is just 4656 KB
The thing is that I just grabbed this app from the src dir from ibiblio, actually from the nluug.nl miror, since I'm in europe, and just compiled and stripped, without modifying either the .ccx or the .h
-
Try it in a pristine 1.4 with compiletc and see the difference :o
-
ok, it works from pristine 1.4 using compiletc.tce.
sizes now are similar:
appbrowser compiled by me: 11376 KB, original binary: 9947.
Thanx Robert