|
This thread is locked; no one can reply to it. |
1
2
|
Allegro 5 Static link crash...? OpenGL is cause? |
Mallie
Member #8,742
June 2007
|
For literally YEARS I've never succeeded in compiling Allegro 4, WIP or now 5 RC1 statically. I did a lot of testing and now I know what is causing it, but not why it's happening. I re-setup my compiler, (Code::blocks IDE with MinGW, the latter was installed from it's mingw-get downloader) and all libraries, etc were fresh and new, but this problem still occurs. It's OpenGL. If you include it in cmake config, then all examples crash if they use it or not. (it made me have to exclude primatives addon as well as it referenced opengl stuff though in the source it seems to try not to if opengl isn't used..) I'm assuming the problem lies in libopengl32.a and the static opengl related libraries themselves? (when using DLLs, it all works fine) a fresh install of MinGW replaced them with new copies, but still nothing solves this problem.... I want to use OpenGL for my programs so It's needed for me. I also noticed that memory usage is much better with such: |
Elias
Member #358
May 2000
|
[About static, I never use static linking for several reasons, so no idea.] Mallie said:
I also noticed that memory usage is much better with such: How did you measure that? Most of the used memory usually will be textures and you can get the size of them just by knowing how many bitmaps you create anod how big they are. It sounds to me like that size somehow is hidden with OpenGL, with the way you measure memory. Maybe glTexImage2D(...) allocates the memory in some non-standard way or something. -- |
Mallie
Member #8,742
June 2007
|
I was using the task manager/Resource Monitor in Windows 7 Ultimate. The reason why I want to use static is so I don't have like 10+ DLLs all over the place. This was especially difficult/messy for non programmers testing my programs. At worst case, I guess I could always use something like Inno Setup, etc and make an installer, copying the DLLs to the user's system folders, which would be pretty nice actually. |
Evert
Member #794
November 2000
|
There's some sort of issue with linking on older versions of MinGW. I don't remember the details and I don't remember whether the problem was with static or dynamic linking. |
Michał Cichoń
Member #11,736
March 2010
|
Assume you're using MinGW GCC 4.5.0. To compile Allegro as static library with static run-time libraries use following switches: Switches for source files: -s -DALLEGRO_SRC -DALLEGRO_STATICLINK -DALLEGRO_LIB_BUILD Switches for linker: -lgcc_eh -static-libgcc -static-libstdc++ Switches for executable: Switches for source files: -s -DALLEGRO_STATICLINK Switches for linker: -lgcc_eh -static-libgcc -static-libstdc++ Libraries: Allegro and add-ons (list all your application, you may list all they will be ignored if not used): allegro-5.1.0-static-mt allegro_audio-5.1.0-static-mt ... Direct dependencies (libraries used by Allegro): libFLAC-1.2.1-static-mt libvorbisfile-1.2.3-static-mt libvorbis-1.2.3-static-mt libogg-1.1.4-static-mt dumb-0.9.3-static-mt zlib-1.2.5-static-mt physfs-2.0.0-static-mt freetype-2.4.2-static-mt Indirect dependencies (DLL's availabe in system): gdiplus uuid kernel32 winmm psapi opengl32 glu32 user32 comdlg32 gdi32 shell32 ole32 advapi32 ws2_32
"God starts from scratch too" |
Trent Gamblin
Member #261
April 2000
|
gcc 4.5.0 (maybe 4.4) on Windows is the oldest one that is able to build Allegro statically.
|
Michał Cichoń
Member #11,736
March 2010
|
GCC 4.4.0 is in fact first version which is able to do the job. This is tricky, because MinGW team do not keep the consistency with old releases. You have to manually force linking to the static run-time. "God starts from scratch too" |
Mallie
Member #8,742
June 2007
|
Yeah that's the version I'm using. GCC 4.5.0. @Michał Cichoń: TDM GCC releases? EDIT: ooo I'm blind. u see CXX flags/linker settings in cmake. do i just add to it whats not there? EDIT 2: I added -lgcc_eh -static-libgcc -static-libstdc++ to CMAKE_EXE_LINKER_FLAGS |
Michał Cichoń
Member #11,736
March 2010
|
Please use <quote> for quoting. Did you rebuild everything? I mean Allegro, all statically linked libraries and your application. If only OpenGL is your problem, verify if it is installed correctly. Under Windows check if your GFX driver is installed correctly. If not, Windows provide you OpenGL 1.2 which is to old for Allegro to use. "God starts from scratch too" |
Mallie
Member #8,742
June 2007
|
Michał Cichoń said: Please use quote for quoting. Did you rebuild everything? I mean Allegro, all statically linked libraries and your application. If only OpenGL is your problem, verify if it is installed correctly. Under Windows check if your GFX driver is installed correctly. If not, Windows provide you OpenGL 1.2 which is to old for Allegro to use.
Yes, I did. Everything was done from scratch. Everything else works except OpenGL. When I compile Allegro without OpenGL support then everything works as static. |
Thomas Fjellstrom
Member #476
June 2000
|
You will need to grab intel's latest driver package and see if that helps at all. Otherwise you're stuck with Microsoft's broken OpenGL. If that doesn't work, intel's OpenGL drivers are known to be somewhat lacking. -- |
Mallie
Member #8,742
June 2007
|
Thomas Fjellstrom said: You will need to grab intel's latest driver package and see if that helps at all. Otherwise you're stuck with Microsoft's broken OpenGL. If that doesn't work, intel's OpenGL drivers are known to be somewhat lacking. Ahh, ok. Where might I find that? I assume I can just search "intel's opengl drivers" I guess; I'll give that a try. I think it's really silly, tbh...I heard about OpenGL being ended at 1.2 and about EDIT: All I seem to find is drivers for intel onboard gfx...my card is a nVidia GeForce 8800GT.. |
Thomas Fjellstrom
Member #476
June 2000
|
Mallie said: Ahh, ok. Where might I find that? I assume I can just search "intel's opengl drivers" I guess; I'll give that a try. Sorry, I was being unclear, I don't think there are separate drivers for OpenGL. Just the regular Graphics drivers should include the OpenGL support. Quote: I think it's really silly, tbh...I heard about OpenGL being ended at 1.2 and about Well OpenGL development did seem to stall a couple times. But its now up to OpenGL 4.x, so it definitely hasn't stopped at 1.2. OpenGL 2 was released in 2004, about 7 years ago. append: Quote: EDIT: All I seem to find is drivers for intel onboard gfx...my card is a nVidia GeForce 8800GT. My bad. I seem to have gotten the impression that you had an Intel IGP (Integrated Graphics Processor). If you have a Gforce, just grab the latest NVidia drivers, and it should support OpenGL 4 by now. And with that card, it WILL have proper FBO support. -- |
Mallie
Member #8,742
June 2007
|
Yeah I sorta thought that too. I used this glview program I found to check my openGL support and it says my nVidia drivers support up to OpenGL 3.2... |
Thomas Fjellstrom
Member #476
June 2000
|
Mallie said: It doesn't look like an OpenGL support issue at this rate...maybe the OGL libraries that come with MinGW are only 1.2 compliant?? (like libopengl32.a, glu32.a or whatever they called) libopengl32.a should only be a link library, that is its just there so mingw knows how to link to OpenGL32.dll. If glview is showing 3.2, allegro should be as well. -- |
Mallie
Member #8,742
June 2007
|
Huh....yeah that's what I kinda thought....because since OpenGL and those kinda dependancies are rather a given on Windows systems or especially with Mac/Linux ....there would be no need. Kinda frustrating because I finished my project after 7 months and just before release....it's not a total loss if I have to saay make an installer with the DLLs thats a good workaround if nothing more can be done. Still gonna post about those 2 other issues as well but just trying everything I can myself first. I wonder if anyone has got Allegro 5 to statically link with OpenGL use... |
Thomas Fjellstrom
Member #476
June 2000
|
As far as I know, you can't statically link with OpenGL. Much like you can't statically link with core windows dlls. But then I don't think theres a real static opengl lib, so it shouldn't be a problem. -- |
Mallie
Member #8,742
June 2007
|
Yeah.. I believe I've had this same problem on multiple computers as well. |
Michał Cichoń
Member #11,736
March 2010
|
In attachment you can find test_driver compiled with MinGW GCC 4.5.0. Everything is linked statically so there is one and only executable without any additional dependencies. "God starts from scratch too" |
Mallie
Member #8,742
June 2007
|
Michał Cichoń said:
In attachment you can find test_driver compiled with MinGW GCC 4.5.0. Everything is linked statically so there is one and only executable without any additional dependencies.
I tried the test and it was working. It showed stuff and wrote results to result.txt moreover, I dunno why things named '-static-mt' in such because my libraries etc have no names like that. (I know what it means but it's not naming them that way) EDIT: I notice -DALLEGRO_SRC -DALLEGRO_STATICLINK -DALLEGRO_LIB_BUILD these don't seem to exist? for example -DALLEGRO_STATICLINK is actually -DSHARED and such is all whats listed in cmake GUI. |
Thomas Fjellstrom
Member #476
June 2000
|
Mallie said: EDIT: I notice -DALLEGRO_SRC -DALLEGRO_STATICLINK -DALLEGRO_LIB_BUILD these don't seem to exist? for example -DALLEGRO_STATICLINK Those aren't CMAKE flags, rather defines for the compiler. Also ALLEGRO_LIB_BUILD and ALLEGRO_SRC are NOT to be used for anything but the allegro library itself. You do however need to set ALLEGRO_STATICLINK when statically linking to allegro in your own programs. It needs to be set before you include any allegro headers. Either using a gcc -D flag, or #define FOO before the #include lines for allegro. -- |
Michał Cichoń
Member #11,736
March 2010
|
It has named that way, because my build system use such postfix to differentiate between different compiler/lib configurations. You may try precompiled binaries availabla at http://allegro5.org/. That way you will be able to use Allegro without problems. You will need those with "-static-mt-" suffix, which mean Allegro is compiled as static library and use statically linked run-time libraries. "God starts from scratch too" |
Mallie
Member #8,742
June 2007
|
OoooO! I didn't know that static binaries were available! Always saw 'em as DLLs. EDIT: YES!! It's working!! YAY! Thanks SO much for your help! |
Michał Cichoń
Member #11,736
March 2010
|
You're welcome. "God starts from scratch too" |
kenmasters1976
Member #8,794
July 2007
|
Are there prebuilt static binaries for MinGW gcc 4.4.0?. It's the first time I'm dealing with static linking and I'm having the same problems as Mallie. I usually build the shared libs with gcc 3.4.5 but now I wanted to send a single exe and it seems Mallie had luck using the prebuilt libraries. As Mallie, I built Allegro and can get my program to compile but it crashes. The MinGW 4.4.0 binaries here at allegro.cc don't include the static libraries and since allegro5.org now redirects to the Allegro homepage I'm wondering if there are static binaries for 4.4.0 or if they're only available for gcc 4.5.0. Thanks.
|
|
1
2
|