diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake index 16d4d2461..f76dc06ab 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -12,30 +12,73 @@ if (STANDALONE) else (STANDALONE) use_prebuilt_binary(boost) set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + set(Boost_VERSION "1.52") if (WINDOWS) - set(BOOST_VERSION 1_45) - set(BOOST_OPTIM_SUFFIX mt) - set(BOOST_DEBUG_SUFFIX mt-gd) - + set(Boost_CONTEXT_LIBRARY + optimized libboost_context-mt + debug libboost_context-mt-gd) + set(Boost_FILESYSTEM_LIBRARY + optimized libboost_filesystem-mt + debug libboost_filesystem-mt-gd) set(Boost_PROGRAM_OPTIONS_LIBRARY - optimized libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION} - debug libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION}) + optimized libboost_program_options-mt + debug libboost_program_options-mt-gd) set(Boost_REGEX_LIBRARY - optimized libboost_regex-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION} - debug libboost_regex-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION}) - - elseif (DARWIN) - set(Boost_FILESYSTEM_LIBRARY boost_filesystem) - set(Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options) - set(Boost_REGEX_LIBRARY boost_regex) - set(Boost_SYSTEM_LIBRARY boost_system) - set(Boost_DATE_TIME_LIBRARY boost_date_time) + optimized libboost_regex-mt + debug libboost_regex-mt-gd) + set(Boost_SIGNALS_LIBRARY + optimized libboost_signals-mt + debug libboost_signals-mt-gd) + set(Boost_SYSTEM_LIBRARY + optimized libboost_system-mt + debug libboost_system-mt-gd) + set(Boost_THREAD_LIBRARY + optimized libboost_thread-mt + debug libboost_thread-mt-gd) elseif (LINUX) - set(Boost_FILESYSTEM_LIBRARY boost_filesystem-mt) - set(Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) - set(Boost_REGEX_LIBRARY boost_regex-mt) - set(Boost_SYSTEM_LIBRARY boost_system-mt) - set(Boost_DATE_TIME_LIBRARY boost_date_time-mt) + set(Boost_CONTEXT_LIBRARY + optimized boost_context-mt + debug boost_context-mt-d) + set(Boost_FILESYSTEM_LIBRARY + optimized boost_filesystem-mt + debug boost_filesystem-mt-d) + set(Boost_PROGRAM_OPTIONS_LIBRARY + optimized boost_program_options-mt + debug boost_program_options-mt-d) + set(Boost_REGEX_LIBRARY + optimized boost_regex-mt + debug boost_regex-mt-d) + set(Boost_SIGNALS_LIBRARY + optimized boost_signals-mt + debug boost_signals-mt-d) + set(Boost_SYSTEM_LIBRARY + optimized boost_system-mt + debug boost_system-mt-d) + set(Boost_THREAD_LIBRARY + optimized boost_thread-mt + debug boost_thread-mt-d) + elseif (DARWIN) + set(Boost_CONTEXT_LIBRARY + optimized boost_context-mt + debug boost_context-mt-d) + set(Boost_FILESYSTEM_LIBRARY + optimized boost_filesystem-mt + debug boost_filesystem-mt-d) + set(Boost_PROGRAM_OPTIONS_LIBRARY + optimized boost_program_options-mt + debug boost_program_options-mt-d) + set(Boost_REGEX_LIBRARY + optimized boost_regex-mt + debug boost_regex-mt-d) + set(Boost_SIGNALS_LIBRARY + optimized boost_signals-mt + debug boost_signals-mt-d) + set(Boost_SYSTEM_LIBRARY + optimized boost_system-mt + debug boost_system-mt-d) + set(Boost_THREAD_LIBRARY + optimized boost_thread-mt + debug boost_thread-mt-d) endif (WINDOWS) endif (STANDALONE) diff --git a/indra/cmake/Colladadom.cmake b/indra/cmake/Colladadom.cmake index 1e4a9ed56..9041803d5 100644 --- a/indra/cmake/Colladadom.cmake +++ b/indra/cmake/Colladadom.cmake @@ -28,10 +28,6 @@ else (STANDALONE) set(COLLADADOM_LIBRARIES debug libcollada14dom22-d optimized libcollada14dom22 - debug libboost_filesystem-vc100-mt-gd-1_45.lib - optimized libboost_filesystem-vc100-mt-1_45.lib - debug libboost_system-vc100-mt-gd-1_45.lib - optimized libboost_system-vc100-mt-1_45.lib ) else (WINDOWS) set(COLLADADOM_LIBRARIES diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 3d71566c7..a5bcfafac 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -273,6 +273,7 @@ target_link_libraries( ${EXPAT_LIBRARIES} ${ZLIB_LIBRARIES} ${WINDOWS_LIBRARIES} + ${Boost_CONTEXT_LIBRARY} ${Boost_REGEX_LIBRARY} ${CORESERVICES_LIBRARY} ) diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 0b5829eb7..baaddcaed 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -39,7 +39,12 @@ #include "llerror.h" #include "stringize.h" -LLCoros::LLCoros() +LLCoros::LLCoros(): + // MAINT-2724: default coroutine stack size too small on Windows. + // Previously we used + // boost::context::guarded_stack_allocator::default_stacksize(); + // empirically this is 64KB on Windows and Linux. Try quadrupling. + mStackSize(256*1024) { // Register our cleanup() method for "mainloop" ticks LLEventPumps::instance().obtain("mainloop").listen( @@ -55,7 +60,7 @@ bool LLCoros::cleanup(const LLSD&) // since last tick? if (mi->second->exited()) { - LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; + LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; // The erase() call will invalidate its passed iterator value -- // so increment mi FIRST -- but pass its original value to // erase(). This is what postincrement is all about. @@ -89,7 +94,7 @@ std::string LLCoros::generateDistinctName(const std::string& prefix) const { if (mCoros.find(name) == mCoros.end()) { - LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; + LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; return name; } } @@ -115,7 +120,7 @@ std::string LLCoros::getNameByID(const void* self_id) const // passed to us comes. for (CoroMap::const_iterator mi(mCoros.begin()), mend(mCoros.end()); mi != mend; ++mi) { - namespace coro_private = boost::coroutines::detail; + namespace coro_private = boost::dcoroutines::detail; if (static_cast(coro_private::coroutine_accessor::get_impl(const_cast(*mi->second)).get()) == self_id) { @@ -125,6 +130,12 @@ std::string LLCoros::getNameByID(const void* self_id) const return ""; } +void LLCoros::setStackSize(S32 stacksize) +{ + LL_INFOS("LLCoros") << "Setting coroutine stack size to " << stacksize << LL_ENDL; + mStackSize = stacksize; +} + /***************************************************************************** * MUST BE LAST *****************************************************************************/ diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index d75f28ec1..01ee11da1 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -29,7 +29,7 @@ #if ! defined(LL_LLCOROS_H) #define LL_LLCOROS_H -#include +#include #include "llsingleton.h" #include #include @@ -78,8 +78,8 @@ class LL_COMMON_API LLCoros: public LLSingleton { public: - /// Canonical boost::coroutines::coroutine signature we use - typedef boost::coroutines::coroutine coro; + /// Canonical boost::dcoroutines::coroutine signature we use + typedef boost::dcoroutines::coroutine coro; /// Canonical 'self' type typedef coro::self self; @@ -125,7 +125,7 @@ public: template std::string launch(const std::string& prefix, const CALLABLE& callable) { - return launchImpl(prefix, new coro(callable)); + return launchImpl(prefix, new coro(callable, mStackSize)); } /** @@ -152,6 +152,9 @@ public: /// getName() by self.get_id() std::string getNameByID(const void* self_id) const; + /// for delayed initialization + void setStackSize(S32 stacksize); + private: friend class LLSingleton; LLCoros(); @@ -159,6 +162,7 @@ private: std::string generateDistinctName(const std::string& prefix) const; bool cleanup(const LLSD&); + S32 mStackSize; typedef boost::ptr_map CoroMap; CoroMap mCoros; }; diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index 88a5e6ec7..a42af63b6 100644 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -29,8 +29,8 @@ #if ! defined(LL_LLEVENTCORO_H) #define LL_LLEVENTCORO_H -#include -#include +#include +#include #include #include #include @@ -206,13 +206,13 @@ LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& req const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath=LLSD()) { // declare the future - boost::coroutines::future future(self); + boost::dcoroutines::future future(self); // make a callback that will assign a value to the future, and listen on // the specified LLEventPump with that callback std::string listenerName(LLEventDetail::listenerNameForCoro(self)); LLTempBoundListener connection( replyPump.getPump().listen(listenerName, - voidlistener(boost::coroutines::make_callback(future)))); + voidlistener(boost::dcoroutines::make_callback(future)))); // skip the "post" part if requestPump is default-constructed if (requestPump) { @@ -257,7 +257,7 @@ namespace LLEventDetail * This helper is specifically for the two-pump version of waitForEventOn(). * We use a single future object, but we want to listen on two pumps with it. * Since we must still adapt from (the callable constructed by) - * boost::coroutines::make_callback() (void return) to provide an event + * boost::dcoroutines::make_callback() (void return) to provide an event * listener (bool return), we've adapted LLVoidListener for the purpose. The * basic idea is that we construct a distinct instance of WaitForEventOnHelper * -- binding different instance data -- for each of the pumps. Then, when a @@ -331,16 +331,16 @@ LLEventWithID postAndWait2(SELF& self, const LLSD& event, const LLSD& replyPump1NamePath=LLSD()) { // declare the future - boost::coroutines::future future(self); + boost::dcoroutines::future future(self); // either callback will assign a value to this future; listen on // each specified LLEventPump with a callback std::string name(LLEventDetail::listenerNameForCoro(self)); LLTempBoundListener connection0( replyPump0.getPump().listen(name + "a", - LLEventDetail::wfeoh(boost::coroutines::make_callback(future), 0))); + LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 0))); LLTempBoundListener connection1( replyPump1.getPump().listen(name + "b", - LLEventDetail::wfeoh(boost::coroutines::make_callback(future), 1))); + LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 1))); // skip the "post" part if requestPump is default-constructed if (requestPump) { diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 7b890c57a..d8b179ed9 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -56,14 +56,7 @@ LLShaderMgr::LLShaderMgr() { { const std::string dumpdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"shader_dump")+gDirUtilp->getDirDelimiter(); - try - { - boost::filesystem::remove_all(dumpdir); - } - catch(const boost::filesystem::filesystem_error& e) - { - llinfos << "boost::filesystem::remove_all(\""+dumpdir+"\") failed: '" + e.code().message() + "'" << llendl; - } + gDirUtilp->deleteDirAndContents(dumpdir); } } diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index df87d1d34..60d3c775d 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -111,7 +111,7 @@ std::vector LLDir::getFilesInDir(const std::string &dirname) { if (boost::filesystem::is_regular_file(dir_itr->status())) { - v.push_back(dir_itr->path().filename().c_str()); + v.push_back(dir_itr->path().filename().string()); } } } @@ -180,14 +180,19 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) U32 LLDir::deleteDirAndContents(const std::string& dir_name) { //Removes the directory and its contents. Returns number of files removed. -#if defined(LL_LINUX) - // Singu TODO: Workaround for boost crashing on linux - deleteFilesInDir(dir_name, "*"); - boost::filesystem::remove(dir_name); - return 1; -#else - return boost::filesystem::remove_all(dir_name); -#endif + // Singu Note: boost::filesystem throws exceptions + S32 res = 0; + + try + { + res = boost::filesystem::remove_all(dir_name); + } + catch(const boost::filesystem::filesystem_error& e) + { + llinfos << "boost::filesystem::remove_all(\"" + dir_name + "\") failed: '" + e.code().message() + "'" << llendl; + } + + return res; } const std::string LLDir::findFile(const std::string &filename, diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3a5451403..d7dbce179 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1589,6 +1589,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLCOMMON_LIBRARIES} ${NDOF_LIBRARY} ${viewer_LIBRARIES} + ${Boost_CONTEXT_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY} diff --git a/install.xml b/install.xml index 809cb3a1f..1acdc70f1 100644 --- a/install.xml +++ b/install.xml @@ -181,30 +181,30 @@ darwin md5sum - e859007376f28d699bfea420e44d02e3 + b31c495d5e77daa09394b370fc228312 url - https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.45.0-darwin-20110304.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-darwin-20130221.tar.bz2 linux md5sum - 6e71c78873593aea2ec5c68dcfde0167 + c11e7bd8c35401f240338ebea5390499 url - https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.45.0-linux-20110604.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-linux-20130222.tar.bz2 linux64 md5sum - ac6e5b52d5cf13443607c09d8c62b6c5 + fab1924c7c83c2fb945957b0a9a211e5 url - https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.48.0-linux-x86_64-20120719.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-linux64-20130531.tar.bz2 windows md5sum - ba3165f8e51c7a59f55c7464932fbfc1 + eb13ff93db50d4b08648a5c78ba05310 url - https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.45.0-windows-20120704.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-windows-20130221.tar.bz2