LoopPerfect / buckaroo

The decentralized package manager for C++ and friends 🏝️
https://buckaroo.pm
MIT License
936 stars 33 forks source link

How to add extra flags to build using C++17 with Clang compiler family #114

Closed ogranada closed 7 years ago

ogranada commented 7 years ago

What is the correct way to add extra flags to build using C++17 with Clang compiler family.

Description

I'm trying to build served package, however this package have dependencies that use C++11 features.

Expected Behavior

The next code in the main.cpp file should be well compiled:

#include <iostream>
// The important line...
#include <served/served.hpp>

int main() {
  std::cout << "Hello, world. " << std::endl;
  return 0;
}

Actual Behavior

Fails with next log:

In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
In file included from buckaroo/official/datasift/served/src/served/net/server.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/net/connection_manager.hpp:29:
In file included from buckaroo/official/datasift/served/src/served/net/connection.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/multiplexer.hpp:30:
buckaroo/official/datasift/served/src/served/methods.hpp:50:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::GET:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:52:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::POST:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:54:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::HEAD:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:56:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::PUT:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:58:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::DELETE:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:60:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::OPTIONS:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:62:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::TRACE:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:64:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::CONNECT:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:66:8: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                case method::BREW:
                     ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:83:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::GET;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:86:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::POST;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:89:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::HEAD;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:92:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::PUT;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:95:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::DELETE;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:98:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::OPTIONS;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:101:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::TRACE;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:104:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::CONNECT;
                       ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods.hpp:107:10: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                return method::BREW;
                       ^
In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
In file included from buckaroo/official/datasift/served/src/served/net/server.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/net/connection_manager.hpp:29:
In file included from buckaroo/official/datasift/served/src/served/net/connection.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/multiplexer.hpp:31:
In file included from buckaroo/official/datasift/served/src/served/methods_handler.hpp:31:
buckaroo/official/datasift/served/src/served/response.hpp:47:15: error: no type named 'tuple' in namespace 'std'
        typedef std::tuple<std::string, std::string> header_pair;
                ~~~~~^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/response.hpp:47:20: error: expected member name or ';' after declaration specifiers
        typedef std::tuple<std::string, std::string> header_pair;
        ~~~~~~~~~~~~~~~~~~^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/response.hpp:48:32: error: use of undeclared identifier 'header_pair'
        typedef std::map<std::string, header_pair>   header_list;
                                      ^
In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
In file included from buckaroo/official/datasift/served/src/served/net/server.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/net/connection_manager.hpp:29:
In file included from buckaroo/official/datasift/served/src/served/net/connection.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/multiplexer.hpp:31:
buckaroo/official/datasift/served/src/served/methods_handler.hpp:36:14: error: no type named 'tuple' in namespace 'std'
typedef std::tuple<std::string, std::vector<std::string>> served_method_list;
        ~~~~~^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods_handler.hpp:36:19: error: expected unqualified-id
typedef std::tuple<std::string, std::vector<std::string>> served_method_list;
                  ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/methods_handler.hpp:37:31: error: use of undeclared identifier 'served_method_list'
typedef std::map<std::string, served_method_list>         served_endpoint_list;
                              ^
In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
In file included from buckaroo/official/datasift/served/src/served/net/server.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/net/connection_manager.hpp:29:
In file included from buckaroo/official/datasift/served/src/served/net/connection.hpp:28:
buckaroo/official/datasift/served/src/served/multiplexer.hpp:59:15: error: no type named 'tuple' in namespace 'std'
        typedef std::tuple<path_compiled_segments, served::methods_handler, std::string> path_handler_candidate;
                ~~~~~^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/multiplexer.hpp:59:20: error: expected member name or ';' after declaration specifiers
        typedef std::tuple<path_compiled_segments, served::methods_handler, std::string> path_handler_candidate;
        ~~~~~~~~~~~~~~~~~~^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/multiplexer.hpp:60:22: error: use of undeclared identifier 'path_handler_candidate'
        typedef std::vector<path_handler_candidate>                                      path_handler_candidates;
                            ^
In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
In file included from buckaroo/official/datasift/served/src/served/net/server.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/net/connection_manager.hpp:29:
In file included from buckaroo/official/datasift/served/src/served/net/connection.hpp:31:
buckaroo/official/datasift/served/src/served/request_parser_impl.hpp:95:35: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                const char *value, size_t vlen) override;
                                                ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:101:18: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                size_t length) override;
                               ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:107:18: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                size_t length) override;
                               ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:113:18: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                size_t length) override;
                               ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:119:18: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                size_t length) override;
                               ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:125:18: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                size_t length) override;
                               ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:131:18: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                size_t length) override;
                               ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:139:18: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                size_t length) override;
                               ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/request_parser_impl.hpp:73:13: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
                , _status(status_type::READ_HEADER)
                          ^
In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
In file included from buckaroo/official/datasift/served/src/served/net/server.hpp:28:
In file included from buckaroo/official/datasift/served/src/served/net/connection_manager.hpp:29:
buckaroo/official/datasift/served/src/served/net/connection.hpp:70:45: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        connection& operator=(const connection&) = delete;
                                                   ^
In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
In file included from buckaroo/official/datasift/served/src/served/net/server.hpp:28:
buckaroo/official/datasift/served/src/served/net/connection_manager.hpp:45:50: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        connection_manager(const connection_manager&) = delete;
                                                        ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/net/connection_manager.hpp:47:61: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        connection_manager& operator=(const connection_manager&) = delete;
                                                                   ^
In file included from bkr2/apps/main.cpp:2:
In file included from buckaroo/official/datasift/served/src/served/served.hpp:26:
buckaroo/official/datasift/served/src/served/net/server.hpp:54:26: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        server(const server&) = delete;
                                ^
buckaroo/official/datasift/served/buck-out/gen/served#header-mode-symlink-tree-with-header-map,headers/served/net/server.hpp:56:37: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        server& operator=(const server&) = delete;
                                           ^
32 warnings and 9 errors generated.
BUILD FAILED: //:main#compile-main.cpp.o194b5b9e,default failed with exit code 1:
c++ preprocess_and_compile
[-] PROCESSING BUCK FILES...FINISHED 20.1s [100%] 🏖  Watchman reported no changes
[-] DOWNLOADING... (0.00 B/S AVG, TOTAL: 0.00 B, 0 Artifacts)
[-] BUILDING...FINISHED 4.4s [100%] (30/31 JOBS, 1 UPDATED, 1 [3.2%] CACHE MISS)

Possible Fix

Add flag -std=c++1z to compilation.

Steps to Reproduce

  1. create a project folder
  2. run buckaroo quickstart
  3. run buckaroo install datasift/served
  4. modify the file apps.cpp and add the code:
    
    #include <iostream>
    #include <served/served.hpp>

int main() { std::cout << "Hello, world. " << std::endl; return 0; }


5. Run `buck run :main`

## Context
Packages that use C++11 or greater can't be compiled.

## Your Environment

* Version used: Buckaroo 1.2.1
* Operating System and Architecture: Mac OS X Sierra
nikhedonia commented 7 years ago

you can pass compiler flags for the whole project scope via .buckconfig: https://buckbuild.com/concept/buckconfig.html#cxx.cxxflags

[cxx]
  cxxflags = -Wall -std=c++1z