2009-12-01 14:01:56 Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 82924
Hi,
Im having confusing issues with automake, configs and all that stuff!
Lets say i downloaded ....blackfin..uclinux-dist/branches/2009R1 from the SVN
configured it, compiled it, ran it, all was great
then i do a make clean,
then i navigate to the user/linphone/mediastreamer2 directory and add a new directory called plugins
inside this directory i place a self made .c file, which needs to compile and output a self contained .la binary file, and a simple makefile that does this.
Now my issue is, how do i get this to automatically build and have corresponding output in the users/linphone/Build-linphone... directory after re-building the uclinux image? what files would i need to modify?
Many thanks
Billy
QuoteReplyEditDelete
2009-12-01 15:31:00 Re: Adding custom files to the build
Mike Frysinger (UNITED STATES)
Message: 82928
does the file need to be linked into mediastreamer, or is it a standalone library ?
QuoteReplyEditDelete
2009-12-02 02:35:02 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 82937
standalone, its a plugin file, i need a spererate binary output which links some objects from the mediastreamer dir, but nothing needs to link 'me'
QuoteReplyEditDelete
2009-12-02 03:18:17 Re: Adding custom files to the build
Mike Frysinger (UNITED STATES)
Message: 82958
then dont put your package in the mediastreamer dir. give it its own dir under user/ and link to the library.
QuoteReplyEditDelete
2009-12-02 04:17:16 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 82962
so i have moved it to the /user dir
Done a make clean
then a make - and it doesnt get included automatically
so, now my question has to change to - what do i need to do to get a custom dir located in the /user dir included in the uclinux build process? could you indicate the minimum files needed or what files need changing?
Please excuse me here if i have missed something simple...
Many thanks
QuoteReplyEditDelete
2009-12-02 04:26:17 Re: Adding custom files to the build
Mike Frysinger (UNITED STATES)
Message: 82963
so edit user/Makefile to list your dir
QuoteReplyEditDelete
2009-12-02 04:47:50 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 82967
so how do i do this?
Lets say my folder is called linstuff
do i simply add
dir_y += linstuff
to the list?
Linphone doesnt seem to even appear in /user/Makefile
QuoteReplyEditDelete
2009-12-02 04:54:10 Re: Adding custom files to the build
Mike Frysinger (UNITED STATES)
Message: 82969
if you cant figure it out by reading the file, then read the documentation:
docs.blackfin.uclinux.org/doku.php?id=adding_user_applications
QuoteReplyEditDelete
2009-12-02 05:10:53 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 82971
thank you - i missed that while i was trying to search for something
documentation is what i needed
QuoteReplyEditDelete
2009-12-02 09:34:52 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 82977
This is just a nightmare....i hate makefiles...
So i followed the docs and yes, i have my new directory and yes i can include it from the menu....superb!
....but the makefile is a nightmare - i appreciate i come from a windows dev background but surly it shouldnt be so cryptic? I first found Linphone 3 days ago, since then ive customised it, recoded chunks of it, compiled it, run it on the hardware with remote debugging and everything - all sussed, tested and sorted in 3 days
Now, all i have to do is recompile 1 of the files as a plugin and im away - and its taking me 2 days just to try and get the file included in the build! unbelivable!! still cant get it sorted.
So, i am here again hoping someone can point me in the right direction....
I have 1 .c file called msgw.c, i want to output a .so type file from it called libmsgw.so, and i just need to link in 1 library: libmediastreamer to it - nice and simple
So a basic makefile - as suggested in the docs - didnt seem to work, as i dont have a main function, so i pass the -c flag but then of course it doesnt link
Trying to copy the style from the Linphone dir - but thats even more strange as its all the automake/conf stuff - which i have tried, but i am still having problems, as it seems to just use gcc as opposed to othe toolchain
So, could someone suggect to me, an example Makefile that i can use to build the file, link the library and output a .so type file using the blackfin toolchain...? surly it should be really simple
many thanks in advance
QuoteReplyEditDelete
2009-12-02 11:36:49 Re: Adding custom files to the build
Robin Getz (UNITED STATES)
Message: 82978
Billy:
This might help.
https://docs.blackfin.uclinux.org/doku.php?id=toolchain:creating_libraries#fdpic_elf_shared
As for your struggling with Makefile syntax - that isn't something that we can really help with. Buy a book on make is the only advice I can give.
https://docs.blackfin.uclinux.org/doku.php?id=references_and_pointers#o_reilly
-Robin
QuoteReplyEditDelete
2009-12-02 11:54:36 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 82979
Many thanks,
No its not a syntax issue, i have the books here and open, its a whats where and whats using what to do what issue!
I am nearly there i thin, i am down to a linking error - but, as mentioned above, i cant suss out which file from which program is calling the wrong linker! as im sure its not in my makefile...
The error is
Relocations in generic ELF (EM: 106)
But im pretty sure its because its calling /usr/bin/ld and not bfin-linux-uclibc-ld - just dont know where to correct it!!
billy@bfindevel:~/projects/uclinux/uclinux/user/linphonelis$ make
/bin/bash ./libtool --tag=CC --mode=compile bfin-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -DEMBED -D__uClinux__ -I/home/billy/projects/uclinux/uclinux -mcpu=bf537-0.2 -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/mediastreamer2/include -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/oRTP/include -pipe -Wall -g -O2 -mcpu=bf537-0.2 -fno-strict-aliasing -ffast-math -mfast-fp -Wl,--defsym,__stacksize=0x40000 -MT mslisgw.lo -MD -MP -MF .deps/mslisgw.Tpo -c -o mslisgw.lo mslisgw.c
libtool: compile: bfin-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -DEMBED -D__uClinux__ -I/home/billy/projects/uclinux/uclinux -mcpu=bf537-0.2 -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/mediastreamer2/include -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/oRTP/include -pipe -Wall -g -O2 -mcpu=bf537-0.2 -fno-strict-aliasing -ffast-math -mfast-fp -Wl,--defsym,__stacksize=0x40000 -MT mslisgw.lo -MD -MP -MF .deps/mslisgw.Tpo -c mslisgw.c -fPIC -DPIC -o .libs/mslisgw.o
bfin-linux-uclibc-gcc: --defsym: linker input file unused because linking not done
bfin-linux-uclibc-gcc: __stacksize=0x40000: linker input file unused because linking not done
libtool: compile: bfin-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -DEMBED -D__uClinux__ -I/home/billy/projects/uclinux/uclinux -mcpu=bf537-0.2 -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/mediastreamer2/include -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/oRTP/include -pipe -Wall -g -O2 -mcpu=bf537-0.2 -fno-strict-aliasing -ffast-math -mfast-fp -Wl,--defsym,__stacksize=0x40000 -MT mslisgw.lo -MD -MP -MF .deps/mslisgw.Tpo -c mslisgw.c -o mslisgw.o >/dev/null 2>&1
mv -f .deps/mslisgw.Tpo .deps/mslisgw.Plo
/bin/bash ./libtool --tag=CC --mode=link bfin-linux-uclibc-gcc -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/mediastreamer2/include -I/home/billy/projects/uclinux/uclinux/user/linphone/linphone-3.1.2/oRTP/include -pipe -Wall -g -O2 -mcpu=bf537-0.2 -fno-strict-aliasing -ffast-math -mfast-fp -Wl,--defsym,__stacksize=0x40000 -mcpu=bf537-0.2 -o libmslisgw.la -rpath /home/billy/projects/uclinux/uclinux/user/linphonelis/plugins mslisgw.lo -L/usr/local/lib -lmediastreamer -lortp -lpthread
libtool: link: gcc -shared .libs/mslisgw.o -L/usr/local/lib /usr/local/lib/libmediastreamer.so /usr/local/lib/libortp.so -lpthread -mcpu=bf537-0.2 -mfast-fp -Wl,--defsym -Wl,__stacksize=0x40000 -mcpu=bf537-0.2 -pthread -Wl,-soname -Wl,libmslisgw.so.0 -o .libs/libmslisgw.so.0.0.0
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
/usr/bin/ld: .libs/mslisgw.o: Relocations in generic ELF (EM: 106)
.libs/mslisgw.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [libmslisgw.la] Error 1
QuoteReplyEditDelete
2009-12-02 18:45:01 Re: Adding custom files to the build
Mike Frysinger (UNITED STATES)
Message: 82987
if you're going to run `make` outside of the uclinux-dist build system, you need to set the appropriate toolchain env vars
if you dont know how to do that, simply do something like:
make user/foo_only
also, that output shows that your build is using the wrong libraries (things from /usr/local/)
QuoteReplyEditDelete
2009-12-03 03:59:50 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 83018
Hi,
Yes i spotted the usr/local bit and corrected it, many thanks
Even if i build the whole kernel from the root dir it stops and errors at that point, if i copy the line onto the command prompt and change it to use the bfin gcc, it builds my library - huraah!!!
So, the last problem seems to be it selecting ld and not the bfin varient, this isnt in my Makefile tho, unless i need to transfer a env variable that ive missed, i have no references to just ld in my makefile, all are bfin related.
it may be that i need to add a section .c.so or something?
will try to find a similar library generating file to study
QuoteReplyEditDelete
2009-12-03 09:36:18 Re: Adding custom files to the build
Robin Getz (UNITED STATES)
Message: 83019
Billy:
I think the problem is somewhere in your libtool - not in the Makefile.
-Robin
QuoteReplyEditDelete
2009-12-03 09:47:56 Re: Adding custom files to the build
billy walton (UNITED KINGDOM)
Message: 83020
yes, i gave up, ripped it all out and started again from fresh
this time, i took the viewpoint of how the dist builds as opposed from how my software builds
Im starting to have success
Robin, the link you sent me, very good link, but a correction is needed i think.
In the FDPIC elf shared part, the example makefile, i think the line:
libbar.a: bar.o api.o
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
should be:
libbar.so: bar.o api.o
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
can you confirm?
QuoteReplyEditDelete
2009-12-04 06:24:27 Re: Adding custom files to the build
Mike Frysinger (UNITED STATES)
Message: 83087
thanks, ive fixed the typo in the wiki