Results 1 to 13 of 13

Thread: Compiling with MinGW

  1. #1

    Default Compiling with MinGW

    I have been trying unsuccessfully for a few days to get ClanLib to compile using MinGW and GCC. I have been able to find tutorials on how to build it with MinGW, but all of them are for old versions of ClanLib, and no longer work. I was wondering of anyone has been able to get the latest version of ClanLib to compile with MinGW, and if so, what did you have to do?

    Thanks
    -Kit

  2. #2

    Default

    I've made it up to the display part of ClanLib using Mingw (GCC 4.5), but I can't for the life of me figure out to to disable X11 from the system, or find X11 libraries I believe will work.
    Last edited by B. Marquis; 01-12-2011 at 08:51 PM. Reason: To elaborate on the compiler used, to be certain I am using mingw

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    No active ClanLib developers use MinGW. I belived ClanLib 1.x works, but ClanLib 2.x does not.

    I don't know why, and don't know how difficult it will be to fix

  4. #4

    Default

    It was fairly easy. Most of the reason it wouldn't compile was oversight. I changed it in such a way that it does minimal editing to code, and I managed to compile all in the API App, and Core directories. However, I can't seem to figure out why it insists of compiling the Display/X11 folder, which, I saw by simple manipulating, is the only reason I'm not finished compiling the Display folder.

    Making all in Display
    make[2]: Entering directory `c:/Users/Owner/Development/Libraries/ClanLib-2.2.5/Sources/Display'
    if C:/msys/1.0/bin/sh.exe ../../libtool --tag=CXX --mode=compile g++ -DPACKAGE_NAME=\"ClanLib\" -DPACKAGE_TARNAME=\"clanlib\" -DPACKAGE_VERSION=\"2.2.5\" -DPACKAGE_STRING=\"ClanLib\ 2.2.5\" -DPACKAGE_
    BUGREPORT=\"\" -DPACKAGE=\"clanlib\" -DVERSION=\"2.2.5\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTY
    PES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_STDBOOL_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DEXTERN___PROGNAME=1 -DHAVE_LIBZ=1 -I. -I. -DUNICODE -msse2 -I/mingw/incl
    ude/freetype2 -I/mingw/include -I/mingw/include -I../../Sources -MT X11/libclan22Display_la-x11_window.lo -MD -MP -MF "X11/.deps/libclan22Display_la-x11_window.Tpo" -c -o X11/libclan22Display_la-
    x11_window.lo `test -f 'X11/x11_window.cpp' || echo './'`X11/x11_window.cpp; \
    then mv -f "X11/.deps/libclan22Display_la-x11_window.Tpo" "X11/.deps/libclan22Display_la-x11_window.Plo"; else rm -f "X11/.deps/libclan22Display_la-x11_window.Tpo"; exit 1; fi
    g++ -DPACKAGE_NAME=\"ClanLib\" -DPACKAGE_TARNAME=\"clanlib\" -DPACKAGE_VERSION=\"2.2.5\" "-DPACKAGE_STRING=\"ClanLib 2.2.5\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"clanlib\" -DVERSION=\"2.2.5\" -DSTDC
    _HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -D
    HAVE_STDBOOL_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DEXTERN___PROGNAME=1 -DHAVE_LIBZ=1 -I. -I. -DUNICODE -msse2 -I/mingw/include/freetype2 -I/mingw/include -I/mingw/include -I../../Sources -MT X11/li
    bclan22Display_la-x11_window.lo -MD -MP -MF X11/.deps/libclan22Display_la-x11_window.Tpo -c X11/x11_window.cpp -o X11/libclan22Display_la-x11_window.o
    In file included from X11/x11_window.h:45:0,
    from X11/x11_window.cpp:44:
    X11/clipboard_x11.h:31:22: fatal error: X11/Xlib.h: No such file or directory
    compilation terminated.
    make[2]: *** [X11/libclan22Display_la-x11_window.lo] Error 1
    make[2]: Leaving directory `c:/Users/Owner/Development/Libraries/ClanLib-2.2.5/Sources/Display'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `c:/Users/Owner/Development/Libraries/ClanLib-2.2.5/Sources'
    make: *** [all-recursive] Error 1

  5. #5

    Default ClanLib-2.2.6_mingw-4.5.2.patch

    ClanLib-2.2.6_mingw-4.5.2.patch

    Here's what's promised. This patch will allow you to compile ClanLib-2.2.6 with Mingw-4.5.2. This patch can also be used normally with the other compilers as you see fit, but since this is an experimental patch, I do not recommend patching for any purpose other than to experiment or to help fix bugs.

    Right now, known problems are as follows:
    • The following files are required but is not available in MinGW-4.5.2
      1. MsTCIP.h
      2. nldef.h
      3. intrin.h (But can be commented out)
      4. dinput.h
      5. dbghlp.h
    • SwRender, GL, and GL1 is incomplete. Attempting to compile using either will result in the following compiler errors:
      • SWRender:
        • undefined reference to `CL_Win32Window::CL_Win32Window()'
        • undefined reference to `CL_Win32Window::~CL_Win32Window()'
        • undefined reference to `CL_Win32Window::~CL_Win32Window()'
        • undefined reference to `CL_Win32Window::~CL_Win32Window()'
        • undefined reference to `CL_Win32Window::get_geometry() const'
        • undefined reference to `CL_Win32Window::get_viewport() const'
        • undefined reference to `CL_Win32Window::has_focus() const'
        • undefined reference to `CL_Win32Window::is_minimized() const'
        • undefined reference to `CL_Win32Window::is_maximized() const'
        • undefined reference to `CL_Win32Window::is_visible() const'
        • undefined reference to `CL_Win32Window::is_clipboard_text_available() const'
        • undefined reference to `CL_Win32Window::is_clipboard_image_available() const'
        • undefined reference to `CL_Win32Window::get_minimum_size(bool) const'
        • undefined reference to `CL_Win32Window::get_maximum_size(bool) const'
        • undefined reference to `CL_Win32Window::get_title() const'
        • undefined reference to `CL_Win32Window::client_to_screen(CL_Point const&)'
        • undefined reference to `CL_Win32Window::screen_to_client(CL_Point const&)'
        • undefined reference to `CL_Win32Window::capture_mouse(bool)'
        • undefined reference to `CL_Win32Window::create(CL_DisplayWindowSite*, CL_DisplayWindowDescription const&)'
        • undefined reference to `CL_Win32Window::show_system_cursor()'
        • undefined reference to `CL_CursorProvider_Win32::CL_CursorProvider_Win32( CL_SpriteDescription const&, CL_Point const&)'
        • undefined reference to `CL_Win32Window::set_cursor(CL_CursorProvider_Win3 2*)'
        • undefined reference to `CL_Win32Window::set_cursor(CL_StandardCursor)'
        • undefined reference to `CL_Win32Window::hide_system_cursor()'
        • undefined reference to `CL_Win32Window::set_title(CL_StringRef8 const&)'
        • undefined reference to `CL_Win32Window::set_position(CL_Rect const&, bool)'
        • undefined reference to `CL_Win32Window::set_size(int, int, bool)'
        • undefined reference to `CL_Win32Window::set_minimum_size(int, int, bool)'
        • undefined reference to `CL_Win32Window::set_maximum_size(int, int, bool)'
        • undefined reference to `CL_Win32Window::set_enabled(bool)'
        • undefined reference to `CL_Win32Window::minimize()'
        • undefined reference to `CL_Win32Window::restore()'
        • undefined reference to `CL_Win32Window::maximize()'
        • undefined reference to `CL_Win32Window::show(bool)'
        • undefined reference to `CL_Win32Window::hide()'
        • undefined reference to `CL_Win32Window::bring_to_front()'
        • undefined reference to `CL_Win32Window::set_clipboard_text(CL_StringRef8 const&)'
        • undefined reference to `CL_Win32Window::set_clipboard_image(CL_PixelBuffe r const&)'
        • undefined reference to `CL_Win32Window::get_clipboard_text() const'
        • undefined reference to `CL_Win32Window::get_clipboard_image() const'
        • undefined reference to `CL_Win32Window::request_repaint(CL_Rect const&)'
        • undefined reference to `CL_Win32Window::set_large_icon(CL_PixelBuffer const&)'
        • undefined reference to `CL_Win32Window::set_small_icon(CL_PixelBuffer const&)'
      • GL1
        • undefined reference to `CL_GL1WindowProvider_WGL::CL_GL1WindowProvider_WG L()'
      • GL
        • undefined reference to `CL_SetupGL::CL_SetupGL()'
        • undefined reference to `CL_SetupGL::~CL_SetupGL()'
        • undefined reference to `CL_SetupGL::~CL_SetupGL()'
    • Core shows unidentified references to _imp__SymInitialize@12, _imp__SymGetSymFromAddr64@20, _imp__SymGetLineFromAddr64@20, _imp__SymCleanup@4. A quick alternative is to link libimagehlp.a
    • The X11 Libraries need to be commented out as well as the unix-made headers in the makefiles.

  6. #6

    Red face

    Update on the project.

    It seems the reason I get all those errors is because of the makefile.am files. Some of the files don't give conditionals to add win32 libraries, which is highly understandable, since I downloaded the linux version. By manually adding the Win32 files in makefile.am and running automake, I've managed to save a lot of time.

    I still have a ways to go. I've managed to compile some of the examples, some of them when executed crashed immediately, so there's still work to be done.

  7. #7
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Nice work

  8. #8

    Default

    Another minor update.

    I still cannot find out why can't some programs work, but by using compatibility mode, I noticed that the latest OS the examples will work flawlessly is Windows 98.

  9. #9
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    That's strange! I wonder what compatibility mode actually does

  10. #10

    Default

    That's a good question. I could not find an in-depth look at compatibility mode. So, I decided to just debug it.

    The problem lies in memory allocation. I implemented a way to allow MinGW to switch between _aligned_alloc and __mingw_aligned_alloc depending on __MSVCRT_VERSION__... but I did not do the same for free, so it's trying to free() allocated memory from a different module, and due to the difference between how msvcrt.dll and libmingwex.a allocates and frees it, causing a SEGFAULT.

    It's almost done. I just need to troubleshoot the SWRender. Afterwards, it's finishing the documentation and changes, compressing it, and storing it somewhere for the general public.

  11. #11
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Feel free to post a patch here

    ClanLib 1.0 (0.8) used to have mingw support.

    It was left to stagnate in ClanLib 2.x, since nobody used it.

  12. #12

    Default

    Is it good to use my browser. I used $ diff -urbdB ClanLib-2.2.6 ClanLib-2.2.6-mingw > ClanLib-2.2.6-mingw.patch and all I can get it in is 1.51 MB, way to large for the upload limit for this forum.

  13. #13
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Try zipping it afterward.

Similar Threads

  1. Compiling on Mac OS X
    By moople in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 06-23-2009, 07:03 AM
  2. post-mortem for MinGW
    By alexv1 in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 04-18-2009, 10:55 AM
  3. Compiling ClanLib MinGW Error
    By FlaPenguin in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 02-20-2009, 08:27 PM
  4. Compiling
    By SushiBox in forum Novashell Game Creation System
    Replies: 2
    Last Post: 11-27-2008, 02:41 AM
  5. ClanLib on DevC++/mingw, among other problems
    By NiMa in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 11-11-2008, 06:15 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •