Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference if TESTING_ENABLE=ON #1890

Closed
nautaa opened this issue May 26, 2022 · 5 comments · Fixed by #1916
Closed

undefined reference if TESTING_ENABLE=ON #1890

nautaa opened this issue May 26, 2022 · 5 comments · Fixed by #1916
Assignees
Labels
bug Something isn't working build openmldb compiling and installing
Milestone

Comments

@nautaa
Copy link
Collaborator

nautaa commented May 26, 2022

Bug Description

make build CMAKE_BUILD_TYPE=Debug TESTING_ENABLE=ON

build log

libbase_test.a(sql_sdk_base_test.cc.o): In function `openmldb::sdk::SQLSDKTest::CreateTables(hybridse::sqlcase::SqlCase&, std::shared_ptr<openmldb::sdk::SQLRouter>, int)':
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:65: undefined reference to `hybridse::sqlcase::SqlCase::BuildCreateSqlFromInput(int, std::string*, int) const'
libbase_test.a(sql_sdk_base_test.cc.o): In function `openmldb::sdk::SQLSDKTest::CreateProcedure(hybridse::sqlcase::SqlCase&, std::shared_ptr<openmldb::sdk::SQLRouter>, bool)':
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:121: undefined reference to `hybridse::sqlcase::SqlCase::ExtractTableDef(std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&, hybridse::type::TableDef&)'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:123: undefined reference to `hybridse::sqlcase::SqlCase::BuildCreateSpSqlFromSchema(hybridse::type::TableDef const&, std::string const&, std::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long> > const&, std::string*)'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:127: undefined reference to `hybridse::sqlcase::SqlCase::BuildCreateSpSqlFromInput(int, std::string const&, std::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long> > const&, std::string*)'
libbase_test.a(sql_sdk_base_test.cc.o): In function `openmldb::sdk::SQLSDKTest::InsertTables(hybridse::sqlcase::SqlCase&, std::shared_ptr<openmldb::sdk::SQLRouter>, openmldb::sdk::InsertRule)':
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:206: undefined reference to `hybridse::sqlcase::SqlCase::BuildInsertSqlListFromInput(int, std::vector<std::string, std::allocator<std::string> >*) const'
libbase_test.a(sql_sdk_base_test.cc.o): In function `openmldb::sdk::SQLSDKTest::BatchExecuteSQL(hybridse::sqlcase::SqlCase&, std::shared_ptr<openmldb::sdk::SQLRouter>, std::vector<std::string, std::allocator<std::string> > const&)':
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:305: undefined reference to `hybridse::sqlcase::SqlCase::ExtractParameterTypes() const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:311: undefined reference to `hybridse::sqlcase::SqlCase::ExtractRows(google::protobuf::RepeatedPtrField<hybridse::type::ColumnDef> const&, std::vector<std::vector<std::string, std::allocator<std::string> >, std::allocator<std::vector<std::string, std::allocator<std::string> > > > const&, std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&)'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:334: undefined reference to `hybridse::sqlcase::SqlCase::ExtractOutputSchema(hybridse::type::TableDef&) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:339: undefined reference to `hybridse::sqlcase::SqlCase::ExtractOutputData(std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&) const'
libbase_test.a(sql_sdk_base_test.cc.o): In function `openmldb::sdk::SQLSDKQueryTest::RequestExecuteSQL(hybridse::sqlcase::SqlCase&, std::shared_ptr<openmldb::sdk::SQLRouter>, bool, bool, bool)':
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:407: undefined reference to `hybridse::sqlcase::SqlCase::ExtractInputTableDef(hybridse::type::TableDef&, int) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:408: undefined reference to `hybridse::sqlcase::SqlCase::ExtractInputData(std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&, int) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:409: undefined reference to `hybridse::sqlcase::SqlCase::BuildInsertSqlListFromInput(int, std::vector<std::string, std::allocator<std::string> >*) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:411: undefined reference to `hybridse::sqlcase::SqlCase::ExtractInputTableDef(hybridse::sqlcase::SqlCase::TableInfo const&, hybridse::type::TableDef&) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:412: undefined reference to `hybridse::sqlcase::SqlCase::ExtractInputData(hybridse::sqlcase::SqlCase::TableInfo const&, std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:451: undefined reference to `hybridse::sqlcase::SqlCase::ExtractOutputSchema(hybridse::type::TableDef&) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:456: undefined reference to `hybridse::sqlcase::SqlCase::ExtractOutputData(std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&) const'
libbase_test.a(sql_sdk_base_test.cc.o): In function `openmldb::sdk::SQLSDKQueryTest::BatchRequestExecuteSQLWithCommonColumnIndices(hybridse::sqlcase::SqlCase&, std::shared_ptr<openmldb::sdk::SQLRouter>, std::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long> > const&, bool, bool)':
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:559: undefined reference to `hybridse::sqlcase::SqlCase::ExtractTableDef(std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&, hybridse::type::TableDef&)'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:560: undefined reference to `hybridse::sqlcase::SqlCase::ExtractRows(google::protobuf::RepeatedPtrField<hybridse::type::ColumnDef> const&, std::vector<std::vector<std::string, std::allocator<std::string> >, std::allocator<std::vector<std::string, std::allocator<std::string> > > > const&, std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&)'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:563: undefined reference to `hybridse::sqlcase::SqlCase::ExtractInputTableDef(hybridse::sqlcase::SqlCase::TableInfo const&, hybridse::type::TableDef&) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:565: undefined reference to `hybridse::sqlcase::SqlCase::ExtractInputData(hybridse::sqlcase::SqlCase::TableInfo const&, std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:611: undefined reference to `hybridse::sqlcase::SqlCase::ExtractOutputSchema(hybridse::type::TableDef&) const'
/root/OpenMLDB/src/sdk/sql_sdk_base_test.cc:615: undefined reference to `hybridse::sqlcase::SqlCase::ExtractOutputData(std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> >&) const'
libbase_test.a(base_test.cc.o): In function `openmldb::test::SQLCaseTest::InitCases(std::string const&)':
/root/OpenMLDB/src/test/base_test.cc:54: undefined reference to `hybridse::sqlcase::SqlCase::HYBRIDSE_LEVEL()'
libbase_test.a(base_test.cc.o): In function `openmldb::test::SQLCaseTest::InitCases(std::string const&, std::string const&, std::vector<hybridse::sqlcase::SqlCase, std::allocator<hybridse::sqlcase::SqlCase> >&)':
/root/OpenMLDB/src/test/base_test.cc:70: undefined reference to `hybridse::sqlcase::SqlCase::CreateSqlCasesFromYaml(std::string const&, std::string const&, std::vector<hybridse::sqlcase::SqlCase, std::allocator<hybridse::sqlcase::SqlCase> >&, std::vector<std::string, std::allocator<std::string> > const&)'
libbase_test.a(base_test.cc.o): In function `openmldb::test::SQLCaseTest::PrintSchema(google::protobuf::RepeatedPtrField<hybridse::type::ColumnDef> const&)':
/root/OpenMLDB/src/test/base_test.cc:90: undefined reference to `hybridse::sqlcase::SqlCase::TypeString(hybridse::type::Type)'
/root/OpenMLDB/src/test/base_test.cc:97: undefined reference to `hybridse::base::operator<<(std::ostream&, hybridse::base::TextTable const&)'
libbase_test.a(base_test.cc.o): In function `openmldb::test::SQLCaseTest::PrintRows(google::protobuf::RepeatedPtrField<hybridse::type::ColumnDef> const&, std::vector<hybridse::codec::Row, std::allocator<hybridse::codec::Row> > const&)':
/root/OpenMLDB/src/test/base_test.cc:214: undefined reference to `hybridse::base::operator<<(std::ostream&, hybridse::base::TextTable const&)'
libbase_test.a(base_test.cc.o): In function `openmldb::test::SQLCaseTest::PrintResultSet(std::shared_ptr<hybridse::sdk::ResultSet>)':
/root/OpenMLDB/src/test/base_test.cc:351: undefined reference to `hybridse::base::operator<<(std::ostream&, hybridse::base::TextTable const&)'
libbase_test.a(base_test.cc.o): In function `openmldb::test::SQLCaseTest::PrintResultSet(std::vector<std::shared_ptr<hybridse::sdk::ResultSet>, std::allocator<std::shared_ptr<hybridse::sdk::ResultSet> > >)':
/root/OpenMLDB/src/test/base_test.cc:394: undefined reference to `hybridse::base::operator<<(std::ostream&, hybridse::base::TextTable const&)'
collect2: error: ld returned 1 exit status
gmake[3]: *** [bin/sql_request_row_test] Error 1
gmake[3]: Leaving directory `/root/OpenMLDB/build'
gmake[2]: *** [src/sdk/CMakeFiles/sql_request_row_test.dir/all] Error 2
gmake[2]: Leaving directory `/root/OpenMLDB/build'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/root/OpenMLDB/build'
make: *** [build] Error 2

Expected Behavior

Steps to Reproduce

@nautaa nautaa added bug Something isn't working build openmldb compiling and installing labels May 26, 2022
@nautaa
Copy link
Collaborator Author

nautaa commented May 26, 2022

It seems to be wrong link order? only occur in Debug mode.
https://github.com/4paradigm/OpenMLDB/runs/6607218757?check_suite_focus=true

@aceforeverd aceforeverd self-assigned this May 26, 2022
@aceforeverd
Copy link
Collaborator

@nautaa proto generated files are moved to build directory #1885
try git clean -dfx src and try again ?

@nautaa
Copy link
Collaborator Author

nautaa commented May 31, 2022

@nautaa proto generated files are moved to build directory #1885 try git clean -dfx src and try again ?

still unresolved.
HYBRIDSE_CASE_LIBS is not necessary for sql_request_row_test. after removing HYBRIDSE_CASE_LIBS or adjust the order of dependencies. it can build normally. @aceforeverd

target_link_libraries(sql_request_row_test ${BIN_LIBS} ${HYBRIDSE_CASE_LIBS} ${ZETASQL_LIBS} benchmark_main benchmark ${GTEST_LIBRARIES})

@aceforeverd
Copy link
Collaborator

@nautaa proto generated files are moved to build directory #1885 try git clean -dfx src and try again ?

still unresolved. HYBRIDSE_CASE_LIBS is not necessary for sql_request_row_test. after removing HYBRIDSE_CASE_LIBS or adjust the order of dependencies. it can build normally. @aceforeverd

target_link_libraries(sql_request_row_test ${BIN_LIBS} ${HYBRIDSE_CASE_LIBS} ${ZETASQL_LIBS} benchmark_main benchmark ${GTEST_LIBRARIES})

I do not reproduce it but I think this might possible.
https://github.com/4paradigm/OpenMLDB/runs/6607218757?check_suite_focus=true#step:7:948 says hybridse::sqlcase::SqlCase::BuildCreateSqlFromInput not found, the function is built in hybridse_core lib, and hybridse_core is included in $BIN_LIBS, which is the previous library of $HYBRIDSE_CASE_LIBS

@aceforeverd aceforeverd added this to the v0.6 milestone Jun 2, 2022
aceforeverd added a commit to aceforeverd/fedb that referenced this issue Jun 2, 2022
@aceforeverd
Copy link
Collaborator

@nautaa try #1916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build openmldb compiling and installing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants