Software Engineering : Build Boost C++ Libraries with GCC on Windows

Share
Embed
  • Published on Jun 4, 2016
  • An exert from one of my live-streams, where I quickly show you how to build and use boost C++ libraries with the MinGW compiler pack installed with Code-Blocks:
    Get boost: www.boost.org
    Get Code::Blocks: www.codeblocks.org
    Keep up to date on all my tech, tinkering, gaming and ranting at my blog: megalomaniacbore.blogspot.co.uk/
    -- Watch live at www.twitch.tv/xelous
  • Science & TechnologyScience & Technology

Comments • 50

  • ألمـانيـا أونلايـن Germany Online

    many thanks for you it is helpful :)

  • Bhanu Tez
    Bhanu Tez 7 months ago

    CAn you please do a video on how to install libraries in mingw using conan package manager

  • AndyD89
    AndyD89 Year ago

    I just tried following your instructions (July 2018) with boost 1.67 and GCC 5.1.0 from MinGW and I am getting linking errors.... “undefined reference to ‘UnregisterWait’”

  • Huy Võ Lê
    Huy Võ Lê Year ago

    More sir !

  • Abhay Iyer
    Abhay Iyer Year ago

    I'm getting this error. How should I proceed?

    F:\boost\boost_1_67_0>bootstrap.bat mingw
    Building Boost.Build engine
    execnt.c: In function 'try_wait_callback':
    execnt.c:856:5: warning: implicit declaration of function 'UnregisterWait' [-Wim
    plicit-function-declaration]
    UnregisterWait( slot->wait_handle );
    ^
    execnt.c: In function 'register_wait':
    execnt.c:876:9: warning: implicit declaration of function 'RegisterWaitForSingle
    Object' [-Wimplicit-function-declaration]
    RegisterWaitForSingleObject( &cmdtab[ job_id ].wait_handle,
    ^
    C:\xx\AppData\Local\Temp\ccGo7nN4.o:execnt.c:(.text+0x139a): undefined r
    eference to `UnregisterWait'
    C:\xx\AppData\Local\Temp\ccGo7nN4.o:execnt.c:(.text+0x146b): undefined r
    eference to `RegisterWaitForSingleObject'
    collect2.exe: error: ld returned 1 exit status

    Failed to build Boost.Build engine.
    Please consult bootstrap.log for further diagnostics.

    • Lord Xelous
      Lord Xelous  Year ago

      First of all, did you check bootstrap.log for the provided further diagnostics? But it looks like you're using Windows 10 and running into this problem "svn.boost.org/trac10/ticket/13390". So you need to declare "-D_WIN32_WINNT=0x501" as Windows 10 is throwing the build off... Good luck with it, let me know how you get along.

  • Wallison Rocha
    Wallison Rocha Year ago

    The entry point of the __printf__ procedure could not be located in the dynamic link library
    c:\Program Files (x86)\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\5.1.0\..\..\..\..\mingw32\bin\as.exe

    • Lord Xelous
      Lord Xelous  Year ago

      You're not linking against libstd, for some reason... But "printf" is a C function anyways, so not really part of what I'm looking at, if you're writing C++ - not matter what anyone tells you - don't use printf, or sprintf... Use the streams, so in C++ you will want to try std::cout

  • Curitosi KLS
    Curitosi KLS 2 years ago +2

    This is a very very helpful video sir, for me this is amazing , thank you sooooo much ^_^

    • Curitosi KLS
      Curitosi KLS 2 years ago

      Lord Xelous awesome will do

    • Lord Xelous
      Lord Xelous  2 years ago +2

      No problemmo... Check out the blog for more stuff like this!

  • Lord Xelous
    Lord Xelous  2 years ago

    To Mostafa Said - I saw your message, but can not see it here, if your stage/lib folder is empty (and you used the default "boostrap" and then "b2" commands) then simply put the build did not occur, the stage/lib folder is the default output location for a build... Beyond that I can only wish you good luck, unless you can be more specific :)

  • kashif zaheer
    kashif zaheer 2 years ago

    i am trying to run the "bootstrap gcc" command but bootstrap engine does not work, log file give number of errors in files like debugger.c, strings.c. what we do if these files are give by the boost_1_65_1

    • Lord Xelous
      Lord Xelous  2 years ago

      "WaitForSingleObject" is part of the Windows API, specifically the mutex locking calls, it would suggest that your application is not being properly linked against the Windows SDK, which you need to get from Microsoft.
      As for your comment "tune the same boost library" you mean build? You must build the library in order to use it, and the same applies, it can't be built without the right Windows SDK to rely on for the Windows platform, otherwise you can ONLY use boost in it's header implementations, so libraries like the file system and threading (which need a library to be build rather than just a #include of a header file) will not be available, as they can't be built.
      Give this a careful read, especially section 3...www.boost.org/doc/libs/1_65_1/more/getting_started/windows.html...
      Take your time, and don't be afraid of it, it will work, it does work, and it's probably nothing you've done wrong, you just have something set incorrectly, and you can correct it, if you take care.
      Good luck, and let me know how you get along.

    • kashif zaheer
      kashif zaheer 2 years ago

      Right Now i try to run the same boost library in another development environment (codeblock) this time problem as C:\Users\abc\AppData\Local\Temp\ccZgV9Ly.o: execnt.c:(.text+0x1237): undefined reference to 'unregisterwait'
      C:\Users\abc\AppData\Local\Temp\ccZgV9Ly.o: execnt.c:(.text+0x1237): undefined reference to 'RegisteredWaiteFor Single Object'

    • Lord Xelous
      Lord Xelous  2 years ago

      If you are running on linux, you don't need to use the "gcc" specifically, simply type "./bootstrap.sh" in your boost folder, and ./b2 to build.
      As for your specific problem, I'm not sure what the problem is, nor what to suggest in order to fix it... However, it sounds very much as though the bootstrap script can't find the aforementioned files, you may need to install the compiler again, If you are in linux I would suggest you check you have the libstdc and licstdc++ libraries installed & configured correctly, but rather than do this on your machine directly run a linux virtual machine (lvm) and do it within that... If anything then goes wrong, you've only ruined a VM which you can kill off later.
      Additionally you can go through my examples, and other boost examples on my blog here megalomaniacbore.blogspot.co.uk/search?q=Boost+gcc
      You can find the official boost invocation documentation here: www.boost.org/build/doc/html/bbv2/overview/invocation.html
      And here is an older build & test guide for gcc by gnu themselves: gcc.gnu.org/testing/testing-boost.html

  • Pradeep Jyani
    Pradeep Jyani 2 years ago

    After this activity the stage/lib folder is empty. Am I missing any step. Pls suggest.
    TIA.

    • Lord Xelous
      Lord Xelous  2 years ago

      Perhaps by performing the build, check my reply above including the link to my full blog post series about Boost & building it.

    • pra x
      pra x 2 years ago

      I have the same problem :( How did you fix that ?

    • Pradeep Jyani
      Pradeep Jyani 2 years ago

      Thanks, got all the libs.

    • Lord Xelous
      Lord Xelous  2 years ago

      You've not performed the build, this is why stage/lib is empty... You can find more information about boost, building it and example projects on my blog here megalomaniacbore.blogspot.co.uk/search?q=Boost

    • Pradeep Jyani
      Pradeep Jyani 2 years ago

      The error is like:
      ...failed compile-c-c++ bin.v2\libs\wave\build\msvc\debug\link-static\threading-multi\wave_config_constant.obj...
      compile-c-c++ bin.v2\libs\wave\build\msvc\debug\link-static\threading-multi\cpplexer\re2clex\aq.obj
      'cl' is not recognized as an internal or external command,
      operable program or batch file.

  • Jullian Geremy
    Jullian Geremy 3 years ago

    if you do this and have visual studio will compiled with compiler of visual studio too

    • Jullian Geremy
      Jullian Geremy 3 years ago

      ok thx the only way is like you put in the video bootstrap.bat gcc i'm little new in this so sorry for all!

    • Lord Xelous
      Lord Xelous  3 years ago

      @jeronimo urtado Ah, don't worry, you're not the first to say they had an error without actually building the library :)

    • Jullian Geremy
      Jullian Geremy 3 years ago

      sorry i did mistake my program need to use mingw anyways you know why this error:
      bootstrap.bat mingw
      Building Boost.Build engine
      Failed to build Boost.Build engine.
      Please consult bootstrap.log for further diagnostics.
      You can try to obtain a prebuilt binary from
      sf.net/project/showfiles.php?group_id=7586&package_id=72941
      Also, you can file an issue at svn.boost.org
      Please attach bootstrap.log in that case.
      Sorry a lot i was confused and thx a lot for your channel thx

    • Lord Xelous
      Lord Xelous  3 years ago

      @jeronimo urtado I'll maybe take a look at doing a specific Visual Studio version. Again, thanks for watching!

    • Jullian Geremy
      Jullian Geremy 3 years ago

      Thanks i will check your blog. Anyways one tutorial for visual studio compiler will be great. And i think with mingw is more easy than gcc

  • Jullian Geremy
    Jullian Geremy 3 years ago

    why take me my compiler of visual studio if i did with gcc ? AppData\Local\Temp\b2_msvc_12.0_vcvarsall_x86.cmd

  • Pelao Perez
    Pelao Perez 3 years ago +1

    Name of .txt file please!!!

    • Lord Xelous
      Lord Xelous  3 years ago

      ah I see... I create that file!... in notepad, so you are the source if that file, you make it, save it and use it whenever you open a new command prompt (as I don't personally like adding paths to my environment variables)... watch the video over, it is all there :)... if you are still stuck. check the blog posts too and rewatch this, if you are really really stuck after that I can try to help out further. Good Luck for now.

    • Lord Xelous
      Lord Xelous  3 years ago

      El Legado de Meruem, its a binary installer, downloaded from the codeblocks.org site. I'll take a deeper look when I'm back at home, I'm on my mobile right now :)

    • Pelao Perez
      Pelao Perez 3 years ago

      the 2:00 file name is setupmingw.bat?

    • Lord Xelous
      Lord Xelous  3 years ago +1

      El Legado de Meruem what text file matey?

  • Muhmad
    Muhmad 3 years ago

    Hi. can you build this and upload it? i tried and i gaave up
    github.com/cryptozoidberg/boolberry/releases
    thank you.

    • Lord Xelous
      Lord Xelous  3 years ago

      +Muhmad please post on the other video :), but your error says the compiler has run out of memory... specifically run out of virtual memory... my build environment was Ubuntu 16.04 (64 bit), with a quad core processor and 8gb of ram... this isn't a failure of the build, its a failure of your machine environment...

    • Muhmad
      Muhmad 3 years ago

      hi. It failed- look at this pic.
      postimg.org/image/3mie6klu7/

    • Muhmad
      Muhmad 3 years ago

      Thank you alot- im going to try t and donate to you :) thanks again

    • Lord Xelous
      Lord Xelous  3 years ago

      Built, done, blog post and video up for you: megalomaniacbore.blogspot.co.uk/2016/09/software-engineering-building.html
      Don't forget to like, subscribe & all that good stuff!

    • Muhmad
      Muhmad 3 years ago

      Thank you- this is free and any one can build and upload.
      I just gave up to do it by my self- this why i asked you.
      thank you again :)

  • Angel Nikolov
    Angel Nikolov 3 years ago +2

    Thanks

  • Baqir Khan
    Baqir Khan 3 years ago

    After this, how do I include it to a program in CodeBlocks? I still cannot do it :|

    • Lord Xelous
      Lord Xelous  3 years ago +2

      The quick answer is project properties, the better answer is on my blog, linked above you can find all sorts of stuff, but here's the "boost on codeblocks" with some instructions on not only how to include a header, but to actually link to a build library... Hope that helps.
      megalomaniacbore.blogspot.co.uk/2014/05/setting-up-codeblocks-on-windows.html

  • Peter Taylor
    Peter Taylor 3 years ago +1

    thanks. Very helpful! now i can use the filesystemLibrary in boost until GCC supports it in C++17