jimporter / mettle

A C++20 unit test framework
https://jimporter.github.io/mettle
BSD 3-Clause "New" or "Revised" License
122 stars 12 forks source link

Build on OSX Broken? #4

Closed icosahedron closed 9 years ago

icosahedron commented 10 years ago

I cloned and am attempting to build mettle. Here are the results I get running make:

make
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
c++ -std=c++1y -Wall -Wextra -pedantic -Werror -Iinclude -c src/mettle.cpp -o src/mettle.o
In file included from src/mettle.cpp:7:
In file included from src/libmettle/cmd_line.hpp:16:
In file included from src/libmettle/filters.hpp:7:
In file included from include/mettle/filters_core.hpp:4:
include/mettle/log/../attributes.hpp:79:33: error: chosen constructor is explicit in copy-initialization
    return attr_instance{*this, {}};
                                ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/set:428:14: note: constructor
      declared here
    explicit set(const value_compare& __comp = value_compare())
             ^
1 error generated.
make: *** [src/mettle.o] Error 1

I have boost 1.56 in the include directory. Also, the command c++ --version returns:

Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

which is the clang installed with Xcode 6.0. I've also tried using --stdlib=libc++, but of course that doesn't have an effect since this is a compilation only command.

jimporter commented 10 years ago

Your standard library is missing LWG DR2193, which libc++ added in r202994 and fixed properly in r203443. I'm guessing Xcode 6.0 ships with a libc++ that's too old, which is a bit surprising given how new your clang is.

jimporter commented 10 years ago

The short version is that the default constructor for std::set is marked explicit in your version of the standard library, which is incorrect. You could probably fix this by changing the offending line of attributes.hpp to

return attr_instance{*this, attr_instance::value_type{}};

or upgrading to a newer libc++. The libc++ homepage has some instructions on how to use a newer libc++ on OSX.

I'd also be interested in seeing if Xcode 6.1 has a sufficiently-new libc++ that this issue is resolved. It looks like release 3.5.0 of libc++ has the necessary fixes in there, but not 3.4.2 (the previous release).

icosahedron commented 10 years ago

Great. Thanks for the quick feedback. I'll build a new version and put it in /opt/local or someplace like that.

jimporter commented 10 years ago

Cool, let me know if that works. If it does, I'll update the docs to mention this.

jimporter commented 10 years ago

I'd also be interested in seeing if Xcode 6.1 has a sufficiently-new libc++ that this issue is resolved.

I asked a friend to grab me Xcode 6.1's header, and it's not fixed there either. :(

jimporter commented 10 years ago

@icosahedron Did you ever manage to get this working? If you did, let me know so I can add this to the docs.

icosahedron commented 10 years ago

Unfortunately I haven't gotten back to this project.

jimporter commented 9 years ago

Closing this for now. New-ish versions of clang should probably be ok (and I'm migrating to a new build system for the other issues).

marszall87 commented 9 years ago

I'm getting this error when trying to build on OS X 10.10:

c++ -std=c++1y -pthread -I'/Users/mnykiel/tools/mettle/include' -I/usr/local/include -c '/Users/mnykiel/tools/mettle/src/posix/run_test_file.cpp' -MMD -MF 'src/posix/run_test_file.o'.d -o 'src/posix/run_test_file.o'
In file included from /Users/mnykiel/tools/mettle/src/posix/run_test_file.cpp:12:
/Users/mnykiel/tools/mettle/include/mettle/driver/posix/scoped_pipe.hpp:24:14: error: use of undeclared identifier 'pipe2'
      return pipe2(&read_fd, flags);
             ^
/Users/mnykiel/tools/mettle/src/posix/run_test_file.cpp:90:9: error: use of undeclared identifier 'kill'
        kill(pid, SIGKILL);
        ^
/Users/mnykiel/tools/mettle/src/posix/run_test_file.cpp:109:9: error: use of undeclared identifier 'kill'
        kill(pid, SIGKILL);
        ^
3 errors generated.
make: *** [src/posix/run_test_file.o] Error 1

Tried building with bfg9000 and with make. I have Xcode 6.4, clang reports Apple LLVM version 6.1.0 (clang-602.0.53). Any ideas?

jimporter commented 9 years ago

Hm, looks like pipe2 is Linux-specific so I'll have to fix that. For kill, I'm guessing I need to include signal.h.

jimporter commented 9 years ago

This should be fixed now, although I'm just guessing since I don't have an OS X system to test on. If anything else is broken, just comment here and I'll see what I can do. Thanks for the bug report (and for trying out mettle)!

marszall87 commented 9 years ago

It's working now, thanks!

jimporter commented 9 years ago

Excellent! Just file an issue if you see anything else that's not working right. Thanks again!