Search code examples
gccboostmingw-w64jam

Building boost without memory-mapped IO


I'm trying to build boost 1.71 for a platform which doesn't have mmap/munmap (Nintendo Switch with devkitPro toolchain). The build fails because there is no <sys/mman.h> file.

How do I configure boost to disable memory-mapped IO? I have checked boost/config/user.hpp but there seems to be no relevant options in there.


Solution

  • For Header-Only Use:

    Make sure

    • BOOST_CONTEXT_USE_MAP_STACK is not defined

    • avoid including context/posix/protected_fixedsize_stack.hpp. (header guard BOOST_CONTEXT_PROTECTED_FIXEDSIZE_H)

    • avoid including coroutine/posix/protected_stack_allocator.hpp. (header guard BOOST_COROUTINES_PROTECTED_STACK_ALLOCATOR_H)

    • BOOST_SPIRIT_FILEITERATOR_POSIX is not defined if you use Spirit Classic

    • Don't use Boost Interprocess shared memory/mapped files. interprocess/anonymous_shared_memory.hpp, interprocess/shared_memory_object.hpp, interprocess/mapped_region.hpp)

      There seems to potentially be a way to (de)configure some of the for BOost Interprocess but I don't know what sets defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS) and it looks like it doesn't cover all uses anyways

    For Library Compilation

    The list is going to include all the above and anything that transitively depends on them.

    This could be a lot, but I haven't traced them. So maybe you are in luck for the libraries you are after

    The following direct dependencies can be tweaked though: