Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Statuc linking Allegro 5 [Linux Ubuntu]

Credits go to Elias, jmasterx, and RPG Hacker for helping out!
This thread is locked; no one can reply to it. rss feed Print
Statuc linking Allegro 5 [Linux Ubuntu]
Ariesnl
Member #2,902
November 2002
avatar

Iḿ trying to link allegro5 staticly to my project..
But I get a lot of undefined references...

#SelectExpand
1||=== Build: Debug in StarTrekV3_Windows (compiler: GNU GCC Compiler) ===| 2/usr/lib/liballegro-static.a(uxthread.c.o)||In function `_al_thread_create':| 3/home/edwin/allegro5/src/unix/uxthread.c|54|undefined reference to `pthread_create'| 4/usr/lib/liballegro-static.a(uxthread.c.o)||In function `_al_thread_join':| 5/home/edwin/allegro5/src/unix/uxthread.c|80|undefined reference to `pthread_join'| 6/usr/lib/liballegro-static.a(uxthread.c.o)||In function `_al_mutex_init_recursive':| 7/home/edwin/allegro5/src/unix/uxthread.c|111|undefined reference to `pthread_mutexattr_init'| 8/home/edwin/allegro5/src/unix/uxthread.c|112|undefined reference to `pthread_mutexattr_settype'| 9/home/edwin/allegro5/src/unix/uxthread.c|120|undefined reference to `pthread_mutexattr_destroy'| 10/home/edwin/allegro5/src/unix/uxthread.c|113|undefined reference to `pthread_mutexattr_destroy'| 11/usr/lib/liballegro-static.a(uxthread.c.o)||In function `_al_thread_detach':| 12/home/edwin/allegro5/src/unix/uxthread.c|90|undefined reference to `pthread_detach'| 13/usr/lib/liballegro-static.a(xsystem.c.o)||In function `xglx_get_cursor_position':| 14/home/edwin/allegro5/src/x/xsystem.c|194|undefined reference to `XQueryPointer'| 15/usr/lib/liballegro-static.a(xsystem.c.o)||In function `xglx_shutdown_system':| 16/home/edwin/allegro5/src/x/xsystem.c|111|undefined reference to `XSync'| 17/home/edwin/allegro5/src/x/xsystem.c|117|undefined reference to `XCloseDisplay'| 18/home/edwin/allegro5/src/x/xsystem.c|123|undefined reference to `XCloseDisplay'| 19/usr/lib/liballegro-static.a(xsystem.c.o)||In function `xglx_initialize':| 20/home/edwin/allegro5/src/x/xsystem.c|35|undefined reference to `XInitThreads'| 21/home/edwin/allegro5/src/x/xsystem.c|38|undefined reference to `XOpenDisplay'| 22/home/edwin/allegro5/src/x/xsystem.c|41|undefined reference to `XOpenDisplay'| 23/home/edwin/allegro5/src/x/xsystem.c|78|undefined reference to `XInternAtom'| 24/home/edwin/allegro5/src/x/xsystem.c|44|undefined reference to `XCloseDisplay'| 25/usr/lib/liballegro-static.a(xcursor.c.o)||In function `xdpy_hide_mouse_cursor':| 26/home/edwin/allegro5/src/x/xcursor.c|272|undefined reference to `XDefineCursor'| 27/home/edwin/allegro5/src/x/xcursor.c|252|undefined reference to `XCreatePixmap'| 28/home/edwin/allegro5/src/x/xcursor.c|261|undefined reference to `XCreateGC'| 29/home/edwin/allegro5/src/x/xcursor.c|262|undefined reference to `XDrawPoint'| 30/home/edwin/allegro5/src/x/xcursor.c|263|undefined reference to `XFreeGC'| 31/home/edwin/allegro5/src/x/xcursor.c|267|undefined reference to `XCreatePixmapCursor'| 32/home/edwin/allegro5/src/x/xcursor.c|269|undefined reference to `XFreePixmap'| 33/usr/lib/liballegro-static.a(xcursor.c.o)||In function `xdpy_show_mouse_cursor':| 34/home/edwin/allegro5/src/x/xcursor.c|227|undefined reference to `XDefineCursor'| 35/usr/lib/liballegro-static.a(xcursor.c.o)||In function `xdpy_set_mouse_cursor':| 36/home/edwin/allegro5/src/x/xcursor.c|123|undefined reference to `XDefineCursor'| 37/usr/lib/liballegro-static.a(xcursor.c.o)||In function `xdpy_set_system_mouse_cursor':| 38/home/edwin/allegro5/src/x/xcursor.c|201|undefined reference to `XCreateFontCursor'| 39/home/edwin/allegro5/src/x/xcursor.c|205|undefined reference to `XDefineCursor'| 40/usr/lib/liballegro-static.a(xcursor.c.o)||In function `_al_xwin_create_mouse_cursor':| 41/home/edwin/allegro5/src/x/xcursor.c|41|undefined reference to `XcursorImageCreate'| 42/home/edwin/allegro5/src/x/xcursor.c|72|undefined reference to `XcursorImageLoadCursor'| 43/home/edwin/allegro5/src/x/xcursor.c|75|undefined reference to `XcursorImageDestroy'| 44/usr/lib/liballegro-static.a(xcursor.c.o)||In function `_al_xwin_destroy_mouse_cursor':| 45/home/edwin/allegro5/src/x/xcursor.c|102|undefined reference to `XFreeCursor'| 46/home/edwin/allegro5/src/x/xcursor.c|97|undefined reference to `XUndefineCursor'| 47/usr/lib/liballegro-static.a(xdisplay.c.o)||In function `xdpy_acknowledge_resize':| 48/home/edwin/allegro5/src/x/xdisplay.c|789|undefined reference to `XGetWindowAttributes'| 49/usr/lib/liballegro-static.a(xdisplay.c.o)||In function `xdpy_set_frame':| 50/home/edwin/allegro5/src/x/xdisplay.c|148|undefined reference to `XInternAtom'| 51/home/edwin/allegro5/src/x/xdisplay.c|157|undefined reference to `XChangeProperty'| 52/usr/lib/liballegro-static.a(xdisplay.c.o)||In function `xdpy_set_window_position':| 53/home/edwin/allegro5/src/x/xdisplay.c|113|undefined reference to `XQueryTree'| 54/home/edwin/allegro5/src/x/xdisplay.c|115|undefined reference to `XTranslateCoordinates'| 55/home/edwin/allegro5/src/x/xdisplay.c|119|undefined reference to `XMoveWindow'| 56/home/edwin/allegro5/src/x/xdisplay.c|120|undefined reference to `XFlush'| 57/usr/lib/liballegro-static.a(xdisplay.c.o)||In function `xdpy_set_window_title':| 58/home/edwin/allegro5/src/x/xdisplay.c|1095|undefined reference to `XInternAtom'| 59/home/edwin/allegro5/src/x/xdisplay.c|1096|undefined reference to `XInternAtom'| 60/home/edwin/allegro5/src/x/xdisplay.c|1099|undefined reference to `Xutf8TextListToTextProperty'| 61/home/edwin/allegro5/src/x/xdisplay.c|1101|undefined reference to `XSetTextProperty'| 62/home/edwin/allegro5/src/x/xdisplay.c|1102|undefined reference to `XSetTextProperty'| 63/home/edwin/allegro5/src/x/xdisplay.c|1103|undefined reference to `XFree'| 64/home/edwin/allegro5/src/x/xdisplay.c|1107|undefined reference to `XSetClassHint'| 65/usr/lib/liballegro-static.a(xdisplay.c.o)||In function `xdpy_set_icon_inner':| 66/home/edwin/allegro5/src/x/xdisplay.c|62|undefined reference to `XInternAtom'| 67/home/edwin/allegro5/src/x/xdisplay.c|63|undefined reference to `XChangeProperty'| 68/usr/lib/liballegro-static.a(xdisplay.c.o)||In function `xdpy_flip_display':| 69/home/edwin/allegro5/src/x/xdisplay.c|750|undefined reference to `glGetError'| 70/usr/lib/liballegro-static.a(xdisplay.c.o)||In function `xdpy_set_current_display':| 71/home/edwin/allegro5/src/x/xdisplay.c|721|undefined reference to `glXMakeContextCurrent'| 72||More errors follow but not being shown.| 73||Edit the max errors limit in compiler options...| 74||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 10 second(s)) ===|

Building Allegro5 staticlt with make went fine..
and I did put #define ALLEGRO_STATICLINK on top of my code...
anyone ?
???
It says StarTrekV3_Windows but this is the LINUX port itś just a name that hasn't changed

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

RPG Hacker
Member #12,492
January 2011
avatar

Ariesnl said:

and I did put #define ALLEGRO_STATICLINK on top of my code...

Everywhere? Or just in a single source file? AFAIK, it needs to be defined everywhere ALLEGRO headers are included. The easiest way to do this of course would be to add a preprocessor definition to the compiler instead of adding the define to any source file.

Ariesnl
Member #2,902
November 2002
avatar

stuffed it into the compiler defines... still the same ... ::)

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

RPG Hacker
Member #12,492
January 2011
avatar

Are the linked libraries specified in the correct order?

jmasterx
Member #11,410
October 2009

Are you linking against X and pthread?

When you static link, you have to also link against all dependent libraries.

Ariesnl
Member #2,902
November 2002
avatar

OMG dependency hell..
What is the best way to solve that ?
How many dependencies are there ?

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

Elias
Member #358
May 2000

`pkg-config allegro_monolith-debug-static-5 --libs --static`

--
"Either help out or stop whining" - Evert

Ariesnl
Member #2,902
November 2002
avatar

Thanks a lot
I finally got it working..
but to be sure.. hereś the LINUX version paperclip ! ( far from ready but you can fly around and kick some klingon butt.. ;D

#SelectExpand
1You are placed in the role of James Tiberius Kirk, captain of the USS Enterprise NCC-1701. 2* The Enterprise is a big spaceship with a lot of systems and equipment. Everything on your ship uses energy to function. 3* This energy is taken from the WARPCORE energy buffer. The Warp core generates energy by a matter-antimatter reaction producing a huge amount of energy. 4* Under normal circumstances more than enough to power everything on your ship and enough to make a warp jump through multiple sectors. 5* However If the WARPCORE is damaged the energy output will decrease. 6* Energy is also needed to maintain a containment field around the WARPCORE. If the warpcore is damaged and there is no energy left the warpcore will fail. 7* Resulting in the destruction of your ship ! 8* Damaged systems can be repaired at the Engineering screen. The repair crew can only fix one item at a time. 9* At a federation starbase repairs can be made much quicker. 10* The Navigation screen shows the Known universe, revealing more when new sectors are explored or when scanned with a probe (probes not implenemted yet) 11* 12* The game is far from finished yet. However you can already explore a HUGE universe 13* with Klingon and Romulan empires. For testing purposes A Klingon Task force will invade your home sector at the start of a game. 14* To disable this.. go to Universe.cpp and comment out: 15* 16* a_Sector.m_nKlingonBC = 2; 17* a_Sector.m_nKlingonBOP = 2; 18* a_Sector.m_nFederation1 = 3; 19* 20* In Universe::GenerateHomeSector(Sector & a_Sector). 21* 22* 23* \section COMBAT 24* The Enterprise has 2 weapons, Photon torpedoes and Phasers. 25* PHOTON TORPEDOES torpedoes explode when they hit something resulting in massive damage over all systems. 26* The damage is not dependent on the distance, there is only a maximum range. 27* you only have a certain amount of torpedoes, they can be replenished at a starbase only ! 28* When COMPUTER and SENSORS are in good shape, they will precalculate a firing solution for a selected target. 29* 30* PHASERS only consume energy. Over time, the Phaserbanks are charged with energy from the warpcore buffer. 31* The damage a phaser does is dependend on the distance to the target. The further away, the less damage. 32* PHASERS are much more precise and can take out one single system. 33* 34* The Enterprise is also equipped with shields. When hit, the shield energy will drop using energy to block the incoming weapon. 35* The shieldsystem will immediately begin to recharge the shield, taking energy from the WARPCORE buffer. 36* If the shieldsystem is damaged,it will become less efficient in charging the shield. 37* (Converting Warpcore energy into shield energy will be less efficient) 38* 39* 40* \section CONTROLS 41* 42* The standard controls are: 43* 44* Arrow UP ---> Speed up 45* Arrow DOWN ---> Slow Down 46* Arrow LEFT ---> Turn Left 47* Arrow RIGHT ---> Turn Right 48* TAB ---> Fire front photon tube 49* L SHIFT ---> Fire aft photon tube 50* SPACE ---> Fire Phaser 51* 1..5 ---> Warp 1 tm Warp 5 52* T ---> target nearest enemy 53* F ---> target nearest friend 54* D ---> Dock at starbase (when in range) 55* R ---> Release from dock. 56* F1 ---> Main screen 57* F2 ---> Engineering 58* F3 ---> Astro Navigation 59* 60* F5 ---> Navigation Exploration 61* F6 ---> Navigation Tactical mode 62* F7 ---> Navigation Political mode 63* 64**/

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

gillius
Member #119
April 2000

If there exists a static build of Allegro that is capable of running across a range of modern Linux systems, I would be interested in it to include it in my jalleg binding. I am using the monolith DLL on Windows today. If I had a static Allegro Linux build a single JAR can run on Linux and Windows systems.

Gillius
Gillius's Programming -- https://gillius.org/

Go to: