Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » problems installing Allegro 5 + cygwin on Windows 7

This thread is locked; no one can reply to it. rss feed Print
problems installing Allegro 5 + cygwin on Windows 7
sean_von_drake
Member #15,485
February 2014

hi everybody,
I am experiencing some trouble installing Allegro on my working cygwin environment. I work with NetBeans IDE and my OS is Windows 7 32 bit. I can add that both hardware and OS are ok for Allegro since years ago I used to write Allegro games on this same machine using Allegro 4 and DevCpp/MinGW. That environment is gone when I re-installed my OS, but since then it worked perfectly.

In order to install Allegro 5 I followed the readme instructions but without result. I downloaded and unpacked the Allegro 5 zip file (allegro-5.0.10.zip) in c:\cygwin\lib\allegro and then opened the cygwin console and do:

cd /lib/allegro
mkdir build
cd build
cmake ..

at firs, it seems that my cygwin is missing the X11 dev library:

X11 not found. You may need to install X11 development libraries.

??? ??? ???

so I opened the cygwin setup and installed the package:

libX11-devel

and then issued again:

cmake ..

I noticed that cmake suggest to add this line at the beginning of CmakeLists.txt:

set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required

and so I've done; after this, tried again:

X11 support currently requires OpenGL support.

GAAAAA!!! re-open the cygwin setup and install: libglut-devel libGL-devel (the setup as usual handles the dependencies by himself). Wow, again:

cmake ..

and:

X11 support requires Xcursor library.

always by the cygwin setup now install: libXcursor-devel and xcursorgen
and try to cmake again. This is the result:

X11 support requires Xcursor library.

??? ??? ???

wow guys now I really don't know what to do... any help will be greatly appreciated! :)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

sean_von_drake
Member #15,485
February 2014

wow I feel a noob :D I forgot that. Thank you very much Edgar!!!
Well, now I have done (still in the build directory):

rm -rf *
cmake ..

and I got:

-- Allowing GCC to use SSE instructions
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_glu_LIBRARY (ADVANCED)
linked by target "allegro" in directory /home/nick/Desktop/allegro-5.0.0

-- Configuring incomplete, errors occurred!

so I installed the package libGLU-devel and cmake again and... IT WORKS ;D

cmake runs without errors. So I try to compile a test program in my IDE (NetBeans):

#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <allegro5/allegro.h>

using namespace std;

int main(int argc, char** argv) {

ALLEGRO_DISPLAY *display = NULL;

if (!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}

return 0;
}

but when I do the "clean & build" action, the console output is:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory '/cygdrive/c/Users/Fabio/Documents/NetBeansProjects/testCpp007'
rm -f -r build/Debug
rm -f dist/Debug/Cygwin_4.x-Windows/testcpp007.exe
make[1]: Leaving directory '/cygdrive/c/Users/Fabio/Documents/NetBeansProjects/testCpp007'

CLEAN SUCCESSFUL (total time: 1s)

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Fabio/Documents/NetBeansProjects/testCpp007'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/testcpp007.exe
make[2]: Entering directory '/cygdrive/c/Users/Fabio/Documents/NetBeansProjects/testCpp007'
mkdir -p build/Debug/Cygwin_4.x-Windows
rm -f "build/Debug/Cygwin_4.x-Windows/main.o.d"
g++ -c -g -I/cygdrive/C/cygwin/lib -MMD -MP -MF "build/Debug/Cygwin_4.x-Windows/main.o.d" -o build/Debug/Cygwin_4.x-Windows/main.o main.cpp
mkdir -p dist/Debug/Cygwin_4.x-Windows
g++ -o dist/Debug/Cygwin_4.x-Windows/testcpp007 build/Debug/Cygwin_4.x-Windows/main.o -L/cygdrive/C/cygwin/lib
build/Debug/Cygwin_4.x-Windows/main.o: In function `main':
/cygdrive/c/Users/Fabio/Documents/NetBeansProjects/testCpp007/main.cpp:22: undefined reference to `al_install_system'
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:62: recipe for target 'dist/Debug/Cygwin_4.x-Windows/testcpp007.exe' failed
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/testcpp007.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Fabio/Documents/NetBeansProjects/testCpp007'
nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Fabio/Documents/NetBeansProjects/testCpp007'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 5s)

??? ??? ???

maybe it's a linking problem?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

sean_von_drake
Member #15,485
February 2014

thank you again :)

uhm in NetBeans I can specify additional paths for the linker from:
project -> properties -> build -> linker -> additional library directories

and there I added "C:/cygwin/lib" (that contains the allegro5/ folder); I also added the same directory in this option fields:
project -> properties -> build -> c compiler -> include directories and headers
project -> properties -> build -> c++ compiler -> include directories and headers

in case, I can also specify static library (*.a) files to be linked from:
project -> properties -> build -> linker -> libraries

but I can't find any *.a file in the build directory (or subdirectories).

with the same method I usually include and link the mysql client library that I use for db connection, and that works perfectly.

I feel a noob again :-/ I am sure that the solution is really easy but I can't see it.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

uhm in NetBeans I can specify additional paths for the linker from:
project -> properties -> build -> linker -> additional library directories

and there I added "C:/cygwin/lib"

Yes, that is correct.

Quote:

and there I added "C:/cygwin/lib" (that contains the allegro5/ folder); I also added the same directory in this option fields:
project -> properties -> build -> c compiler -> include directories and headers
project -> properties -> build -> c++ compiler -> include directories and headers

No the directory you should add to those options is the include directory where you installed allegro to. I think that was working already, because you compiled a simple test program including <allegro5/allegro.h>.

Quote:

in case, I can also specify static library (*.a) files to be linked from:
project -> properties -> build -> linker -> libraries

but I can't find any *.a file in the build directory (or subdirectories).

The *.a archive files should be in the c:/cygwin/lib folder, and you want to specify each allegro library that you are using in your code.

The Cmake build for allegro also comes with a -DWANT_MONOLITH=On|Off option so that you can build a single monolithic dll to link against (instead of linking to several or more libraries singly). The dlls will be found in the bin folder, and they go alongside your executable.

sean_von_drake
Member #15,485
February 2014

The *.a archive files should be in the c:/cygwin/lib folder, and you want to specify each allegro library that you are using in your code.

so, this may be the problem... I can't find anywhere the *.a files; it is possible that the cmake command did not generate them?

should I try to run cmake again? or can I download the *.a files?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

sean_von_drake
Member #15,485
February 2014

great, thank you :) :) :)
now that you say so, I understand that the presence of a Makefile in c:\cygwin\lib\allegro\build\ would have suggested this thing to me, if just I were not so noob in these days :D I behold to your patience, Edgar :)

I issued make && make install and it worked!!! ;D

after the command is done, I added in:
project -> properties -> build -> linker -> libraries

the libraries I need (in the example above, only liballegro.dll.a) and the clean & build from the IDE was successful!

thanks to you, your help was really great

I hope the Allegro community will have my new game soon :) I also hope this thread will help anyone is having such problems with Allegro on cygwin for Windows 7 OS, and using NetBeans as IDE.

have a nice day and many thanks again!!!

:)

Go to: