Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 30 Aug 2014, 08:27
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Linking headers and libs with gnu make
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Tue 27 Apr 2010, 20:13    Post subject:  Linking headers and libs with gnu make  

I'm in the processes of building tilp2 for puppy and I need to compile a bunch of dependencies: libticonv, libtifiles, libticables, and libticalcs. Rather than build one, create a pet, install the pet, ...etc then go back and combine everything into one big pet, I would rather just build everything, combine everything into one directory and run dir2pet. The problem is I don't know how to link the dependencies without installing each one and using pkg-config. For example, I built libticonv ok because it didn't depend on any other tilibs. I used 'new2dir make install' and it created a directory libticonv-1.1 with all the files. I then started on libtifiles but it depends on libticonv. Since I did not install ticonv I don't know how to show make where the files are. The configure --help shows
Code:
TICONV_CFLAGS:  C compiler flags for TICONV, overriding pkg-config
  TICONV_LIBS: linker flags for TICONV, overriding pkg-config


I tried adding
Code:
TICONV_CFLAGS="/path/to/libticonv-1.1"

TICONV_LIBS="/path/to/libticonv-1.1" 

to ./configure but it make still did not find the headers
Code:
files8x.c:36:20: error: ticonv.h: No such file or directory


I've been reading man pages and tutorials but I can't seem to figure out what the problem is. Do I need to add the "-l" flag? Could anyone out there please explain to me what I'm doing wrong?
Back to top
View user's profile Send private message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Tue 27 Apr 2010, 23:50    Post subject:  

I use a throw away save file so I can install the needed things to build. Then when I'm done making the pets, I test them on a clean save. It's a lot less of a headache then trying to get configure to find things in nonstandard locations.

Also when I'm building, I just use regular make install, because sometimes the new2dir script screws up. It's easier to find the problem when you know your program worked before you ran the packaging scripts on it.
Back to top
View user's profile Send private message Visit poster's website 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Wed 28 Apr 2010, 17:52    Post subject:  

Hmmm, that sounds like a good idea, I will give it a try. Sometimes I fail to realize that I can do stuff like that with puppy. Although I am still curious how to do it with the configure script in case I'm in a similar situation on a non puppy machine.

So do you create the pet without the new2dir script? Or do you use make install to test the program, then go back and use new2dir?
Back to top
View user's profile Send private message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Wed 28 Apr 2010, 17:57    Post subject:  

If you run configure --help, there's usually a set of environment variables you can set to specify the locations of stuff.

I do make install first to test the program, then new2dir to create the pet.

Also you should always check the contents of the new directory before running dir2pet to make sure it it hasn't pulled in files you don't need.
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4347

PostPosted: Thu 29 Apr 2010, 01:45    Post subject:  

