Boost logo

Boost-Build :

Subject: [Boost-build] Problem running exe after linking to system library
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2012-07-23 09:40:31


Using boost-trunk, I am trying to run a library that uses chrono, that in turn uses the Boost system
library.

In diagnosing my fault, I have now tried to run the example from Boost.system,
error_code_user_test.cpp

and get the same error message from a post-run event, or from an IDE start, the message box

"Can't start because the program boost_system-vc100-mt-gd-1_50.dll is missing..."

The Output window shows:

Build started 20-Jul-2012 12:48:08.
InitializeBuildStatus:
  Touching "Debug\system_test.unsuccessfulbuild".
ClCompile:
  system_test.cpp
  Linking to lib file: boost_system-vc100-mt-gd-1_50.lib
Link:
  system_test.vcxproj -> J:\Cpp\Misc\Debug\system_test.exe
CustomBuildStep:
  Description: Autorun "J:\Cpp\Misc\Debug\system_test.exe"
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: The
command ""J:\Cpp\Misc\Debug\system_test.exe"
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073:
:VCEnd" exited with code -1073741515.

Build FAILED.

Time Elapsed 00:00:01.34

/Zi /nologo /W4 /WX- /Od /Oy- /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /GF-
/Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Debug\system_test.pch"
/Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /analyze- /errorReport:queue

/OUT:"J:\Cpp\Misc\Debug\system_test.exe" /INCREMENTAL:NO /NOLOGO "kernel32.lib" "user32.lib"
"gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib"
"uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST
/ManifestFile:"Debug\system_test.exe.intermediate.manifest" /ALLOWISOLATION
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"J:\Cpp\Misc\Debug\system_test.pdb"
/SUBSYSTEM:CONSOLE /PGD:"J:\Cpp\Misc\Debug\system_test.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT
/MACHINE:X86 /ERRORREPORT:QUEUE

Multi-threaded Debug DLL (/MDd)

(If I use in the compile options what I expect to use : static - /MTd then I get the #error :
"Mixing a dll boost library with a static runtime is a really bad idea..."

(Why it is looking for the .dll when the build says linking to the .lib???)

All the system .dll and .lib version appear to exist at the default boost-trunk/stage/lib place:

boost_system-vc100-mt-gd-1_50.dll
boost_system-vc100-mt-gd-1_50.lib

Using the libs/system/test jamfile.v2, I get

error_code_user_test.cpp
msvc.link
..\..\..\bin.v2\libs\system\test\error_code_user_test.test\msvc-10.0\debug\asynch-exceptions-on\link
-static\threading-multi\error_code_user_test.exe
msvc.manifest
..\..\..\bin.v2\libs\system\test\error_code_user_test.test\msvc-10.0\debug\asynch-exceptions-on\link
-static\threading-multi\error_code_user_test.exe
testing.capture-output
..\..\..\bin.v2\libs\system\test\error_code_user_test.test\msvc-10.0\debug\asynch-exceptions-on\link
-static\threading-multi\error_code_user_test.run
        1 file(s) copied.
**passed**
..\..\..\bin.v2\libs\system\test\error_code_user_test.test\msvc-10.0\debug\asynch-exceptions-on\link
-static\threading-multi\error_code_user_test.test
common.mkdir ..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test
common.mkdir ..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0
common.mkdir ..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug
common.mkdir
..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug\asynch-exceptions-
on
common.mkdir
..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug\asynch-exceptions-
on\threading-multi
compile-c-c++
..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug\asynch-exceptions-
on\threading-multi\error_code_user_test.obj
error_code_user_test.cpp
msvc.link
..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug\asynch-exceptions-
on\threading-multi\error_code_user_test_shared.exe
msvc.manifest
..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug\asynch-exceptions-
on\threading-multi\error_code_user_test_shared.exe
testing.capture-output
..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug\asynch-exceptions-
on\threading-multi\error_code_user_test_shared.run
        1 file(s) copied.
**passed**
..\..\..\bin.v2\libs\system\test\error_code_user_test_shared.test\msvc-10.0\debug\asynch-exceptions-
on\threading-multi\error_code_user_test_shared.test

For this items the jamfile.v2 says

         [ run error_code_user_test.cpp
           : : : <link>static
         ]
         [ run error_code_user_test.cpp
           : : : <link>shared : error_code_user_test_shared
         ]

So I concluded that all the files are definitely present at the right places.

What I eventually discovered I was doing wrong was not to include the macro call

#define BOOST_SYSTEM_STATIC_LINK 1

(not included in boost-trunk/libs/config/doc/html/boost_config/boost_macro_reference.html
incidentally)

I find this confusing. It appears that autolinking is not working as I would expected.

Am I doing something else wrong?

Thanks

Paul

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk