maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   undefined reference mafw_shared_init (https://talk.maemo.org/showthread.php?t=52663)

PeroMed 2010-05-14 14:29

undefined reference mafw_shared_init
 
Hello,

I tried to run the example with qt madde in windows with nokia n900.

Example is here:

http://wiki.maemo.org/Documentation/...browse_example

Source browse example is the example i am trying to run and I get undefined reference mafw_shared_init error.

I incuded mafw and mafw-shared libs but I still have this error.

How do I fix this problem.

Thank you for your help.

gri 2010-05-14 17:02

Re: undefined reference mafw_shared_init
 
You included or you linked? How about some quotations of your .pro-file? Please provide some more information.

Edit: Oops, this is not a Qt project ...

So you get the errors when running the application or when linking? What's the "ldd" output?

PeroMed 2010-05-17 06:11

Re: undefined reference mafw_shared_init
 
In my .pro file ther is only
LIBS += -lmafw -lmafw-shared
that I added.
Everything else was already there...

Joorin 2010-05-17 06:19

Re: undefined reference mafw_shared_init
 
Could you please supply all the output from the compiling stage?

PeroMed 2010-05-17 06:44

Re: undefined reference mafw_shared_init
 
Here is the compile output

Quote:

Running build steps for project test3...
Starting: c:/madde/0.6.14/targets/fremantle-qt-0951/bin/qmake.exe C:/NokiaQtSDK/QtCreator/bin/test3/test3.pro -r -spec default -unix CONFIG+=debug
Exited with code 0.
Starting: C:/madde/0.6.14/bin/make.exe LFLAGS=-v -w
make: Entering directory `/c/NokiaQtSDK/QtCreator/bin/test3'
g++ -v -o test3 main.o mainwindow.o moc_mainwindow.o -LC:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib -Wl,-rpath-link=/usr/lib -lmafw -lmafw-shared -lQtGui -lQtCore -lpthread
Using built-in specs.
Reading specs from C:/MADDE/0.6.14/targets/fremantle-qt-0951/specs
rename spec cc1 to old_cc1
rename spec cc1plus to old_cc1plus
rename spec link to old_link
Target: arm-none-linux-gnueabi
Configured with: /data/users/savanain/cross-build/src/gcc-4.2/configure --build=i686-linux-gnu --host=i586-mingw32msvc --target=arm-none-linux-gnueabi --prefix=/data/users/savanain/cross-build/arm-w32/tools --with-sysroot=/data/users/savanain/cross-build/arm-w32/sysroot --with-gmp=/data/users/savanain/cross-build/arm-w32/utils --with-mpfr=/data/users/savanain/cross-build/arm-w32/utils --with-libiconv-prefix=/data/users/savanain/cross-build/arm-w32/utils --with-gnu-as --with-gnu-ld --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-libgomp --enable-poison-system-directories --enable-threads --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++
Thread model: posix
gcc version 4.2.1
c:/madde/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/../libexec/gcc/arm-none-linux-gnueabi/4.2.1/collect2.exe -O 1 --hash-style=gnu -L=/usr/lib/gcc/arm-linux-gnueabi/4.2 --sysroot=C:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453 --eh-frame-hdr -dynamic-linker /lib/ld-linux.so.3 -X -m armelf_linux_eabi -o test3 C:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib/crt1.o C:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib/crti.o c:/madde/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/crtbegin.o -L=/usr/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib -Lc:/madde/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1 -Lc:/madde/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/../lib/gcc -Lc:/madde/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/lib -LC:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/lib -LC:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib main.o mainwindow.o moc_mainwindow.o -rpath-link=C:/madde/0.6.14/lib -lmafw -lmafw-shared -lQtGui -lQtCore -lpthread -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc c:/madde/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/crtend.o C:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib/crtn.o
make: Leaving directory `/c/NokiaQtSDK/QtCreator/bin/test3'
mainwindow.o: In function `app_init(char*)':
mainwindow.cpp:(.text+0xacc): undefined reference to `mafw_shared_init(_MafwRegistry*, _GError**)'
collect2: ld returned 1 exit status
command: C:/MADDE/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/arm-none-linux-gnueabi-g++.exe
arg 0: C:/MADDE/0.6.14/toolchains/arm-2007q3-51sb6-arm-none-linux-gnueabi_w32/bin/arm-none-linux-gnueabi-g++.exe
arg 1: --sysroot=C:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453
arg 2: -specs=C:/MADDE/0.6.14/targets/fremantle-qt-0951/specs
arg 3: -v
arg 4: -o
arg 5: test3
arg 6: main.o
arg 7: mainwindow.o
arg 8: moc_mainwindow.o
arg 9: -L=/usr/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib
arg 10: -Wl,-rpath-link=C:/madde/0.6.14/lib
arg 11: -lmafw
arg 12: -lmafw-shared
arg 13: -lQtGui
arg 14: -lQtCore
arg 15: -lpthread
make: *** [test3] Error 1
Exited with code 2.
Error while building project test3 (target: Maemo)
When executing build step 'Make'

Joorin 2010-05-17 10:13

Re: undefined reference mafw_shared_init
 
One interesting thing I see directly is the following:

-L=/usr/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/lib

This instructs the linker to look for dynamically linkable libraries in a path that differs greatly from the rest given as arguments to -L. Is the sysroot prefix properly defined? Have a look for where this value is added.

Secondly, do a search in the system for a file matching "libmafw-shared*". This directory has to be added as an argument for an -L flag for this to work.

My guess is that the special -L above is the cause for all this or that the directory is just missing in the list. Perhaps it's even a bug in MADDE...

PeroMed 2010-05-17 14:14

Re: undefined reference mafw_shared_init
 
I have everything linked correctly...
Could somebody try to build this example http://wiki.maemo.org/Documentation/...browse_example ?

I tried this in windows qt madde developer and on linux and i cant get
it to work.

Joorin 2010-05-17 14:38

Re: undefined reference mafw_shared_init
 
Did you find the libmafw-shared.so.* file in your MADDE installation?

Per definition you have not everything linked correctly.

As a side note, the example is C code and you compile it with g++. Perhaps not too important but it might cause you problems since the library you're linking against most likely was compiled from C code.

gri 2010-05-17 19:08

Re: undefined reference mafw_shared_init
 
You should also not add the linker lines directly.

Please use in your .pro file:
CONFIG += link_pkgconfig
PKGCONFIG += mafw-shared

Note for the Nokia Qt SDK: Using pkg-config works when compiling with the commandline. Don't use QtCreator (results in compiler errors).

Bugfix for MADDE 0.6.14 (MADDE standalone):
In "sysroots\fremantle-arm-sysroot-2.2009-51-1-qt453\usr\share\qt4\mkspecs\features\link_pkgconfi g.prf" you have to change the system() calls to run "mad pkg-config" instead of just "pkg-config"

Edit:
I have tested the example from your link an it works well for me:
http://gri.not-censored.com/mafwtest.png

You can download the example sources here.

PeroMed 2010-05-18 07:05

Re: undefined reference mafw_shared_init
 
thank you gri and Joorin. I compiled it and it works. How do I run it now when i compiled example in madde terminal?


All times are GMT. The time now is 12:09.

vBulletin® Version 3.8.8