rbock / sqlpp11

A type safe SQL template library for C++
BSD 2-Clause "Simplified" License
2.47k stars 340 forks source link

Failed to compile in cygwin #165

Closed more10-sundsvall closed 5 years ago

more10-sundsvall commented 7 years ago

cmake is pretty new to me. I am not that familiar with gcc either :-)

In git bash:

$ cd /c/git/date/
$ git rev-parse master
245452f7c0f59a9b802f293d3d13a3583dd804a6
$ cd ../sqlpp11-connector-postgresql/
$ git rev-parse master
9aaabbfd5167f415029ea1f5ee4efa0f7124ee2e
$ cd ../sqlpp11
$ git rev-parse master
aad1272d3a3c6a303d4ffa3c9ad52d5e4cdeba95

In cygwin:

$ uname -a
CYGWIN_NT-6.3 SEST-L02329 2.8.0(0.309/5/3) 2017-04-01 20:47 x86_64 Cygwin

$ gcc --version
gcc (GCC) 5.4.0
$ cmake --version
cmake version 3.6.2
$ make --version
GNU Make 4.2.1
Built for x86_64-unknown-cygwin
$ pwd
/cygdrive/c/git/sqlpp11/build
$ ls ../..
date  sqlpp11  sqlpp11-connector-postgresql
$ cmake .. -DHinnantDate_ROOT_DIR=/cygdrive/c/git/sqlpp11/build/../../date
CMake Warning at test_scripts/CMakeLists.txt:36 (message):
  Pyparsing is not installed.  Disabling ddl2cpp tests

-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/git/sqlpp11/build

$ make
[  1%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/test_main.cpp.o
[  3%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/BooleanExpression.cpp.o
[  5%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/CustomQuery.cpp.o
[  7%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/DateTime.cpp.o
[  8%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/Interpret.cpp.o
[ 10%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/Insert.cpp.o
[ 12%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/Remove.cpp.o
[ 14%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/Update.cpp.o
[ 15%] Building CXX object tests/CMakeFiles/sqlpp11_tests.dir/Select.cpp.o
In file included from /cygdrive/c/git/sqlpp11/include/sqlpp11/select.h:43:0,
                 from /cygdrive/c/git/sqlpp11/tests/Select.cpp:34:
/cygdrive/c/git/sqlpp11/include/sqlpp11/for_update.h: In instantiation of ‘static Context& sqlpp::serializer_t<Context, sqlpp::for_update_data_t>::_(const T&, Context&) [with Context = MockDbT<false>::_serializer_context_t; sqlpp::serializer_t<Context, sqlpp::for_update_data_t>::T = sqlpp::for_update_data_t]’:
/cygdrive/c/git/sqlpp11/include/sqlpp11/serialize.h:38:39:   required from ‘decltype (sqlpp::serializer_t<Context, T>::_(t, context)) sqlpp::serialize(const T&, Context&) [with T = sqlpp::for_update_data_t; Context = MockDbT<false>::_serializer_context_t; decltype (sqlpp::serializer_t<Context, T>::_(t, context)) = MockDbT<false>::_serializer_context_t&]’
/cygdrive/c/git/sqlpp11/include/sqlpp11/statement.h:260:31:   required from ‘static Context& sqlpp::serializer_t<Context, sqlpp::statement_t<Database, Policies ...> >::_(const T&, Context&) [with Context = MockDbT<false>::_serializer_context_t; Database = void; Policies = {sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t}; sqlpp::serializer_t<Context, sqlpp::statement_t<Database, Policies ...> >::T = sqlpp::statement_t<void, sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t>]’
/cygdrive/c/git/sqlpp11/include/sqlpp11/serialize.h:38:39:   required from ‘decltype (sqlpp::serializer_t<Context, T>::_(t, context)) sqlpp::serialize(const T&, Context&) [with T = sqlpp::statement_t<void, sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t>; Context = MockDbT<false>::_serializer_context_t; decltype (sqlpp::serializer_t<Context, T>::_(t, context)) = MockDbT<false>::_serializer_context_t&]’
/cygdrive/c/git/sqlpp11/tests/MockDb.h:175:23:   required from ‘MockDbT<enforceNullResultTreatment>::result_t MockDbT<enforceNullResultTreatment>::select(const Select&) [with Select = sqlpp::statement_t<void, sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t>; bool enforceNullResultTreatment = false]’
/cygdrive/c/git/sqlpp11/include/sqlpp11/select_column_list.h:279:65:   required from ‘sqlpp::result_t<decltype (db.select(declval<Statement>())), typename std::conditional<typename std::conditional<std::is_same<Database, void>::value, std::integral_constant<bool, false>, std::integral_constant<bool, true> >::type:: value, sqlpp::dynamic_result_row_t<Db, sqlpp::select_column_list_t<Database, Columns>::_result_methods_t<Statement>::_field_t<Db, Columns>...>, sqlpp::result_row_t<Db, sqlpp::select_column_list_t<Database, Columns>::_result_methods_t<Statement>::_field_t<Db, Columns>...> >::type> sqlpp::select_column_list_t<Database, Columns>::_result_methods_t<Statement>::_run(Db&) const [with Db = MockDbT<false>; Statement = sqlpp::statement_t<void, sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t>; Database = void; Columns = {sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>}; typename std::conditional<typename std::conditional<std::is_same<Database, void>::value, std::integral_constant<bool, false>, std::integral_constant<bool, true> >::type:: value, sqlpp::dynamic_result_row_t<Db, sqlpp::select_column_list_t<Database, Columns>::_result_methods_t<Statement>::_field_t<Db, Columns>...>, sqlpp::result_row_t<Db, sqlpp::select_column_list_t<Database, Columns>::_result_methods_t<Statement>::_field_t<Db, Columns>...> >::type = sqlpp::result_row_t<MockDbT<false>, sqlpp::multi_field_spec_t<test::TabBar, std::tuple<sqlpp::field_spec_t<test::TabBar_::Alpha::_alias_t, sqlpp::integral, true, false>, sqlpp::field_spec_t<test::TabBar_::Beta::_alias_t, sqlpp::text, true, false>, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false>, sqlpp::field_spec_t<test::TabBar_::Delta::_alias_t, sqlpp::integral, true, false> > >, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false> >; decltype (db.select(declval<Statement>())) = MockDbT<false>::result_t]’
/cygdrive/c/git/sqlpp11/include/sqlpp11/statement.h:238:50:   required from ‘decltype (declval<sqlpp::statement_t<Db, Policies>::_result_methods_t<sqlpp::statement_t<Db, Policies> > >()._run(db)) sqlpp::statement_t<Db, Policies>::_run(Database&) const [with Database = MockDbT<false>; Db = void; Policies = {sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t}; decltype (declval<sqlpp::statement_t<Db, Policies>::_result_methods_t<sqlpp::statement_t<Db, Policies> > >()._run(db)) = sqlpp::result_t<MockDbT<false>::result_t, sqlpp::result_row_t<MockDbT<false>, sqlpp::multi_field_spec_t<test::TabBar, std::tuple<sqlpp::field_spec_t<test::TabBar_::Alpha::_alias_t, sqlpp::integral, true, false>, sqlpp::field_spec_t<test::TabBar_::Beta::_alias_t, sqlpp::text, true, false>, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false>, sqlpp::field_spec_t<test::TabBar_::Delta::_alias_t, sqlpp::integral, true, false> > >, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false> > >; sqlpp::statement_t<Db, Policies>::_result_methods_t<sqlpp::statement_t<Db, Policies> > = sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >::_result_methods_t<sqlpp::statement_t<void, sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t> >]’
/cygdrive/c/git/sqlpp11/tests/MockDb.h:116:24:   required from ‘decltype (t._run((*(MockDbT<enforceNullResultTreatment>*)this))) MockDbT<enforceNullResultTreatment>::_run(const T&, sqlpp::consistent_t) [with T = sqlpp::statement_t<void, sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t>; bool enforceNullResultTreatment = false; decltype (t._run((*(MockDbT<enforceNullResultTreatment>*)this))) = sqlpp::result_t<MockDbT<false>::result_t, sqlpp::result_row_t<MockDbT<false>, sqlpp::multi_field_spec_t<test::TabBar, std::tuple<sqlpp::field_spec_t<test::TabBar_::Alpha::_alias_t, sqlpp::integral, true, false>, sqlpp::field_spec_t<test::TabBar_::Beta::_alias_t, sqlpp::text, true, false>, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false>, sqlpp::field_spec_t<test::TabBar_::Delta::_alias_t, sqlpp::integral, true, false> > >, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false> > >]’
/cygdrive/c/git/sqlpp11/tests/MockDb.h:125:16:   required from ‘decltype (((MockDbT<enforceNullResultTreatment>*)this)->._run(t, sqlpp::run_check_t<MockDbT<enforceNullResultTreatment>::_serializer_context_t, T>{})) MockDbT<enforceNullResultTreatment>::operator()(const T&) [with T = sqlpp::statement_t<void, sqlpp::no_with_t, sqlpp::select_t, sqlpp::no_select_flag_list_t, sqlpp::select_column_list_t<void, sqlpp::multi_column_alias_t<test::TabBar, sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::column_t<test::TabBar, test::TabBar_::Beta>, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma>, sqlpp::column_t<test::TabBar, test::TabBar_::Delta> >, sqlpp::column_t<test::TabBar, test::TabBar_::Gamma> >, sqlpp::from_t<void, test::TabBar>, sqlpp::where_t<void, sqlpp::binary_expression_t<sqlpp::column_t<test::TabBar, test::TabBar_::Alpha>, sqlpp::op::greater, sqlpp::integral_operand> >, sqlpp::no_group_by_t, sqlpp::no_having_t, sqlpp::no_order_by_t, sqlpp::no_limit_t, sqlpp::no_offset_t, sqlpp::no_union_t, sqlpp::for_update_t>; bool enforceNullResultTreatment = false; decltype (((MockDbT<enforceNullResultTreatment>*)this)->._run(t, sqlpp::run_check_t<MockDbT<enforceNullResultTreatment>::_serializer_context_t, T>{})) = sqlpp::result_t<MockDbT<false>::result_t, sqlpp::result_row_t<MockDbT<false>, sqlpp::multi_field_spec_t<test::TabBar, std::tuple<sqlpp::field_spec_t<test::TabBar_::Alpha::_alias_t, sqlpp::integral, true, false>, sqlpp::field_spec_t<test::TabBar_::Beta::_alias_t, sqlpp::text, true, false>, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false>, sqlpp::field_spec_t<test::TabBar_::Delta::_alias_t, sqlpp::integral, true, false> > >, sqlpp::field_spec_t<test::TabBar_::Gamma::_alias_t, sqlpp::boolean, false, false> > >]’
/cygdrive/c/git/sqlpp11/tests/Select.cpp:110:101:   required from here
/cygdrive/c/git/sqlpp11/include/sqlpp11/for_update.h:165:32: warning: unused parameter ‘t’ [-Wunused-parameter]
     static Context& _(const T& t, Context& context)
                                ^
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/as: CMakeFiles/sqlpp11_tests.dir/Select.cpp.o: section .xdata$_ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceIN5sqlpp21named_interpretable_tI7MockDbTILb0EEE7_impl_tINS2_21without_table_check_tINS2_8column_tIN4test6TabFooENSA_7TabFoo_5OmegaEEEEEEESaISG_ELNS_12_Lock_policyE2EEED2Ev: string table overflow at offset 10000102
/tmp/ccJ92cSR.s: Assembler messages:
/tmp/ccJ92cSR.s: Fatal error: can't close CMakeFiles/sqlpp11_tests.dir/Select.cpp.o: File too big
make[2]: *** [tests/CMakeFiles/sqlpp11_tests.dir/build.make:255: tests/CMakeFiles/sqlpp11_tests.dir/Select.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: tests/CMakeFiles/sqlpp11_tests.dir/all] Error 2
make: *** [Makefile:139: all] Error 2
more10-sundsvall commented 7 years ago

Adding a few compiler options did the trick, adding -O2 was the key:

cmake .. -DHinnantDate_ROOT_DIR=/cygdrive/c/git/sqlpp11/build/../../date -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O2"

I found the flags in these links on google: http://stackoverflow.com/questions/14125007/gcc-string-table-overflow-error-during-compilation http://stackoverflow.com/questions/16596876/object-file-has-too-many-sections

rbock commented 7 years ago

Thanks for experimenting with that!

So if you omit the -O2, you get the compile error above? That's a surprise...

more10-sundsvall commented 7 years ago

Correct. There is a thorough analysis of the error in the first link. From the top of my head there is a limitation in the COFF format. Optimization using -O2 will conserve resources. An option is to split the Select.cpp file into smaller pieces.

rbock commented 5 years ago

Better tests are going onto the wish list I am currently compiling. I would assume they will become smaller and easier to digest for cygwin...

Closing this one.