Allegro.cc - Online Community
Post Reply

Allegro.cc Forums » Installation, Setup & Configuration » I am looking for correct detailed instructions how to build Allegro....

rss feed Print
 1   2   3 
I am looking for correct detailed instructions how to build Allegro....
takis76
Member #1,419
July 2001
avatar

Hello,
I am trying to build the Allegro library from the source code but even I did a research in the forums (not here, here the forums look empty), but in stack overflow or in other search results finding these webpages:

http://members.allegro.cc/EdgarReynaldo/BuildA4.html
http://members.allegro.cc/EdgarReynaldo/BuildA5.html
https://wiki.opensurge2d.org/Compiling_the_Source_Code

And other scattered results from threads and posts.
When I was tried to compile one dependency the next produce more errors.
Almost all the information and guides that suppose to help you to build the Allegro 4.4.2 and Allegro 5.x end to drop you compile errors leaving you unable to fix them, unable to compile the next dependency and these errors are unknown to me.

I installed and the msys it needs, and the mingwg64 it needs, and I run and this cmake thing it needs (I tried to configure it and press this generate button), by guessing what it misses, the one compile misses another and then you are ending in a fatal not continuing error because the needed dependency is unable to be compiled.

You will say to post a screenshot to see the error. It is better if there is or if someone like or did post a complete detailed building guide, not the draft guides that exist, a guide that will tell you what to download exactly, where to download, what version download exactly, which dependency download exactly and where to put it exactly and show the cmake options (This red list) what to choose, what missing folders needed and in which order each dependency need to be compiled. (The web pages I saw here suppose they present the order which dependencies need to be installed first but again more unknow errors appear and the needed dependency is not compiling and I do not know how to even describe the error to the search engine for a solution), there is no solution and the similar solutions are not working with allegro.

Last time I used Allegro was the Allegro 4.2 (The old one you say and it is not supported and not used anymore and not recommended). But Allegro 4.4 and Allegro 5 is a total mess and it does not compile. (Why do people do things complex?). I remember 10 years ago you run a command fix djgpp (I have used since the DOS and djgpp compiler) and then you typed make and make install and the whole Allegro was ready. Now it is total mess.

I haven't used is since the version increased to 4.4 (I tried to compile and more recent versions without luck) and I never was able to compile it.
You will say now why do I will not use the precompiled versions?

The precompiled version have the libraries only not the extras. I do not know if the precompiled versions has the addons (zlib,libpng,freetype etc) inside precompiled?

Also when you compiled the Allegro 4.2 there was one nice program with name Grabber (It created data files and you stored your assets in( and I see there is not any Grabber precompiled. (Does the grabber exist in Allegro 5)?

Thank you and I would like someone to post some very full detailed guide about how to build the Allegro for its source code. How did you build your own versions you have in your computers? (Also I am interested in windows version building).

Thank you.

SiegeLord
Member #7,827
October 2006
avatar

There's at least two options here.

First, you can use the repository from which the precompiled binaries are made, https://github.com/liballeg/allegro_winpkg/tree/master/universal. See README_msys.txt for instructions and what to download (no much, since this repository vendors the dependencies). The precompiled binaries come with a good amount of dependencies statically linked into the Allegro DLLs.

If you want a more manual approach more suitable for hacking on Allegro, you can follow https://www.allegro.cc/forums/thread/616828, which we'll eventually add to the wiki.

takis76 said:

Also when you compiled the Allegro 4.2 there was one nice program with name Grabber (It created data files and you stored your assets in( and I see there is not any Grabber precompiled. (Does the grabber exist in Allegro 5)?

You can use the PhysFS addon to load files from .zip files. See ex_physfs for an example.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I am Edgar Reynaldo, and I put together those guides. They assume you have at least some familiarity with building a software library. If they are not detailed enough you need to tell me what they are missing.

It also assumes you have some experience with CMake and / or Autotools like configure.

First of all, why do you want to build allegro from source? If you just want to make programs that use allegro then use the binaries. You only need to build allegro from source if you are modifying the libraries source code.

The thread SiegeLord quoted tells you how to build with MSYS2. It is easier than building with MinGW-W64 manually.

I offer downloads of pre-compiled MinGW-W64 binaries at the bottom of the guide. They include all the pre-compiled dependencies that I was able to compile. You can use the deps to build allegro if you like.

Also, there is no "definitive" guide to building allegro 5 with MinGW-W64. It entirely depends on which versions of the dependency libraries you use, how skilled you are with CMake and configure, and how intuitive you are at solving errors.

We can help you with errors, but text is more useful than screenshots generally. Like I said, if you think my guides are missing details then tell me what you would like and I will consider adding it.

takis76
Member #1,419
July 2001
avatar

Hello,
Thank you very much you answered my question.

I liked to build the Allegro library from the source to generate the Grabber tool. But as you say there is not Grabber tool anymore.

I didn't know what is PhysFS was. Its name seems to be like a Physics library.
What is this PhysFS? A new kind of Grabber that supports zip files?

Usually zip libraries extracts all the assets from the zip file they do not read them directly from zip file. If the PhysFS, loads an asset from the zip without extract it on run time and can be able to create and new zip files on run time it will be great.

I will retry to compile the Allegro 5, (I would like to try to compile it again just for a knowledge).
I do not know anything about CMake and Autotools, that's why I wasn't able to continue the compilation when an error appeared.

That's why I was asked to tell me which version of MinGW is needed, which version of CMake is needed, (There are many different versions that are not compatible for each version of Allegro). I will compile it again and I will post my error messages and I will tell you what I did exactly.

Also I like to compile the Allegro library from the source because I want a monolith version and not need to ship dlls with my games and programs.

And I will visit the links you gave me too.

Thank you very much. Have and happy Christmas too.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

The grabber tool only works with Allegro 4, and gets built by default when building allegro 4. The Allegro 5 alternative is as SiegeLord said, the PhysFS addon (FileSystem) which allows you to load files contained within archives such as .zip files, .7z files, and so on...

The PhysFS addon allows you to load files contained within archives as if they were already extracted from the zip file. So, for example you can use Allegro 5 and PhysFS to load an image file directly from an archive.

As for which version of MinGW to use I recommend MinGW-W64 with GCC version 7 at least. CMake probably requires version 3.0 or better to compile Allegro but I'm not sure of a specific version necessary.

I suggest either you use MSYS2 as SiegeLord suggested because it is easier to install the dependencies since all you have to understand is how to use a package manager. Otherwise you can build Allegro 5 using the deps that come in my binaries. Those binaries also include PhysFS and the PhysFS addon.

Depends on what you want to do.

EDIT for your edit
If you don't want DLLs to ship alongside your program, you need the static version of Allegro and the static dependencies.

The monolith just puts everything into a single dll or archive, depending on whether you build it dynamically or statically.

SiegeLord
Member #7,827
October 2006
avatar

The PhysFS addon allows you to load files contained within archives as if they were already extracted from the zip file. So, for example you can use Allegro 5 and PhysFS to load an image file directly from an archive.

To add to this... the equivalent of the grabber for A5 is your favorite zip program, be it the built in Windows one, or 7-zip or w/e. The PhysFS addon is the replacement for things like load_datafile etc, although it works completely differently. Roughly speaking, with PhysFS you 'mount' zip files as virtual directories, and then load your asserts via regular al_load_* calls.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

takis76
Member #1,419
July 2001
avatar

Ok, I begun to follow the instructions you gave me from here: https://www.allegro.cc/forums/thread/616828

First I installed the MSYS2, I completely removed my MSys1.10 I had installed and I deleted and the remained folder.
So a new folder with name msys was created to my c:
I run the msys2 immediately after the installation which I think the MSYS2 MSYS was run.

I followed everything in section "I".
The I installed the c++ compiler. I followed everything in section "II"

In the section "III" I skipped the section "A" installing the Allegro from msys because it says the Allegro will lag. (I do not understand what means. Lag it will be slow?) I skipped this.
And I jumped to Section "III" - "B".
In section "III" - "B" I skipped the part "1" because I didn't install the lag version of Allegro.

I executed the commands:
pacman -S make
pacman -S mingw-w64-x86_64-cmake
pacman -S git

And in the fourth command:
pacman -S mingw-w64-x86_64-pkg-config

I have an error. And now the organs begin. :P

resolving dependencies...
looking for conflicting packages...
:: mingw-w64-x86_64-pkg-config and mingw-w64-x86_64-pkgconf are in conflict. Remove mingw-w64-x86_64-pkgconf? [Y/n] y
error: failed to prepare transaction (could not satisfy dependencies)
:: removing mingw-w64-x86_64-pkgconf breaks dependency 'mingw-w64-x86_64-pkgconf' required by mingw-w64-x86_64-cmake

As I understand the dependencies wasn't installed, because I skipped the whole section "III" - "A" because the Allegro will lag. So as I understood now, I will not execute this command yet:
pacman -S mingw-w64-x86_64-allegro

but I will execute the rest to have the dependencies downloaded at least.

These:
mingw-w64-x86_64-dumb: allegro_audio
mingw-w64-x86_64-flac: allegro_audio
mingw-w64-x86_64-opusfile: allegro_audio
mingw-w64-x86_64-freetype: allegro_font
mingw-w64-x86_64-libjpeg-turbo: allegro_image
mingw-w64-x86_64-libpng: allegro_image
mingw-w64-x86_64-libvorbis: allegro_audio
mingw-w64-x86_64-openal: allegro_audio
mingw-w64-x86_64-physfs: allegro_physfs

I will try and I will tell you.

Well, I installed the dependencies and I receive the same error.
when I retried to run the command:
pacman -S mingw-w64-x86_64-pkg-config

After installed (I think) the dependencies (It asked to install and I press y).

  1. pacman -S mingw-w64-x86_64-pkg-config

resolving dependencies...
looking for conflicting packages...
:: mingw-w64-x86_64-pkg-config and mingw-w64-x86_64-pkgconf are in conflict. Remove mingw-w64-x86_64-pkgconf? [Y/n] y
error: failed to prepare transaction (could not satisfy dependencies)
:: removing mingw-w64-x86_64-pkgconf breaks dependency 'mingw-w64-x86_64-pkgconf' required by mingw-w64-x86_64-cmake

Now I stuck.

SiegeLord
Member #7,827
October 2006
avatar

Thanks for trying it. You can skip the mingw-w64-x86_64-pkg-config package, its not necessary.

I think the build section of that guide is a bit problematic too, I'd recommend just doing this:

git clone https://github.com/liballeg/allegro5.git
cd allegro5
mkdir build
cd build
cmake .. -G"MSYS Makefiles"
make
make install

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

takis76
Member #1,419
July 2001
avatar

Do all the process I did above except the: pacman -S mingw-w64-x86_64-pkg-config
was correct?
Do I call git from inside the msys environment?

Where the final allegro will be installed. I see everything are getting installed inside my c:\msys directory.

During the making of Allegro many warnings like this were appeared:

C:/msys/home/Takis76/allegro5/demos/skater/src/framework.c: In function 'init_framework':
C:/msys/home/Takis76/allegro5/demos/skater/src/framework.c:89:4: warning: 'strncpy' specified bound 1024 equals destination size [-Wstringop-truncation]
   89 |    strncpy(config_path, al_path_cstr(path, '/'), DEMO_PATH_LENGTH);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys/home/Takis76/allegro5/demos/skater/src/framework.c:102:4: warning: 'strncpy' specified bound 1024 equals destination size [-Wstringop-truncation]
  102 |    strncpy(data_path, al_path_cstr(path, '/'), DEMO_PATH_LENGTH);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


C:/msys/home/Takis76/allegro5/demos/shooter/title.c: In function 'load_credits':
C:/msys/home/Takis76/allegro5/demos/shooter/title.c:59:4: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

After millions of warnings it compiled inside my msys folder.
Will I copy the build folder outside of my msys and rename it to allegro?

It is in folder like this:
C:\msys\home\Takis76\allegro5\build

Why is it inside too many sub folders?

I would like to test if is it working.
I will try to use code::blocks as an IDE.

But I have and other questions, where is the manual? where are the sources of the examples? How do I build the static libraries and the debug?

When you try to run the examples it asks for missing dlls that are not exist.
For example if you run the example ex_mouse.exe if asks for missing dlls.

libjpeg-8.dll
libpng16-16.dll
libgcc_s_seh-1.dll
libstdc++-6.dll

The only related image dll is the "allegro_image-5.2.dll" that was generated after compile but even if you copy it and rename it to libjpeg-8.dll and libpng16-16.dll you try to trick the program there are no libgcc_s_seh-1.dll and libstdc++-6.dll

And the trick is not working. (Look at the "Trick_Error.jpg" I uploaded here). So there are many missing dlls, but I prefer a static build not depend on dlls.

Thank you.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

There's a cmake-gui option called PREFER_STATIC_DEPS. Turn that on and reconfigure and see if if changes the libraries to static ones. Otherwise you'll have to specify the static libraries yourself. Because otherwise the dynamic libraries will be used to link to, and then it depends on the dlls.

Edit to remove the few remaining dependencies, you need to link with the static ones.

gcc -o a.exe main.c -static -lpthread -static-libstdc++ -static-libgcc

takis76
Member #1,419
July 2001
avatar

Hello,
Thank you for the answer.

If I will try to run cmake-gui .. inside the build subdirectory in allegro5
I have this error.

C:/msys/mingw64/bin/cmake-gui.exe: error while loading shared libraries: zlib1.dll: cannot open shared object file: No such file or directory

I run this command to load the cmake-gui to add this PREFER_STATIC_DEPS option you said.
But there are more errors. The cmak-gui is not opening

I think I installed the zlib dependency why did not find it?

If I will try to load the cmake-gui not from the Msys but from normal command prompt

cd C:\msys\home\Takis76\allegro5\build
and run the cmake-gui from there

it shows other error about missing libraries Qt6Widgets.dll , Qt6Gui.dll and Qt6Core.dll

I am about to quit trying build this library and using the Allegro in general.

Have a very happy new year.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Please don't give up. It's not as hard as it seems, and it's also harder than it looks, but it's worth it.

I can provide you with an easier way to get started. Just use the dependency binaries I used to build allegro.

http://winlibs.com

Here, I made a release of Eagle, with Allegro 5.2.7.1 and dependencies provided.

https://github.com/EdgarReynaldo/EagleGUI/releases/tag/0pt8pt4

Download the allegro binaries (that come with the dependencies) and then use them to build allegro to your liking. I know they all work with this version of Allegro.

takis76
Member #1,419
July 2001
avatar

Hello again,
Happy new year :)
I will retry to compile it. But I do not understand much. The winlibs.com contains instructions and files about Gcc and MinGW-w64 versions.

Here after the failed compiles of Allegro I have Gcc version 4.5.0

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.5.0/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../src/configure --prefix=/c/temp/gcc/dest --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release
Thread model: win32
gcc version 4.5.0 (GCC)

But I use to use the version 8.1.0 for my BlitzMax projects.

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/MinGW/bin/../libexec/gcc/i686-w64-mingw32/8.1.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw810/i686-810-win32-sjlj-rt_v6-rev0/mingw32 --enable-shared --enable-static --enable-targets=all --enable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-sjlj-exceptions --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch-32=i686 --with-arch-64=nocona --with-tune-32=generic --with-tune-64=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-win32-sjlj-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-win32-sjlj-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-win32-sjlj-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/i686-810-win32-sjlj-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/i686-810-win32-sjlj-rt_v6-rev0/mingw32/opt/lib -L/c/mingw810/prerequisites/i686-zlib-static/lib -L/c/mingw810/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: win32
gcc version 8.1.0 (i686-win32-sjlj-rev0, Built by MinGW-W64 project)

If I will use my Mingw version 8.1.0 will the Allegro be compiled?

Is this Eagle is a GUI library? (Interesting) I am looking for a nice GUI library that
contains full skinable gadgets (Pulldown menus, list gadget, option button, check gadget, ratio button gadget, horizontal and vertical scrollbars, buttons, image buttons, input box, labels, tabs, panels, windows gadgets, multi line input box, spinner, canvas gadget and other nice gadgets). Do these supported with Eagle GUI?

I will try it if I will ever be able to compile Allegro. Also I liked the built in Allegro GUI too.

I will try to download the Allegro Binaries and I will skip compile it and I will try to see if I will manage to use Code:Blocks. (There is not grabber any more and I will try to use the PhysFS library).

I tried to find the missing Qt6 dlls to run my cmake-gui but it asks for Qt6 version of dlls and I can't find them, only in Qt5 exits. I am unlucky.

I will try to download the precompiled Allegro 5.2.7.1 from the link you gave.

Update:

I created a folder with name Allegro5 on my C:\Allegro5

I created a code::blocks new project.
I didn't use the exact instruction for code:block of the instructions you provided because I use minGw 8.5.0 as my compiler. But I used similar with my own MingGw compiler.

In Project Build Options:
In the linker settings tab and Link Library list I put "C:\Allegro5\lib\liballegro_monolith-static.a"

For Debug Target:
In the linker settings tab and Link Library list I put
"C:\Allegro5\lib\liballegro_monolith-debug-static.a"

For Release Target:
In the linker settings tab and Link Library list I put
"C:\Allegro5\lib\liballegro_monolith-static.a"

In Search Directories tab and in the compiler tab I put
"C:\Allegro5\Include\"

In Search Directories tab and in the Linker tab I put
"C:\Allegro5\lib"

Are these correct first?

When I run a small source code I have lots of undefined reference errors:

C:\Allegro5\lib\liballegro_monolith-static.a(wsystem.c.obj):wsystem.c:(.text+0x4c7): undefined reference to `__imp_timeEndPeriod'
C:\Allegro5\lib\liballegro_monolith-static.a(wsystem.c.obj):wsystem.c:(.text+0x11c4): undefined reference to `__imp_PathFindOnPathW'
C:\Allegro5\lib\liballegro_monolith-static.a(wsystem.c.obj):wsystem.c:(.text+0x1643): undefined reference to `__imp_timeBeginPeriod'
C:\Allegro5\lib\liballegro_monolith-static.a(wtime.c.obj):wtime.c:(.text+0x18): undefined reference to `__imp_timeGetTime'
C:\Allegro5\lib\liballegro_monolith-static.a(wtime.c.obj):wtime.c:(.text+0x14a): undefined reference to `__imp_timeGetTime'
C:\Allegro5\lib\liballegro_monolith-static.a(wtime.c.obj):wtime.c:(.text+0x1fd): undefined reference to `__imp_timeGetTime'
C:\Allegro5\lib\liballegro_monolith-static.a(wtime.c.obj):wtime.c:(.text+0x222): undefined reference to `__imp_timeGetTime'
C:\Allegro5\lib\liballegro_monolith-static.a(wxthread.c.obj):wxthread.c:(.text+0x41b): undefined reference to `__imp_timeGetTime'
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0x2a3): undefined reference to `__imp_glGetError'
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0x5f6): undefined reference to `__imp_glGetError'
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0x743): undefined reference to `__imp_glGetError'
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0x842): undefined reference to `__imp_glGetError'
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0x948): undefined reference to `__imp_glGetError'
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0xa5b): more undefined references to `__imp_glGetError' follow
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0xebd): undefined reference to `__imp_glBindTexture'
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c:(.text+0xed2): undefined reference to `__imp_glGetError'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x10a): undefined reference to `__imp_glFlush'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x46a): undefined reference to `__imp_wglDeleteContext'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0xd8e): undefined reference to `__imp_wglCreateContext'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0xda6): undefined reference to `__imp_wglMakeCurrent'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0xe8f): undefined reference to `__imp_wglDeleteContext'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x1091): undefined reference to `__imp_glFlush'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x10b2): undefined reference to `__imp_glFlush'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x10da): undefined reference to `__imp_wglMakeCurrent'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x114b): undefined reference to `__imp_wglGetCurrentContext'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x116b): undefined reference to `__imp_wglMakeCurrent'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x1371): undefined reference to `__imp_wglGetCurrentContext'
C:\Allegro5\lib\liballegro_monolith-static.a(wgl_disp.c.obj):wgl_disp.c:(.text+0x137c): undefined reference to `__imp_wglGetCurrentDC'

blah blah...

Update2:

If I will change all static libraries to dlls I do not have undefined reference error
but I need to have lots of dlls in the same directory with the .exe file.

How is it possible not have many dlls shipped with my program? (I thought to use the static libraries that have no dll prefix in their filenames).

For Example:

For this instead: "liballegro_monolith.dll.a"
To use this: "liballegro_monolith.a"
Or is supposed to use this: "liballegro_monolith-static.a"

Using the static or the one without the static predix (But not dll). Generates undefined reference errors

Creating a very small source code to see if the library work using this code:

#SelectExpand
1#include <stdio.h> 2#include <allegro5/allegro.h> 3 4const float FPS = 60; 5ALLEGRO_DISPLAY *display; 6 7 8int main() 9{ 10 11 al_init(); 12 al_create_display(800, 600); 13 14 bool running = true; 15 16 // Game loop 17 while (running) 18 { 19 20 } 21 al_flip_display(); 22 23return 0; 24}

I have this error:

The procedure entry point _ZSt28__throw_bad_array_new_lengthv could not be located in the dynamic link library "OpenAL32.dll".

At least this compiled.

First I will need to have the programs independent without dlls.
Then it seems the OpenAL32.dll is missing something.
Is there an option to use and Directx 9 or 10 or 11 if you want?

And something else the IDE is not recognizing the Allegro's commands when you type them and they didn't change color which means they didn't add in the vocabulary.

It seems I will start from scratch completely.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

If you link statically, you need to link all the windows libraries too. And it looks like you need OpenGL.


-static 
-ljpeg 
-ldumb
-lwebp
-lFLAC 
-ltheora
-lvorbisfile 
-lvorbis 
-logg 
-lphysfs 
-lfreetype 
-lpng16 
-lzlibstatic 
-lopenal32
-ldsound
-lgdiplus 
-luuid 
-lkernel32 
-lwinmm 
-lpsapi 
-lopengl32 
-lglu32 
-luser32 
-lcomdlg32 
-lgdi32 
-lshell32 
-lole32 
-ladvapi32 
-lws2_32 
-lshlwapi 
-lpthread
-static-libstdc++ 
-static-libgcc

I may have built the static libs wrong if they need OpenAL32.dll or anything else.

takis76
Member #1,419
July 2001
avatar

I haven't build any libraries I use your already built of yours because I haven't managed to build Allegro, I am trying to compile a test source code and skipping the Allegro Build process.
And I downloaded your Allegro 5.2.7.1 version from the link you gave me.

Allegro5271GIT_2021-12-12_x86_64-w64-mingw32_gcc11.2_posix_seh.7z

I downloaded this file I extracted it in a new Allegro5 folder and I am trying to
compile a test source code.

I added all the list with link commands in the linker.

And I used the "C:\Allegro5\lib\liballegro_monolith-static.a" as library.
It suppose to have all these sub libraries inside.

But the OpenGL is still missing. Where do I will download this OpenGL missing library?

I receive undefined references.

Screenshot

https://prnt.sc/260btky

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

If you use my binaries, you need to use the same compiler they were compiled with, otherwise it won't work.

liballegro_monolith-debug-static does NOT contain ANY of the dep libraries that's why you need to link with them all.

OpenGL comes with your compiler. -lopengl32 -lglu32

takis76
Member #1,419
July 2001
avatar

You mean to use the Mingw 11 and not 8.5.0?
After adding the -lopengl32 -lglu32 I still receive the same opengl undefined reference errors.

C:\Allegro5\lib\liballegro_monolith-static.a(wsystem.c.obj):wsystem.c|| undefined reference to `__imp_timeEndPeriod'|
C:\Allegro5\lib\liballegro_monolith-static.a(wsystem.c.obj):wsystem.c|| undefined reference to `__imp_PathFindOnPathW'|
C:\Allegro5\lib\liballegro_monolith-static.a(wtime.c.obj):wtime.c|| undefined reference to `__imp_timeGetTime'|
C:\Allegro5\lib\liballegro_monolith-static.a(wxthread.c.obj):wxthread.c|| undefined reference to `__imp_timeGetTime'|
C:\Allegro5\lib\liballegro_monolith-static.a(ogl_shader.c.obj):ogl_shader.c|| undefined reference to `__imp_glGetError'|

And lots of others...

GullRaDriel
Member #3,861
September 2003
avatar

timegettime is in Winmm.lib or Winmm.dll.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Dizzy Egg
Member #10,824
March 2009
avatar

So long as your "other link options" is the same as below, you should be ok (you don't need anything in "Link Libraries"):

-lallegro_monolith-debug-static
-ljpeg
-ldumb
-lFLAC
-lfreetype
-lvorbisfile
-lvorbis
-logg
-lphysfs
-lpng16
-lzlibstatic
-ldsound
-lgdiplus
-luuid
-lkernel32
-lwinmm
-lpsapi
-lopengl32
-lglu32
-luser32
-lcomdlg32
-lgdi32
-lshell32
-lole32
-ladvapi32
-lws2_32
-lshlwapi

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

takis76
Member #1,419
July 2001
avatar

I used the new list of linker commands and I have this error now:

||=== Build: Release in Adventure Maker (compiler: GNU GCC Compiler) ===|
C:\Allegro5\lib\liballegro_monolith-debug-static.a(display.c.obj)||In function `al_create_display':|
E:\usr64\libs\Allegro52X\src\display.c|59|undefined reference to `__imp__wassert'|
C:\Allegro5\lib\liballegro_monolith-debug-static.a(display.c.obj)||In function `al_destroy_display':|
E:\usr64\libs\Allegro52X\src\display.c|166|undefined reference to `__imp__wassert'|
C:\Allegro5\lib\liballegro_monolith-debug-static.a(display.c.obj)||In function `al_get_backbuffer':|
E:\usr64\libs\Allegro52X\src\display.c|178|undefined reference to `__imp__wassert'|
C:\Allegro5\lib\liballegro_monolith-debug-static.a(display.c.obj)||In function `al_flip_display':|
E:\usr64\libs\Allegro52X\src\display.c|193|undefined reference to `__imp__wassert'|
C:\Allegro5\lib\liballegro_monolith-debug-static.a(display.c.obj)||In function `al_update_display_region':|
E:\usr64\libs\Allegro52X\src\display.c|207|undefined reference to `__imp__wassert'|
C:\Allegro5\lib\liballegro_monolith-debug-static.a(display.c.obj):E:\usr64\libs\Allegro52X\src\display.c|218|more undefined references to `__imp__wassert' follow|
||error: ld returned 1 exit status|
||=== Build failed: 7 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

Dizzy Egg said:

So long as your "other link options" is the same as below, you should be ok (you don't need anything in "Link Libraries"):

Do I need to remove the "C:\Allegro5\lib\liballegro_monolith-static.a" from the link library?

Update.

I removed the library from the "Linker Libraries" and I left the other linker options but I have the same error.

Dizzy Egg
Member #10,824
March 2009
avatar

I don't know why it's referencing something in E:\ drive?

Have you setup your "Search Directories->Linker options" correctly?

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

takis76
Member #1,419
July 2001
avatar

Search directories for compiler: C:\Allegro5\Include\
Search directories for the linker: C:\Allegro5\lib

About the library tries to search on my E: Drive

I do not have any directory with name usr64 on my E: Drive and I haven't installed my Allegro on my E: Drive too.

Dizzy Egg
Member #10,824
March 2009
avatar

I don't know what the issue is here; if I use the version Edgar posted earlier (https://github.com/EdgarReynaldo/EagleGUI/releases/tag/0pt8pt4) I can't even get it to link!

I'm using an older Mingw version of Allegro5 (Allegro522_MinGW5303v2) and it works fine. If I try to use the one Edgar posted it compiles but will not link (undefined references).

I would post my version for you to try but the attachments seem broken on this site.

EDIT: This is the one I use with CodeBlocks/Mingw and it works fine:

https://sourceforge.net/projects/unofficialmingw/files/MinGW5302v3.tar.7z/download

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

You also need to define ALLEGRO_STATICLINK.

-DALLEGRO_STATICLINK or #define ALLEGRO_STATICLINK in every file that includes allegro.

Dizzy Egg
Member #10,824
March 2009
avatar

Ahh, didn’t try that! Will give it a go when I’m sober.

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Post Reply
 1   2   3 


Go to: