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

Some compilers will fail to build with "undeclared identifier 'digit_to_number'" error #518

Closed
tt4g opened this issue Jan 14, 2022 · 3 comments · Fixed by #519
Closed

Some compilers will fail to build with "undeclared identifier 'digit_to_number'" error #518

tt4g opened this issue Jan 14, 2022 · 3 comments · Fixed by #519

Comments

@tt4g
Copy link
Contributor

tt4g commented Jan 14, 2022

There are some compilers that fail to compile when building version 7.7.0.

This problem was encountered in a CI build failure of the package manager conan (conan-io/conan-center-index#8761 (comment)).

The following is the error log when building with Clang.

CI Failure log
[...]
[ 14%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/connection.cxx.o
[ 18%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/cursor.cxx.o
[ 22%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/encodings.cxx.o
[ 25%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/errorhandler.cxx.o
[ 29%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/except.cxx.o
[ 33%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/field.cxx.o
[ 37%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/largeobject.cxx.o
[ 40%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/notification.cxx.o
[ 44%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/params.cxx.o
[ 48%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/pipeline.cxx.o
[ 51%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/result.cxx.o
[ 55%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/robusttransaction.cxx.o
[ 59%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/row.cxx.o
[ 62%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/sql_cursor.cxx.o
[ 66%] Building CXX object source_subfolder/src/CMakeFiles/pqxx.dir/strconv.cxx.o
source_subfolder/src/CMakeFiles/pqxx.dir/build.make:302: recipe for target 'source_subfolder/src/CMakeFiles/pqxx.dir/strconv.cxx.o' failed
CMakeFiles/Makefile2:151: recipe for target 'source_subfolder/src/CMakeFiles/pqxx.dir/all' failed
Makefile:170: recipe for target 'all' failed
libpqxx/7.7.0: 
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY


/home/conan/w/BuildSingleReference/.conan/data/libpqxx/7.7.0/_/_/build/e52f527ce44f8ad45ccc34f94acd11eaa754d477/source_subfolder/src/strconv.cxx:441:46: error: use of undeclared identifier 'digit_to_number'; did you mean 'pqxx::internal::digit_to_number'?
      result = absorb_digit_positive(result, digit_to_number(data[i]));
                                             ^~~~~~~~~~~~~~~
                                             pqxx::internal::digit_to_number
/home/conan/w/BuildSingleReference/.conan/data/libpqxx/7.7.0/_/_/build/e52f527ce44f8ad45ccc34f94acd11eaa754d477/source_subfolder/include/pqxx/internal/conversions.hxx:34:15: note: 'pqxx::internal::digit_to_number' declared here
constexpr int digit_to_number(char c) noexcept
              ^
/home/conan/w/BuildSingleReference/.conan/data/libpqxx/7.7.0/_/_/build/e52f527ce44f8ad45ccc34f94acd11eaa754d477/source_subfolder/src/strconv.cxx:455:46: error: use of undeclared identifier 'digit_to_number'; did you mean 'pqxx::internal::digit_to_number'?
      result = absorb_digit_negative(result, digit_to_number(data[i]));
                                             ^~~~~~~~~~~~~~~
                                             pqxx::internal::digit_to_number
/home/conan/w/BuildSingleReference/.conan/data/libpqxx/7.7.0/_/_/build/e52f527ce44f8ad45ccc34f94acd11eaa754d477/source_subfolder/include/pqxx/internal/conversions.hxx:34:15: note: 'pqxx::internal::digit_to_number' declared here
constexpr int digit_to_number(char c) noexcept
              ^
2 errors generated.
make[2]: *** [source_subfolder/src/CMakeFiles/pqxx.dir/strconv.cxx.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [source_subfolder/src/CMakeFiles/pqxx.dir/all] Error 2
make: *** [all] Error 2
libpqxx/7.7.0: WARN: Build folder is dirty, removing it: /home/conan/w/BuildSingleReference/.conan/data/libpqxx/7.7.0/_/_/build/e52f527ce44f8ad45ccc34f94acd11eaa754d477
libpqxx/7.7.0: ERROR: Package 'e52f527ce44f8ad45ccc34f94acd11eaa754d477' build failed
libpqxx/7.7.0: WARN: Build folder /home/conan/w/BuildSingleReference/.conan/data/libpqxx/7.7.0/_/_/build/e52f527ce44f8ad45ccc34f94acd11eaa754d477
ERROR: libpqxx/7.7.0: Error in build() method, line 101
	cmake.build()
	ConanException: Error 2 while ex
@tt4g
Copy link
Contributor Author

tt4g commented Jan 14, 2022

It seems that it is after 6dec39a that the compiler can no longer find digit_to_number.

Before this commit, digit_to_number was defined in anonymous namespace.
After this commit, digit_to_number is defined in the pqxx::internal namespace, so the compiler cannot find digit_to_number.

@tt4g
Copy link
Contributor Author

tt4g commented Jan 14, 2022

I used a few Docker clang 11 images to fix this problem.
Oddly enough, I noticed that the problem was not reproduced in some clang images.

The difference may be due to different patch versions of clang, but we could not track down the cause of the failure to reproduce the problem.

@jtv jtv closed this as completed in #519 Jan 14, 2022
@jtv
Copy link
Owner

jtv commented Jan 14, 2022

Weird that my clang versions don't complain about this. Oh well, fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants