Menu

Error when compiling against Boost 1.42

Marco Jez
2010-02-22
2013-04-25
  • Marco Jez

    Marco Jez - 2010-02-22

    I get an error when compiling against Boost 1.42, because the interface of boost::iostreams::file_descriptor has slightly changed. The fix is easy though, just change line 159 in boostfd_file.cpp from:

    file_des.open(filename, boostfd_mode, boostfd_mode);
    

    to:

    file_des.open(filename, boostfd_mode);
    

    (based from today's SVN checkout).

    Cheers,
    Marco

     
  • Nobody/Anonymous

    Thanks for the PR and the fix.

    However, it looks to me that this is not (semantically) backwards-compatible, because the second boostfd_mode argument (basemode) will be (in|out) by default, and the first one will be or-ed by basemode.  Thus, all files will be opened for reading _and_ writing.  Is there a better way to avoid this except a version switch using the preprocessor?

    Sadly, I was not able to find proper documentation for the open method.  Could you give me a pointer, please?

    Johannes

     
  • Marco Jez

    Marco Jez - 2010-02-23

    Hi Johannes,

    Yep the documentation is lacking, but it seems that in Boost 1.42 the semantics has changed as well, so the above fix actually preserves the original semantics when compiled against Boost 1.42. Thus, a version-based preprocessor switch should suffice.

    In latest Iostreams, all open() signatures that take two "mode" parameters have been removed from the public interface. Only one such signature is present but is now private, and it is semantically equivalent to calling open(path, mode|base). Since in the original STXXL code both "mode" and "base" are set to the same value (boostfd_mode), the fixed call is equivalent to calling the old Iostreams' open(path, mode, base) function with mode = base = boostfd_mode.

    Marco

     
  • Nobody/Anonymous

    Committed with version switch.
    Please test.

    Johannes

     
  • Marco Jez

    Marco Jez - 2010-02-23

    SVN head compiles and links correctly. All tests run succesfully except for containers/btree/test_corr_insert_erase, which raises an unhandled exception after producing this log:

    S:\Librerie\stxxl-trunk>containers\btree\test_corr_insert_erase.exe 100
    [STXXL-MSG] STXXL v1.3.0 + Boost 104200
    [STXXL-MSG] 1 disks are allocated, total space: 4096 MiB
    [STXXL-MSG] Generating 0 random values
    [STXXL-MSG] Sorting the random values
    [STXXL-MSG] Deleting unique values
    [STXXL-MSG] Randomly permute input values
    

    I'll be able to test more deeply in debug mode later today.
    Some details about this build:
    Toolchain: MSVC 9, Boost 1.42
    OS: Windows XP SP3
    Configuration: 32-bit, release mode

    Marco

     
  • Johannes Singler

    You should try a smaller parameter value, e. g. 14.  The input size grows exponentially with it.  Still, we cannot handle 2^100 elements ;-)
    Also, the btree generates a lot of random accesses, which is quite I/O-inefficient anyways.

    Johannes

     
  • Marco Jez

    Marco Jez - 2010-02-23

    Uh ok, my fault. :-)
    It works fine with 14.

     

Log in to post a comment.