1

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.

Dmitry Grigoryev
  • 2,826
  • 1
  • 22
  • 51

1 Answers1

1

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:

sehe
  • 328,274
  • 43
  • 416
  • 565
  • O shit - I did all my tracing on 1.74 until I noticed you mentioned 1.71. So, some details might be off – sehe Dec 05 '20 at 23:55
  • Not a problem at all. The lack of `mmap` is not my only problem, just the first one that popped up first, so I expect a few things to be off anyway. – Dmitry Grigoryev Dec 06 '20 at 10:35
  • A beginner's question: where is the right place to specify things such as `LACKS_SYS_MMAN_H`? Is there a syntax for such stuff in `project-config.jam`, or do I add them in `boost/config/user.hpp`, or in the compiler flags? – Dmitry Grigoryev Dec 06 '20 at 11:47
  • 1
    That's precisely the one example that is dlmalloc stuff [random repo doc link](https://github.com/rwaldron/runtime/blob/2396b5a0e1798875a1e37229809f086ca82fa64e/deps/dlmalloc/dlmalloc.h#L441). So there is no right place, it already exists in container/src/dlmalloc_2_8_6.c. Defining global defines is [a good question](https://www.boost.org/doc/libs/1_74_0/doc/html/boost_typeindex/config.html). I think I remember the docs being flimsy, but on that page you can find `define=` – sehe Dec 06 '20 at 14:07