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

Error occurred when building #2872

Closed
pfeux opened this issue May 6, 2024 · 11 comments
Closed

Error occurred when building #2872

pfeux opened this issue May 6, 2024 · 11 comments

Comments

@pfeux
Copy link

pfeux commented May 6, 2024

I am building tdlib in Ubuntu docker image

Following are my commands:

apt-get update && apt-get upgrade -y && apt-get autoremove -y && apt-get install make git zlib1g-dev libssl-dev gperf php-cli cmake clang-14 libc++-dev libc++abi-dev -y

CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib/Release -DTD_ENABLE_LTO=ON -DCMAKE_AR=/usr/bin/llvm-ar-14 -DCMAKE_NM=/usr/bin/llvm-nm-14 -DCMAKE_OBJDUMP=/usr/bin/llvm-objdump-14 -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-14 ..

cmake --build . --target install

I recently started getting the following error:

#15 58.87 -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.3")  
#15 58.87 -- Found ZLIB: /usr/include /usr/lib/x86_64-linux-gnu/libz.so
#15 58.88 -- Performing Test ATOMICS_FOUND
#15 58.98 -- Performing Test ATOMICS_FOUND - Failed
#15 58.98 -- Performing Test ATOMICS_FOUND
#15 59.08 -- Performing Test ATOMICS_FOUND - Failed
#15 59.08 CMake Error at CMake/FindAtomics.cmake:57 (message):
#15 59.08   Atomic operations library isn't found.
#15 59.08 Call Stack (most recent call first):
#15 59.08   tdutils/CMakeLists.txt:406 (find_package)

Has any requirements changed?

Thanks,

@levlam
Copy link
Contributor

levlam commented May 6, 2024

What is your host OS CPU architecture, and what is Docker image CPU architecture?

Compilation doesn't work for some reason in the Docker image. You need to check the file build/CMakeFiles/CMakeError.log inside the docker container for details. You can send it here if you need help with finding the cause.

@pfeux
Copy link
Author

pfeux commented May 7, 2024

CMakeError.log file is not generated.

The above error occurs when the following line executes

CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib/Release -DTD_ENABLE_LTO=ON -DCMAKE_AR=/usr/bin/llvm-ar-14 -DCMAKE_NM=/usr/bin/llvm-nm-14 -DCMAKE_OBJDUMP=/usr/bin/llvm-objdump-14 -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-14 ..

I have tried running in my local Linux docker with ubuntu:latest image (x86_64). Following is my PC configuration:
Processor: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz 2.71 GHz
System type: 64-bit operating system, x64-based processor
RAM: 32 GB
OS: Windows 11 21H2
OS Build: 22000.2899
Docker version 26.1.1, build 4cf5afa (installed in WSL Ubuntu 22.04 x86_64)

@levlam
Copy link
Contributor

levlam commented May 7, 2024

Files CMakeError.log and CMakeOutput.log are generated by the mentioned command during the CMake configuration in the build/CMakeFiles/ directory and can be used to find the cause of the build fail.

@pfeux
Copy link
Author

pfeux commented May 10, 2024

Please see the screenshot. There were no error log files generated.
image

@levlam
Copy link
Contributor

levlam commented May 10, 2024

Since CMake 3.26 the “CMakeFiles/CMakeOutput.log” and “CMakeFiles/CMakeError.log” files are no longer generated and information previously logged to those files is instead logged to “CMakeFiles/CMakeConfigureLog.yaml”. Could you send the file to https://t.me/tdlib_bot?

@pfeux
Copy link
Author

pfeux commented May 12, 2024

Hi, I have forwarded the file to tdlib_bot.

@levlam
Copy link
Contributor

levlam commented May 12, 2024

Compilation of any file fails with the error "Libc++ only supports Clang 16 and later". It looks like you have a too new libc++ installed not through apt. So this looks like a broken Docker image.

@pfeux
Copy link
Author

pfeux commented May 12, 2024

Thanks @levlam

Please provide your opinion on this fix:

Now I am installing the latest version of clang and while building I get the clang version using

clangVersion=$(clang --version | awk 'NR==1 {split($4, a, "."); print a[1]}')

and I made following changes

CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib/Release -DTD_ENABLE_LTO=ON -DCMAKE_AR=/usr/bin/llvm-ar-$clangVersion -DCMAKE_NM=/usr/bin/llvm-nm-$clangVersion -DCMAKE_OBJDUMP=/usr/bin/llvm-objdump-$clangVersion -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-$clangVersion ..

@levlam
Copy link
Contributor

levlam commented May 12, 2024

This may or may not work. Compilation with LTO can have a lot of issues if there are any inconsistencies in the used toolchain.

@levlam
Copy link
Contributor

levlam commented May 12, 2024

I checked that LTO build works with clang-18 on Ubuntu 24.04 and pushed support for Ubuntu 24.04 in the build instructions generator. This also means that your approach should work both on Ubuntu 24 and Ubuntu 22.

@pfeux
Copy link
Author

pfeux commented May 13, 2024

Awesome! Thanks for your help. I will close this issue now.

@pfeux pfeux closed this as completed May 13, 2024
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

No branches or pull requests

2 participants