Search code examples
c++boostcodeblockslibraries

Error while building Boost Library for C++


I'm trying to build the Boost Library to use it on a C++ project on CodeBlocks, but some error is preventing it to complete.

I downloaded the 7z file from the website in this page: https://www.boost.org/users/download/ The Windows version.

Then I tried to build it after the unzip. At first it was unable to find printf, but when I moved the gcc.exe path up in the enviroment variables it game me no more error windows on that.

So I've downloaded it again to try and rebuild from an untouched version and this is what happened

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0>bootstrap.bat gcc -v
Building Boost.Build engine
builtins.cpp: In function 'FILE* windows_popen_wrapper(const char*, const char*)':
builtins.cpp:2483:39: error: '_popen' was not declared in this scope
         result = _popen( command, "r" );
                                       ^
builtins.cpp: In function 'LIST* builtin_shell(FRAME*, int)':
builtins.cpp:2549:29: error: '_pclose' was not declared in this scope
     exit_status = pclose( p );
                             ^
debugger.cpp: In function 'char* debug_string_read(FILE*)':
debugger.cpp:110:33: error: 'strdup' was not declared in this scope
     result = strdup( buf->value );
                                 ^
debugger.cpp: In function 'void debug_init_handles(const char*, const char*)':
debugger.cpp:1073:43: error: '_fdopen' was not declared in this scope
     command_input = _fdopen( read_fd, "r" );
                                           ^
debugger.cpp: In function 'void init_parent_handles(HANDLE, HANDLE)':
debugger.cpp:1091:78: error: '_fdopen' was not declared in this scope
     command_child = _fdopen( _open_osfhandle( (intptr_t)in, _O_RDONLY ), "r" );
                                                                              ^
execnt.cpp: In function 'void try_wait_callback(void*, BOOLEAN)':
execnt.cpp:837:39: error: 'UnregisterWait' was not declared in this scope
     UnregisterWait( slot->wait_handle );
                                       ^
execnt.cpp: In function 'void register_wait(int)':
execnt.cpp:860:52: error: 'RegisterWaitForSingleObject' was not declared in this scope
             WT_EXECUTEDEFAULT | WT_EXECUTEONLYONCE );
                                                    ^
execnt.cpp: In function 'int is_parent_child(DWORD, DWORD)':
execnt.cpp:1085:61: error: 'stricmp' was not declared in this scope
                 if ( !stricmp( pinfo.szExeFile, "csrss.exe" ) &&
                                                             ^
execnt.cpp:1088:60: error: 'stricmp' was not declared in this scope
                 if ( !stricmp( pinfo.szExeFile, "smss.exe" ) &&
                                                            ^
jam.cpp: In function 'int main(int, char**, char**)':
jam.cpp:200:22: error: 'environ' was not declared in this scope
 # define use_environ environ
                      ^
jam.cpp:561:37: note: in expansion of macro 'use_environ'
         var_defines( root_module(), use_environ, 1 );
                                     ^
jam.cpp: In function 'char* executable_path(const char*)':
jam.cpp:729:66: error: 'strdup' was not declared in this scope
     return ( !ret || ret == sizeof( buf ) ) ? NULL : strdup( buf );
                                                                  ^
File Not Found

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

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0>

Here is what the bootstrap.log says

###
### Using 'gcc' toolset.
###

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine>g++ -x c++ -std=c++11 -s -O3 -o b2.exe   -DNDEBUG  builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp filent.cpp filesys.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam.cpp jambase.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp regexp.cpp rules.cpp scan.cpp search.cpp strings.cpp subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp modules/order.cpp modules/path.cpp modules/property-set.cpp modules/regex.cpp modules/sequence.cpp modules/set.cpp  

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine>dir *.exe 
 Volume in drive C is OS
 Volume Serial Number is 5E38-88DC

 Directory of C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine


C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine>copy /b .\b2.exe .\bjam.exe 
The system cannot find the file specified.

Here is the version of gcc I'm using, from the MinGW folder in the Codeblocks installed files

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0>gcc --version
gcc (tdm-1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If requested, I'll gladly provide more informations. Please take into account that I'm new to libraries.

Thank you


Solution

  • I've solved the problem in the end. I learned that the 1.72.0 version has compatibility issues with MinGW, so I reverted back to the 1.70.0 version and, using MinGW I've been able to compile it and get all the libraries I needed.