I think I just resolved the issue, but I'm not entirely sure I understood what went wrong.
I neglected to mention that I had installed gcc 4.6.0 prior to installing Boost. I installed gcc like so:
./configure --prefix=/usr/local --program-suffix=-4.6
make
make install
When I uninstalled gcc, like so
sort -r gcc_files |while read f; do
sudo rm $f 2>/dev/null || sudo rmdir $f 2>/dev/null;
done
and then rebuilt and reinstalled Boost, the program I enlisted in my previous post ran without a crash.
Perhaps g++-4.6 files got in the way in using g++-4.0 ? I'd really like to have g++-4.6 to enjoy the latest taste of C++0x it features! Sorry if I'm jumping off-topic here, but I'm not sure where I should otherwise ask about getting g++-4.6 working with Boost v1.46.1.
Matan
On Sat, May 21, 2011 at 1:48 PM, Matan Nassau
<matan.nassau@gmail.com> wrote:
Hi!
When I run the following program,
#include <boost/program_options.hpp>
int main()
{
boost::program_options::positional_options_description positional;
return 0;
}
the program aborts with the error
sandbox(1791) malloc: *** error for object 0x7fff70506500: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
My platform is Mac OS X 10.6.7. I installed Boost 1.46.1 on my own, like so:
./bootstrap --prefix=/usr/local
./bjam memory-model=64
./bjam install
The toolset bjam chose was darwin, which uses gcc-4.0 if I understood the build correctly. I also tried rebuilding boost with
./bjam memory-model=64 toolset=darwin-4.2
but the issue persisted.
Any idea what causes this crash?
Matan