Reply
Thread Tools
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#11
Originally Posted by ESmith View Post
Thanks, Nicolai, that's what I "feel", too. And I have been trying to include this into the gcc-statement.

But I have no idea, how to add it. I assume(d) that ESbox would take care of the necessary libraries to include. If not, how can I add them manually to the compiler statement (in ESbox)?
The project/application is built using make. make relies on special files called Makefiles. These are typically generated on the fly by ESbox so you won't have to bother understanding them.

In said Makefile, the pkg-config system is used. This enables you to ask for specific compiler flags. Have a look at how it works and you'll get it in no time.

To add flags by hand is easy too. Just copy and paste the compiler call in your terminal, add -llocation and press return. Tadah!
 

The Following User Says Thank You to Joorin For This Useful Post:
Posts: 13 | Thanked: 1 time | Joined on Apr 2010 @ Helsinki
#12
Allright, now we're getting somewhere... Thanks for the quick feedback everyone!

In my setup there are two "Makefile"-files, one in the source-folder "src", and one in the root folder of the project. I added
-I/usr/lib to the DEPS_CFLAGS-attribute and
-llocation to the DEPS_LIBS-attribute.

No more compilation errors after that regarding the undefined references.
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#13
Just remember that case matter. "-L" is not the same thing as "-l".

So, either you did a typo while you wrote the previous message or you actually added "-l/usr/lib" which makes no sense to the linker.
 
Posts: 13 | Thanked: 1 time | Joined on Apr 2010 @ Helsinki
#14
Originally Posted by Joorin View Post
Just remember that case matter. "-L" is not the same thing as "-l".
That is understood, case matters.

So, either you did a typo while you wrote the previous message or you actually added "-l/usr/lib" which makes no sense to the linker.
Well, that's where my lack of understanding of Makefile-files continues:
In the Makefile-file in the root folder are several CFLAGS- and LIBS-attributes: DEPS, HILDON and OSSO. And in those, the directories are referenced with "-I" (capital "I", not small "L") ?!? Now I don't know to which of these attributes to add the flags for the location directory, but believe it or not, by doing as per my previous post ESbox succesfully compiles.

Code:
make -k all "CFLAGS=-O0 -g" "CXXFLAGS=-O0 -g"

make  all-recursive
make[1]: Entering directory `/home/maemo/workspace/Template'
Making all in data
make[2]: Entering directory `/home/maemo/workspace/Template/data'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/maemo/workspace/Template/data'
Making all in po
make[2]: Entering directory `/home/maemo/workspace/Template/po'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/maemo/workspace/Template/po'
make[2]: Entering directory `/home/maemo/workspace/Template'
gcc  -O0 -g   -o template  main.o -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgnomevfs-2 -lgconf-2 -lgthread-2.0 -lrt -lgmodule-2.0 -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0 -llocation   -pthread -lhildon-1 -lhildonfm -lgtk-x11-2.0 -lgnomevfs-2 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgconf-2 -lgthread-2.0 -lrt -lgmodule-2.0 -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0   -losso -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0   
make[2]: Leaving directory `/home/maemo/workspace/Template'
make[1]: Leaving directory `/home/maemo/workspace/Template'

*** exited with code 0


So, compiling in ESbox completes without error, but the program does not run in Scratchbox. And creation of a Debian package fails, too. And since GPS emulation is not possible in ESbox/Scratchbox, I do have to export to run it on a N900 device.

Console output for Debian package creation:
Code:
dpkg-buildpackage: source package is template
dpkg-buildpackage: source version is 1.0.0
dpkg-buildpackage: source changed by ESmith<esmith@esmith.fi>
dpkg-buildpackage: host architecture armel
 fakeroot debian/rules clean
dpkg-buildpackage: source version without epoch 1.0.0
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp 
# Add here commands to clean up after the build process.
mv debian/rules debian/rules.save
/scratchbox/tools/bin/make distclean
make[1]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
Making distclean in po
make[2]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/po'
rm -f *.pox template.pot *.old.po cat-id-tbl.tmp
rm -f .intltool-merge-cache
rm -f Makefile Makefile.in POTFILES stamp-it
rm -f *.mo *.msg *.cat *.cat.m *.gmo
make[2]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/po'
Making distclean in data
make[2]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/data'
rm -f com.nokia.template.service template.desktop
rm -f Makefile
make[2]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/data'
Making distclean in .
make[2]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
test -z "template" || rm -f template
rm -f *.o
rm -f *.tab.c
rm -f 
rm -f config.h stamp-h1
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
make[2]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
rm -f config.status config.cache config.log configure.lineno configure.status.lineno
rm -rf ./.deps
rm -f Makefile
make[1]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
mv debian/rules.save debian/rules
dh_clean
 dpkg-source -b Template
dpkg-source: warning: source directory `./Template' is not <sourcepackage>-<upstreamversion> `template-1.0.0'
dpkg-source: building template in template_1.0.0.tar.gz
dpkg-source: building template in template_1.0.0.dsc
 debian/rules build
test -e ./configure || ./autogen.sh 
dh_testdir
# Add here commands to configure the package.
CFLAGS="-Wall -g -O2" CXXFLAGS="" ./configure --prefix=/usr
checking for a BSD-compatible install... /scratchbox/tools/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 ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /scratchbox/tools/bin/grep
checking for egrep... /scratchbox/tools/bin/grep -E
checking for ANSI C header files... yes
checking for a BSD-compatible install... /scratchbox/tools/bin/install -c
checking for pkg-config... /scratchbox/tools/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for DEPS... yes
checking for HILDON... yes
checking for OSSO... yes
checking for OSSOSETTINGS... yes
checking whether NLS is requested... yes
checking for intltool >= 0.35.0... 0.40.5 found
checking for intltool-update... /scratchbox/devkits/doctools/bin/intltool-update
checking for intltool-merge... /scratchbox/devkits/doctools/bin/intltool-merge
checking for intltool-extract... /scratchbox/devkits/doctools/bin/intltool-extract
checking for xgettext... /scratchbox/tools/bin/xgettext
checking for msgmerge... /scratchbox/tools/bin/msgmerge
checking for msgfmt... /scratchbox/tools/bin/msgfmt
checking for gmsgfmt... /scratchbox/tools/bin/msgfmt
checking for perl... /scratchbox/tools/bin/perl
checking for XML::Parser... ok
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking for LC_MESSAGES... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for ngettext in libc... yes
checking for dgettext in libc... yes
checking for bind_textdomain_codeset... yes
checking for msgfmt... (cached) /scratchbox/tools/bin/msgfmt
checking for dcgettext... yes
checking if msgfmt accepts -c... yes
checking for gmsgfmt... (cached) /scratchbox/tools/bin/msgfmt
checking for xgettext... (cached) /scratchbox/tools/bin/xgettext
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating data/Makefile
config.status: creating po/Makefile.in
config.status: creating data/com.nokia.template.service
config.status: creating data/template.desktop
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: executing po/stamp-it commands
# INTLTOOL_MAKEFILE
touch configure-stamp
dh_testdir
# Add here commands to compile the package.
/scratchbox/tools/bin/make
make[1]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
/scratchbox/tools/bin/make  all-recursive
make[2]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
Making all in data
make[3]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/data'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/data'
Making all in po
make[3]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/po'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/po'
make[3]: Entering directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
if gcc -DHAVE_CONFIG_H -I. -I. -I. -DMAEMO_CHANGES -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include   -DMAEMO_CHANGES -DMAEMO_GTK -pthread -I/usr/include/hildon-1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/hildon-fm-2 -I/usr/include/gconf/2 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include   -I/usr/include/dbus-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/dbus-1.0/include      -Wall -g -O2 -Wall -ansi -pedantic -Wmissing-prototypes -Wmissing-declarations -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o `test -f 'src/main.c' || echo './'`src/main.c; \
	then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi
gcc  -Wall -g -O2 -Wall -ansi -pedantic -Wmissing-prototypes -Wmissing-declarations   -o template  main.o -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgnomevfs-2 -lgconf-2 -lgthread-2.0 -lrt -lgmodule-2.0 -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0   -pthread -lhildon-1 -lhildonfm -lgtk-x11-2.0 -lgnomevfs-2 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgconf-2 -lgthread-2.0 -lrt -lgmodule-2.0 -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0   -losso -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0   
make[3]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
make[2]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
make[1]: Leaving directory `/home/maemo/.mica/.dpkg-buildpackage-tmp/Template'
main.o: In function `main':
/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/src/main.c:79: undefined reference to `location_gpsd_control_get_default'
/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/src/main.c:80: undefined reference to `location_gps_device_get_type'
main.o: In function `start_location':
/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/src/main.c:65: undefined reference to `location_gpsd_control_start'
main.o: In function `on_changed':
/home/maemo/.mica/.dpkg-buildpackage-tmp/Template/src/main.c:52: undefined reference to `location_gpsd_control_stop'
collect2: ld returned 1 exit status
make[3]: *** [template] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [build-stamp] Error 2

So, my questions are:

-Where exactly do I have to add the flags in Makefile and in which Makefile (/src vs. root)?
-How come it compiles locally but fails with the above error when creating a Debian package?
-Where to read on documentation about how to configure this in ESbox? (I assumed ESbox would automatically take care of things like that.)
 
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#15
Originally Posted by ESmith View Post
So, my questions are:

-Where exactly do I have to add the flags in Makefile and in which Makefile (/src vs. root)?
-How come it compiles locally but fails with the above error when creating a Debian package?
-Where to read on documentation about how to configure this in ESbox? (I assumed ESbox would automatically take care of things like that.)
I don't know esbox :-(, I can just guess. May it be, that esbox (or the
eclipse build environment) just generates these Makefiles. If you change
them your manual build may succeed but from within esbox or when
building the package they are re-generated and your changes vanish?

By the way, those compiler and linker flags are often set through pkg-config like
"pkg-config --cflags --libs liblocation".
Does esbox provide thome project settings where you can set dependency with
pkg-config?
 
Posts: 13 | Thanked: 1 time | Joined on Apr 2010 @ Helsinki
#16
Originally Posted by nicolai View Post
May it be, that esbox (or the
eclipse build environment) just generates these Makefiles. If you change
them your manual build may succeed but from within esbox or when
building the package they are re-generated and your changes vanish?
I think that can be excluded, as the Makefiles are in the project folders and editable. The changes remain in the files after a build.


By the way, those compiler and linker flags are often set through pkg-config like
"pkg-config --cflags --libs liblocation".
Does esbox provide thome project settings where you can set dependency with
pkg-config?
I am looking for these settings, too, so I would just add my dependencies manually and be happy for the time being.

Currently it look as if I found a promising lead for this: In the "configure.ac" file I add "liblocation >= 0.1" to make it look like this:

Code:
PKG_CHECK_MODULES(DEPS, gtk+-2.0 >= 2.2 glib-2.0 >= 2.2 gnome-vfs-2.0 >= 2.2 liblocation >= 0.1)
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)
No other files were modified, the previous modifications (see previous posts) to the Makefile were "undone".

It builds, I can create a Debian package, it installs on the N900 and it runs.

More testing to be done, though...
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#17
And this configure.ac file is most likely generated by ESBox using some list of libraries that will be needed for the project. To be forced to add a dependency like this by modifying the file by hand looks like a bug in ESBox.
 
Reply


 
Forum Jump


All times are GMT. The time now is 00:28.