or better yet, since all of those libs are highly unlikely to be used by anything else, they should probably be compiled statically (then you won't have to combine all of the libs)
the common ./configure options are:
--enable-static --disable-shared --without-pic

(granted not all libs have a capable configure script)

(here is what I used as a first run for all libs and the binary -- if it fails I start eliminating flags starting with *sections)
CFLAGS=" -pipe -combine -Os -momit-leaf-frame-pointer -fomit-frame-pointer -ffunction-sections -fdata-sections -fmerge-all-constants -mpreferred-stack-boundary=2 -march=i386 -mtune=i686 " LDFLAGS=" -Wl,-O4,-Os,-relax,--sort-common,--gc-sections,-s " ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=i486-t2-linux-gnu --enable-static --disable-shared --without-pic
otherlibs.png
 Description   note that no libti* appear since they are statically linked
also shows what others you may need (all are in 431)
 Filesize   7.45 KB
 Viewed   804 Time(s)

otherlibs.png

tilp2-1.14-i486.pet
Description  no ti to test it with - I may have over-optimized it though
pet

 Download 
Filename  tilp2-1.14-i486.pet 
Filesize  191.84 KB 
Downloaded  335 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Thu 29 Apr 2010, 11:17    Post subject:  

Thanks technosaurus! I gave it a quick try with my ti8-83+ and it seemed to connect fine but the gui didn't respond when I tried to browse files, dump rom, etc. The terminal output had a bunch of glade glib warnings. I will try your instructions later when I get home and see if I can get it to work.

Just out of curiosity, why do you use -march=i386 -mtune=i686? I used -mtune=generic in the past bc I thought mtune implied march.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4347

PostPosted: Thu 29 Apr 2010, 12:16    Post subject:  

That is a common problem with glade and optimization if precautions are not taken within the code. Since the code is not used within the binary (it is called via glade) it gets eliminated by the linker as unused code. There is a flag (or flags) that you can pass to prevent that behaviour, but I can't remember (something allong the lines of -fno-*dce or -fno-*dse ??); however, since it negates a lot of optimization anyways, removing the -Os and the *sections flags should fix it and yield similar results. The alternative would be to patch that portion of code so that it isn't eliminated (probably too much work unless you want to be the new maintainer)

-march=i386 uses only 386 instructions which allows the compiler to find more patterns and generally produces smaller code that will work on more machines

-mtune=i686 will just format it to load better on 686 systems (assumes larger stack,register,cache...) but it will still run on older systems

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Fri 30 Apr 2010, 13:05    Post subject:  

Hey 2lss



I first try if the package can be built
and my work horse is slackware 12.2 for testing stuff like this
so that I don't lose a lot of time if it doesnt build there its lamed


this is a perfect example of why an organized approach to building packages is a must *not something extra*

download everything in
http://repository.slacky.eu/slackware-12.2/scientific/tilp2/1.12/src/

make a folder for tilibs then copy everything for that folder inside

run the tilibs2.SlackBuild build script
it makes and installs the correct libs

cd in to the folder
Code:
./tilibs2.SlackBuild



then change directories into the top src
run the build script tilp2.SlackBuild

Code:
./tilp2.SlackBuild


install tilp2-1.12-i486-1la.tgz

I have a TI 85 but I dont have a cable to test it

years ago I built a circuit and a cable for an older model TI
and connected using qbasic using some how to dont laugh it worked Laughing

enjoy

linux-gate.so.1 =>
libticalcs2.so.7 => /usr/lib/libticalcs2.so.7
libticables2.so.1 => /usr/lib/libticables2.so.1
libtifiles2.so.5 => /usr/lib/libtifiles2.so.5
libticonv.so.3 => /usr/lib/libticonv.so.3
libglade-2.0.so.0 => /usr/lib/libglade-2.0.so.0
libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0
libxml2.so.2 => /usr/lib/libxml2.so.2
libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0
libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0
libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0
libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0
libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0
libcairo.so.2 => /usr/lib/libcairo.so.2
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0
libkdecore.so.4 => /usr/lib/libkdecore.so.4
libkdeui.so.4 => /usr/lib/libkdeui.so.4
libkio.so.4 => /usr/lib/libkio.so.4
libXext.so.6 => /usr/lib/libXext.so.6
libX11.so.6 => /usr/lib/libX11.so.6
libSM.so.6 => /usr/lib/libSM.so.6
libICE.so.6 => /usr/lib/libICE.so.6
libpng12.so.0 => /usr/lib/libpng12.so.0
libresolv.so.2 => /lib/libresolv.so.2
libutil.so.1 => /lib/libutil.so.1
libqt-mt.so.3 => /usr/lib/qt-3.3.8b/lib/libqt-mt.so.3
libjpeg.so.62 => /usr/lib/libjpeg.so.62
libGL.so.1 => /usr/lib/libGL.so.1
libpng.so.3 => /usr/lib/libpng.so.3
libz.so.1 => /usr/lib/libz.so.1
libpthread.so.0 => /lib/libpthread.so.0
libacl.so.1 => /lib/libacl.so.1
libattr.so.1 => /lib/libattr.so.1
libdl.so.2 => /lib/libdl.so.2
libstdc++.so.6 => /usr/lib/libstdc++.so.6
libm.so.6 => /lib/libm.so.6
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libc.so.6 => /lib/libc.so.6
libusb-0.1.so.4 => /usr/lib/libusb-0.1.so.4
libXcomposite.so.1 => /usr/lib/libXcomposite.so.1
libXdamage.so.1 => /usr/lib/libXdamage.so.1
libXfixes.so.3 => /usr/lib/libXfixes.so.3
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1
libXrender.so.1 => /usr/lib/libXrender.so.1
libXinerama.so.1 => /usr/lib/libXinerama.so.1
libXi.so.6 => /usr/lib/libXi.so.6
libXrandr.so.2 => /usr/lib/libXrandr.so.2
libXcursor.so.1 => /usr/lib/libXcursor.so.1
libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0
libfreetype.so.6 => /usr/lib/libfreetype.so.6
libpixman-1.so.0 => /usr/lib/libpixman-1.so.0
libDCOP.so.4 => /usr/lib/libDCOP.so.4
libart_lgpl_2.so.2 => /usr/lib/libart_lgpl_2.so.2
libidn.so.11 => /usr/lib/libidn.so.11
libkdefx.so.4 => /usr/lib/libkdefx.so.4
libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0
libxcb.so.1 => /usr/lib/libxcb.so.1
libXau.so.6 => /usr/lib/libXau.so.6
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6
libmng.so.1 => /usr/lib/libmng.so.1
libXmu.so.6 => /usr/lib/libXmu.so.6
libXft.so.2 => /usr/lib/libXft.so.2
libkdesu.so.4 => /usr/lib/libkdesu.so.4
libkwalletclient.so.1 => /usr/lib/libkwalletclient.so.1
liblcms.so.1 => /usr/lib/liblcms.so.1
libXt.so.6 => /usr/lib/libXt.so.6
libexpat.so.1 => /usr/lib/libexpat.so.1
libfam.so.0 => /usr/lib/libfam.so.0
libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1
libdrm.so.2 => /usr/lib/libdrm.so.2
/lib/ld-linux.so.2




I noticed that uses an older version of QT and also some kde libs
which would have to be resolved to get a working package on puppy


the good news is the package can be built
now the tinkering begins Very Happy


Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Sun 02 May 2010, 16:04    Post subject:  

technosaurus: I cut out some of the optimization and ended up with
Code:
CFLAGS=" -pipe -combine -momit-leaf-frame-pointer -fomit-frame-pointer -fmerge-all-constants -mpreferred-stack-boundary=2 -march=i386 -mtune=i686 " LDFLAGS=" -Wl,-relax,--sort-common,-s " ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=i486-t2-linux-gnu --enable-static --disable-shared --without-pic


Everything seems to be working now, however after building the pet I discovered that libticonv did not build statically.
Code:
# ldd /usr/bin/tilp | grep ti
   libticonv.so.4 => /usr/lib/libticonv.so.4 (0xb774c000)


Any idea why this would be?

big_bass: Thanks for the link, I already have tilp installed so I didn't try it yet. The next time I need to build something I will go there first though (most likely grass GIS). It seems like it would be way easier. I wonder how hard it would be to build a 'Master script' that could download all of the components, run the **.SlackBuild script, new2dir, and then dir2pet?
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4347

PostPosted: Sun 02 May 2010, 17:58    Post subject:  

most common reason for me is a typo, usually --enable-static--disable-shared (missing a space between tags)
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Sun 02 May 2010, 21:10    Post subject:  

Ok, got it working. Had to add -Os to CFLAGS.

I have a working pet, now looking for a place to upload. Anyone have any suggestions?
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 03 May 2010, 20:00    Post subject:  

2lss

good to hear you got a working package

I still gave it another shot anyway building without kde and static
just so you know there are several ways to solve the same problem
depending on who you ask

I normally don't build static but for this type of small app with many required libs it ok to do so

I made a desktop
and icon that is displayed in the menu
also its all combined in to one package with docs for each package
I also made a slack-desc so its an official package
there is also an install script that makes the symlinks for you all combined

even though I spent much time trying to build puppy packages from source using scripts if you search back a few years starting with getting src2pkg working on puppy 3.01 there has not been much interest from developers... so I now build all my packages from source
as slackware compatible packages this way
anyone that does use linux could easily adjust the package to work
for their version


its 855k
maybe someone may need it so here it is
there may still be something there for you if you compare the packages
http://puppy2.org/slaxer/tilp2-1-i486-2slxr.tgz

Joe
tilp2_main_menu.png
 Description   
 Filesize   107.09 KB
 Viewed   743 Time(s)

tilp2_main_menu.png

tilp2_console_out.png
 Description   
 Filesize   24.7 KB
 Viewed   722 Time(s)

tilp2_console_out.png


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0922s ][ Queries: 12 (0.0048s) ][ GZIP on ]