Open GoogleCodeExporter opened 9 years ago
The only command you need to enter in order to compile the SDL examples is
make -f Makefile.examples sdl
I think it's quite obvious that the linker cannot find SDL_image, do you have
SDL_image properly installed? I can see you force to use of SDL_image, so I bet
the
configure script cannot find SDL_image which means the linker cannot find
SDL_image
either.
Original comment by olof.nae...@gmail.com
on 29 Feb 2008 at 12:42
Sorry, i have installed SDL at /usr/local, not @ /usr, the test used by
configure
don't found SDL_Image.h .
if I set CPPFLAGS=-I/usr/local/include and LDFLAGS=-L/usr/local/lib for this to
work, they found SDL_Image.h my configure is:
./configure CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
the result is:
-------------------------------
Guichan ready for compilation!
-------------------------------
* Allegro = disabled
* HGE = no (Windows specific and cannot be built)
* OpenGL = no
* OpenLayer = no (Requires static build and cannot be built)
* SDL = yes
* SDL Image = yes
--------------------------------
Now, for examples if I don't set -I and -L flags the compiler don´t found headers
and libs. if I set CFLAGS="-I/usr/local/include -L/usr/local/lib " the example
compile, but they don't link with the errors:
C:/DOCUME~1/794811~1.SEC/CONFIG~1/Temp/ccIRbaaa.o:sdlhelloworld.cpp:(.text+0x1cd
):
undefined reference to `_imp___ZN3gcn5Image14setImageLoaderEPNS_11ImageLoaderE'
C:/DOCUME~1/794811~1.SEC/CONFIG~1/Temp/ccIRbaaa.o:sdlhelloworld.cpp:(.text+0x1ef
):
undefined reference to `_imp___ZN3gcn11SDLGraphicsC1Ev'
C:/DOCUME~1/794811~1.SEC/CONFIG~1/Temp/ccIRbaaa.o:sdlhelloworld.cpp:(.text+0x290
):
undefined reference to `_imp___ZN3gcn8SDLInputC1Ev'
C:/DOCUME~1/794811~1.SEC/CONFIG~1/Temp/ccIRbaaa.o:sdlhelloworld.cpp:(.text+0x312
):
undefined reference to `_imp___ZN3gcn9ContainerC1Ev'
maybe I must set libs @ /usr/lib ???. or /mingw/lib ??
regards
Original comment by uberiai...@gmail.com
on 29 Feb 2008 at 3:52
I think you should see what ldconfig -v outputs, do you have SDL_image there?
If not,
then SDL_image cannot be automatically found by the linker.
Original comment by olof.nae...@gmail.com
on 29 Feb 2008 at 4:35
Sorry, but mingw don't use ldconfig , and I am using SDL_image with other
programs,
and is working.
I found this http://guichan.sourceforge.net/forum/read.php?3,571,1494#msg-1494
, the
problem is the same?.
Original comment by uberiai...@gmail.com
on 29 Feb 2008 at 5:06
Might be. I never use MinGW so I can't really help you with this one. Somehow
the
linker needs to be able to find SDL_image, and it doesn't in your case.
How do you use SDL_image, with -lSDL_image?
Original comment by olof.nae...@gmail.com
on 29 Feb 2008 at 5:32
yes I use -lSDL_image, i see this ->http://humming.dip.jp/wiki/wiki.pl?GuiChan%
2FMinGW
and with this
mkdir dll
cd dll
g++ -shared -o guichan.dll ../src/.libs/*.o ../src/widgets/.libs/*.o -Wl,--out-
implib,libguichan.a
cp guichan.dll $HOME/sdl/bin
cp libguichan.a $HOME/sdl/lib
g++ -shared -o guichan_sdl.dll ../src/sdl/.libs/*.o -Wl,--out-
implib,libguichan_sdl.a -L$HOME/sdl/lib -lguichan -lSDL_image `sdl-config
--libs`
cp guichan_sdl.dll $HOME/sdl/bin
cp libguichan_sdl.a $HOME/sdl/lib
the create guichan DLL I test this and the link errors are down to 3 only. I
must
test more I think.
Original comment by uberiai...@gmail.com
on 29 Feb 2008 at 5:49
Well keep me posted on your progress. I would be interested to know if you can
solve it.
Original comment by olof.nae...@gmail.com
on 29 Feb 2008 at 6:06
Hello, i think it's working. Based on this ->
http://humming.dip.jp/wiki/wiki.pl?
GuiChan%2FMinGW
I have made this:
./configure CPPFLAGS=-I=/usr/local/include LDFLAGS="-L/usr/local/lib"
result:
-------------------------------
Guichan ready for compilation!
-------------------------------
* Allegro = disabled
* HGE = no (Windows specific and cannot be built)
* OpenGL = no
* OpenLayer = no (Requires static build and cannot be built)
* SDL = yes
* SDL Image = yes
--------------------------------
I have SDL, SDL_image and SDL_ttf, SDL_mixer @ /usr/local
make
make install
guichan is istalled @ /usr/local by default
then I made:
mkdir dll
g++ -shared -o guichan.dll ../src/.libs/*.o ../src/widgets/.libs/*.o -Wl,--no
-undefined --Wl,--export-all-symbols -Wl,--out-implib,libguichan.a
-Wl,--no-undefined and -Wl,--export-all-symbols say the linker than no
undefined
symbols are allowed and export all lib symbols
this created libguichan.a and guichan.dll
I copy this to /usr/local/lib/libguichad.a & /usr/local/bin/guichan.dll
Then I made:
g++ -shared -o guichan_sdl.dll ../src/sdl/.libs/*.o -Wl,--no-undefined -Wl,--
export-all-symbols -Wl,--out-implib,libguichan_sdl.a -L/usr/local/lib -lguichan
-lSDL_image `sdl-config --libs`
-L/usr/local/lib tells linker where are my libs ( SDL_image and guichan )
this created libguichan_sdl.a & guichan_sdl.dll ro /usr/local/lib &
/usr/local/bin
then change to example and:
make -f Makefile.examples sdl CFLAGS="-Werror -Wall -Wno-unused -I/usr/local/
include -L/usr/local/lib
remember my libs are @ /usr/local/lib
and the result is :
g++ sdlhelloworld.cpp -o sdlhelloworld -Werror -Wall -Wno-unused -
I/usr/local/include -L/usr/local/lib \
-lguichan_sdl -lguichan -lSDL_image `sdl-config --libs --cflags`
g++ sdlwidgets.cpp -o sdlwidgets -Werror -Wall -Wno-unused -I/usr/local/include
-
L/usr/local/lib \
-lguichan_sdl -lguichan -lSDL_image `sdl-config --libs --cflags`
g++ sdlaction.cpp -o sdlaction -Werror -Wall -Wno-unused -I/usr/local/include -
L/usr/local/lib \
-lguichan_sdl -lguichan -lSDL_image `sdl-config --libs --cflags`
And I have:
sdlaction.exe sdlhelloworld.exe sdlwidgets.exe
working!!!!!!!
remember guichan.dll and guichan_sdl.dll must be in the PATH of windows or in
the
same directory wehre *.exe is executed..
--------------->
I think the proble is than guichan.dll and guichan_sdl.dll is not contrusted
with
the make, maybe settings --no-undefined --export-all-symbols may help???.
regards
Original comment by uberiai...@gmail.com
on 29 Feb 2008 at 7:06
Excellent news!
The --noundefined --export-all-symbols thing might be the problem. I'm not
really
sure how to add it to the configure scripts without compromising the scripts on
other
systems though. What happens if you use this:
./configure --host=mingw32
Original comment by olof.nae...@gmail.com
on 29 Feb 2008 at 7:12
same problem with --host=mingw32, i am testing how to setup configure to
produce
dll's. If I get any result i publish they here, Ok?
Original comment by uberiai...@gmail.com
on 29 Feb 2008 at 7:28
Sounds good!
Original comment by olof.nae...@gmail.com
on 29 Feb 2008 at 8:25
Hello, again, i think i have one solution to this.
1.- add to configure.in test to see if we are at mingw.
case $host in
*-*-mingw*)
MAS_LIBTOOL_LDFLAGS="-no-undefined -Wl,--export-all-symbols"
SDL_LIBTOOL_LDFLAGS="-L../ -lguichan -lSDL_image -lSDL"
;;
*-*-linux*)
MAS_LIBTOOL_LDFLAGS=""
SDL_LIBTOOL_LDFLAGS=""
;;
*)
;;
esac
AC_SUBST(MAS_LIBTOOL_LDFLAGS)
AC_SUBST(SDL_LIBTOOL_LDFLAGS)
2.- Change src/Makefile.am order ob subdirectories and add MAS_LIBTOOL_LDFLAGS
to
generate guichan lib ( guichan.dll )
SUBDIRS = widgets . @GUICHAN_EXTRADIRS@ hge openlayer
libguichan_la_LIBADD = widgets/libguichan_widgets.la $(MAS_LIBTOOL_LDFLAGS)
guichan depends on widgets lib.....
3.- change src/sdl/Makefile.am add this:
libguichan_sdl_la_LIBADD = $(SDL_LIBTOOL_LDFLAGS) $(MAS_LIBTOOL_LDFLAGS)
and
aclocal
autoconf
automake
./configure CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/include
make
make install
and ............. this is working !.
This generates static libs, dinamics and *.dll for guichan and guichan_sdl
I can upload this files.
Regards
Original comment by uberiai...@gmail.com
on 1 Mar 2008 at 12:24
The MAS_LIBTOOL_LDFLAGS="-no-undefined -Wl,--export-all-symbols" looks needed
but I'm
not sure modifying Makefile.in is the correct way to add linker flags, can't
you just
add the flags to the global LDFLAGS variable as all libraries want those flags?
Another thing, we can't just assume that SDL and SDL_image are present when
compiling
the guichan_sdl library, we need to add those linker flags if the configure
scripts
finds SDL and SDL_image. In your case SDL_image isn't found even though you have
SDL_image installed (welcome to the world of the crapy autotools...), but
that's not
really a problem as you can always force the SDL_image.
By the way, are you using the SVN version of Guichan?
Original comment by olof.nae...@gmail.com
on 1 Mar 2008 at 10:56
Hello, these flags ( MAS_LIBTOOL_LDFLAGS ) are only need for the version of
windows,
for mingw create dll's, if you see configure.in I do one test to see if I am
working
with mingw and set the flags.
Yes, these flags are needed for release dll's on mingw environment, see this:
http://www.mingw.org/MinGWiki/index.php/sample%20DLL?
PHPSESSID=10ec7a86f2eef38c98168f792cead312
and for create guichan_sdl.dll you must tell linker where are the symbols not
present's at this library ( i.e: symbols at guichan and SDL and SDL_image ) ,
this
is for the mingw version only......
I am usign version 0.7.1 of guichan.
Regards
Original comment by uberiai...@gmail.com
on 1 Mar 2008 at 12:09
Yes I understand that they are only needed in Windows, but still, why not just
add
the flags to the LDFLAGS variable if we are in Windows?
And I understand that you have to link with all libraries when producing a DLL.
But
the flags should be added only if the libraries are present. So something like
an
SDL_LIBS variable for SDL and ALLEGRO_LIBS for Allegro would be appropriate.
They
should of course only be populated if we are in Windows. This could be easily
done in
the HAVE* functions present in the configure script.
Original comment by olof.nae...@gmail.com
on 1 Mar 2008 at 1:12
This variables are only for libraries generating DLL not for static libraries
(
libguichan_widgets ), LDFLAGS aplies to all link options, i think. Separate
LDFLAGS
( generic ) from MAS_LIBTOOL_LDFLAGS for libraries need DLL output maybe more
flex.
I must test if I set --disable-shared at configure option this is working and
what
options need. Uff autotools & windows joke :)
Yes I think so, SDL_LIBS and ALLEGRO_LIBS yes, but I don't have allegro and
can't
probe this, but must be same choice.. I can download allegro and test if you
want.
Use HAVE functions and test for mingw ? .It can be a solution more clean.
Original comment by uberiai...@gmail.com
on 1 Mar 2008 at 1:57
I see your point about static libraries, and I guess it makes sense. About
other back
ends such as Allegro and OpenGL, I don't think it will be much different from
how the
SDL back end should be handled.
Original comment by olof.nae...@gmail.com
on 1 Mar 2008 at 2:28
Ok, if I force --disable-shared , they don't link examples (externals not
found) ,
but for me I am using dll for all (SDL SDL_image libpng , etc .. ) and with the
changes to config and Makefiles is working. At the moment is enough for me.
Continue with the tests and if I found any solution i send there here.
Regards
Original comment by uberiai...@gmail.com
on 1 Mar 2008 at 9:08
Hello, again, the best solution I found till now to get guichan @ mingw working
is:
change src/Makefile.am
SUBDIRS = widgets @GUICHAN_EXTRADIRS@ hge openlayer
->>
SUBDIRS = widgets . @GUICHAN_EXTRADIRS@ hge openlayer
libguichan_la_LDFLAGS= -no-undefined
add . to reflect scr directory. -no-undefined is needed for libguichan.dll
change src/sdl/Makefile.am and add this lines:
libguichan_sdl_la_LDFLAGS = -no-undefined -Wl,--export-all-symbols
libguichan_sdl_la_LIBADD = ../libguichan.la -lSDL_image -lSDL
needed to create a working libguichan_sdl.dll
Regards
Original comment by uberiai...@gmail.com
on 3 Mar 2008 at 11:53
So, -Wl,--export-all-symbols is not needed for the main Guichan DLL?
It would be very nice to add MinGW support for the upcoming 0.8.0 release. Oh,
and by
the way, many thanks for your great efforts!
Original comment by olof.nae...@gmail.com
on 3 Mar 2008 at 12:10
for the main Guichan, not needed ( at the moment :) ). I test with examples and
with
guichanffdemo and is working.
When you launch 0.8.0 I test mingw with it, ok?
Original comment by uberiai...@gmail.com
on 3 Mar 2008 at 12:18
Sounds great! Hopefully I can make a release this week or the upcoming week.
Original comment by olof.nae...@gmail.com
on 3 Mar 2008 at 12:55
I know that this thread is a little old at this point, but would it be possible
to
consolidate the info re: building in Windows and add it to the INSTALL file?
Original comment by holy.smo...@gmail.com
on 23 Mar 2010 at 2:24
Probably.
Original comment by olof.nae...@gmail.com
on 23 Mar 2010 at 4:53
Original issue reported on code.google.com by
uberiai...@gmail.com
on 29 Feb 2008 at 11:41