shanshanpt / seastar_example

seastar example
8 stars 6 forks source link

build server error #3

Closed xiaqunfeng closed 5 years ago

xiaqunfeng commented 5 years ago

hello, I build seastar follow the doc https://github.com/scylladb/seastar/blob/master/doc/building-docker.md in your README.md

[root@37a6581048b1 seastar]# ./configure.py
...
-- Performing Test result
-- Performing Test result - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /seastar/build/sanitize

[root@37a6581048b1 seastar]# ninja -C build/release
ninja: Entering directory `build/release'
[76/217] Building CXX object tests/unit/CMakeFiles/test_unit_thread.dir/thread_test.cc.o
../../tests/unit/thread_test.cc: In lambda function:
../../tests/unit/thread_test.cc:115:44: warning: ‘thread_scheduling_group’ is deprecated: Use seastar::scheduling_group instead [-Wdeprecated-declarations]
         thread_scheduling_group sched_group(1ms, metered_ratio);
                                            ^
In file included from ../../tests/unit/thread_test.cc:23:
../../include/seastar/core/thread.hh:242:63: note: declared here
 class [[deprecated("Use seastar::scheduling_group instead")]] thread_scheduling_group {
                                                               ^~~~~~~~~~~~~~~~~~~~~~~
[217/217] Linking CXX executable apps/memcached/tests/app_memcached_test_ascii

but when I build server, error occurred!

[root@37a6581048b1 seastar]# g++ -std=c++11 `pkg-config --cflags --libs build/release/seastar.pc` -o server server.cc
server.cc:7:10: fatal error: core/app-template.hh: No such file or directory
 #include "core/app-template.hh"
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

So I checked the output of pkg-config, but can't find any problems.

[root@37a6581048b1 seastar]# pkg-config --cflags --libs build/release/seastar.pc
-I/seastar/include -I/seastar/build/release/gen/include -std=gnu++17 -U_FORTIFY_SOURCE -Wno-maybe-uninitialized -fconcepts -DSEASTAR_HAVE_GCC6_CONCEPTS -DFMT_SHARED -I/usr/include/p11-kit-1 /seastar/build/release/libseastar.a /usr/lib64/libboost_program_options.so /usr/lib64/libboost_system.so /usr/lib64/libboost_thread.so /usr/lib64/libcares.so /usr/lib64/libcryptopp.so /usr/lib64/libfmt.so.5.2.1 -llz4

If I add path of boost lib and seastar manually, still show error as follow:

[root@37a6581048b1 seastar]# g++ -std=c++11 -I /seastar/include/seastar/ -L /usr/include/boost/ `pkg-config --cflags --libs build/release/seastar.pc` -o server server.cc
server.cc: In lambda function:
server.cc:141:22: error: ‘cout’ is not a member of ‘std’
                 std::cout << "current " << stats._curr_connections << " total " << stats._total_connections << " qps " << stats._echo - _last << "\n";
                      ^~~~
server.cc:141:22: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
server.cc:21:1:
+#include <iostream>
 #include <unistd.h>
server.cc:141:22:
                 std::cout << "current " << stats._curr_connections << " total " << stats._total_connections << " qps " << stats._echo - _last << "\n";
                      ^~~~
server.cc: In lambda function:
server.cc:173:18: error: ‘cout’ is not a member of ‘std’
             std::cout << "TCP Echo-Server listen on: " << port << "\n";
                  ^~~~
server.cc:173:18: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
shanshanpt commented 5 years ago

Please check which seastar version you built. I guess that you built latest seastar with gnu++17, but in my example which is c++11.

xiaqunfeng commented 5 years ago

I used c++17 and c++14 to build, still showing the same error. And the same error when I build the getting-start.cc in https://github.com/scylladb/seastar/wiki/Seastar-Tutorial. I builded seastar in docker container by referring to the official documentation, so I think the env is the same, but I don't know why it keeps showing this error. @shanshanpt