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

bug: compile Error, ‘STONEDB_TAG_NAME’ was not declared in this scope, #1328

Open
2 of 3 tasks
davidshiz opened this issue Feb 23, 2023 · 15 comments
Open
2 of 3 tasks
Assignees
Labels
A-bug Something isn't working good first issue Good for newcomers

Comments

@davidshiz
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

When fock a branch in your own code repo, you cannot compile successfully. because your own code repo have no tag.
It is recommended to decouple from tags when compiling code.

/stonedb/libbinlogevents/include/rows_event.h: In constructor ‘binary_log::Table_map_event::Table_map_event(const Table_id&, long unsigned int, const char*, size_t, const char*, size_t)’:
/stonedb/libbinlogevents/include/rows_event.h:428:20: warning: implicitly-declared ‘constexpr Table_id::Table_id(const Table_id&)’ is deprecated [-Wdeprecated-copy]
  428 |       m_null_bits(0)
      |                    ^
In file included from /riyao/stonedb/sql/table.h:37,
                 from /riyao/stonedb/sql/field.h:37,
                 from /riyao/stonedb/sql/protocol_classic.h:27,
                 from /riyao/stonedb/sql/sql_class.h:40,
                 from /riyao/stonedb/sql/sql_parse.h:29,
                 from /riyao/stonedb/sql/mysqld.cc:57:
/stonedb/libbinlogevents/include/table_id.h:53:8: note: because ‘Table_id’ has user-provided ‘void Table_id::operator=(const Table_id&)’
   53 |   void operator=(const Table_id &tid) { m_id = tid.m_id; }
      |        ^~~~~~~~
/stonedb/sql/mysqld.cc: In function ‘void set_server_version()’:
/stonedb/sql/mysqld.cc:8134:31: error: ‘STONEDB_TAG_NAME’ was not declared in this scope; did you mean ‘STONEDB_BRANCH_NAME’?
 8134 |       static_cast<int>(sizeof(STONEDB_TAG_NAME)))
      |                               ^~~~~~~~~~~~~~~~
      |                               STONEDB_BRANCH_NAME
make[2]: *** [sql/CMakeFiles/sql.dir/build.make:5247: sql/CMakeFiles/sql.dir/mysqld.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:8269: sql/CMakeFiles/sql.dir/all] Error 2
make: *** [Makefile:161: all] Error 2

Expected behavior

No response

How To Reproduce

No response

Environment

root@ub01:~# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB-v1.0.2 for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 0f4250589
        Last commit time: Date:   Tue Feb 21 06:09:37 2023 +0000
        Build time: Date: Wed Feb 22 17:50:51 CST 2023

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@davidshiz davidshiz added the A-bug Something isn't working label Feb 23, 2023
@davidshiz davidshiz added this to the stonedb_5.7_v1.0.4 milestone Feb 23, 2023
@RingsC
Copy link
Contributor

RingsC commented Feb 24, 2023

Can you acess github? this var comes from git at compiling stage. pls check your dev env. Thanks. @davidshiz

@davidshiz
Copy link
Collaborator Author

Can you acess github? this var comes from git at compiling stage. pls check your dev env. Thanks. @davidshiz
I can access github,the reason for this error is personal repo in github have no tag.

@RingsC
Copy link
Contributor

RingsC commented Feb 24, 2023

Not a bug, Close it now.

@RingsC
Copy link
Contributor

RingsC commented Mar 5, 2023

in CMakeLists.txt

838  EXECUTE_PROCESS(COMMAND bash "-c" "git describe --tags `git rev-list --tags --max-count=1` |head -n 1 |awk -F'-' '{print $2}'"
839                   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
840                   OUTPUT_VARIABLE ER_TAG_NAME)
841  string(STRIP "${ER_TAG_NAME}" ER_TAG_NAME)
842 
843  SET(STONEDB_REPO_ADDR "${ER_REPO_NAME}:${ER_BRANCH_NAME}")
844  SET(STONEDB_BRANCH_NAME "${ER_BRANCH_NAME}")
845  SET(STONEDB_COMMIT_ID "${ER_COMMIT_ID}")
846  SET(STONEDB_COMMIT_TIME "${ER_COMMIT_TIME}")
847  SET(STONEDB_BUILD_TIME "Date: ${ER_BUILD_TIME}")
848  SET(STONEDB_TAG_NAME "${ER_TAG_NAME}")

when you can not get TAG_NAME, we define a TAG_NAME variable with empty value to make sure that cmake will generate this variable properly.

@laofan13
Copy link

laofan13 commented Apr 1, 2023

Hello, how to solve this error, we have encountered it now

@hustjieke hustjieke moved this from Done to In Progress in StoneDB for MySQL 5.7 Apr 2, 2023
@hustjieke
Copy link
Collaborator

@lifengfan13 You can have a try in this way. Just add an empty tag by git command git tag -a ....

@laofan13
Copy link

laofan13 commented Apr 2, 2023

@lifengfan13 You can have a try in this way. Just add an empty tag by git command git tag -a ....

Thanks, I'll try it

@laofan13
Copy link

laofan13 commented Apr 2, 2023

hello, I still have a bug.

/stonedb/sql/mysqld.cc: In function ‘void print_build_info()’:
/stonedb/sql/mysqld.cc:7049:33: error: ‘STONEDB_BRANCH_NAME’ was not declared in this scope
 7049 |   printf("\tBranch name: %s\n", STONEDB_BRANCH_NAME);
      |                                 ^~~~~~~~~~~~~~~~~~~
/stonedb/sql/mysqld.cc:7050:36: error: ‘STONEDB_COMMIT_ID’ was not declared in this scope
 7050 |   printf("\tLast commit ID: %s\n", STONEDB_COMMIT_ID);
      |                                    ^~~~~~~~~~~~~~~~~
/stonedb/sql/mysqld.cc:7051:38: error: ‘STONEDB_COMMIT_TIME’ was not declared in this scope; did you mean ‘STONEDB_BUILD_TIME’?
 7051 |   printf("\tLast commit time: %s\n", STONEDB_COMMIT_TIME);
      |                                      ^~~~~~~~~~~~~~~~~~~
      |                                      STONEDB_BUILD_TIME
/stonedb/sql/mysqld.cc: In function ‘void set_server_version()’:
/stonedb/sql/mysqld.cc:8134:31: error: ‘STONEDB_TAG_NAME’ was not declared in this scope
 8134 |       static_cast<int>(sizeof(STONEDB_TAG_NAME)))

@hustjieke
Copy link
Collaborator

STONEDB_BRANCH_NAME

Is your env. clean? First time to make build?
I'll try to reproduce in my machine.

@laofan13
Copy link

laofan13 commented Apr 3, 2023

STONEDB_BRANCH_NAME

Is your env. clean? First time to make build? I'll try to reproduce in my machine.

I compiled it for the first time, according to the official website dockers tutorial.
The system environment is Ubuntu 2022 x86_64 x86_64 x86_64 GNU/Linux.

@davidshiz
Copy link
Collaborator Author

davidshiz commented Apr 3, 2023

@lifengfan13 You can change the stonedb/CMakeLists.txt file, line 848
SET(STONEDB_TAG_NAME "${ER_TAG_NAME}") to SET(STONEDB_TAG_NAME "V103"), can temporarily solve this problem

@laofan13
Copy link

laofan13 commented Apr 3, 2023

Thanks,I'll try .

@laofan13
Copy link

laofan13 commented Apr 3, 2023

I am git clone repo on the host, and then mount it in docker, so these variables cannot be obtained. must be run command git config --global --add safe.directory /stonedb .

@RingsC
Copy link
Contributor

RingsC commented Apr 3, 2023

I am git clone repo on the host, and then mount it in docker, so these variables cannot be obtained. must be run command git config --global --add safe.directory /stonedb .

what result does the following command get on your instance ?

git describe --tags `git rev-list --tags --max-count=1` |head -n 1 |awk -F'-' '{print $2}'

@laofan13
Copy link

laofan13 commented Apr 3, 2023

I am git clone repo on the host, and then mount it in docker, so these variables cannot be obtained. must be run command git config --global --add safe.directory /stonedb .

what result does the following command get on your instance ?

git describe --tags `git rev-list --tags --max-count=1` |head -n 1 |awk -F'-' '{print $2}'

It has been compiled successfully! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working good first issue Good for newcomers
Projects
Status: In Progress
Development

No branches or pull requests

7 participants