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] in Ubuntu, clang, Ninja enviornment. ERROR: pulseaudio/14.2: Error in build() method, line 131 #16905

Open
wbfw109 opened this issue Aug 29, 2024 · 5 comments
Assignees

Comments

@wbfw109
Copy link

wbfw109 commented Aug 29, 2024

Describe the bug

OS:Ubuntu 22.04 or 24.04 LTS

profile

[settings]
arch=x86_64
build_type=Debug
compiler=clang
compiler.version=18
compiler.cstd=23
compiler.cppstd=23
compiler.libcxx=libc++
os=Linux


[conf]
tools.cmake.cmaketoolchain:generator=Ninja


[buildenv]
CC=(path)/usr/bin/clang
CXX=(path)/usr/bin/clang++

conanfile.py

import os

from conan import ConanFile
from conan.tools.build import check_max_cppstd, check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import Environment
from conan.tools.files import copy, get
from conan.tools.gnu import AutotoolsToolchain
from conan.tools.scm import Git


class cpp_studyRecipe(ConanFile):
    name = "cpp_study"
    version = "0.1"
    package_type = "application"

    # Optional metadata
    license = "Apache License 2.0"
    author = ""
    url = ""
    description = "Cpp study"
    topics = ("cpp", "opencv", "vision")

    # Binary configuration
    settings = "os", "compiler", "build_type", "arch"

    options = {"shared": [True, False], "fPIC": [True, False]}

    default_options = {
        "shared": False,
        # "fPIC": True}
        "fPIC": False,
    }

    # Sources are located in the same place as this recipe, copy them to the recipe
    exports_sources = "CMakeLists.txt", "src/*"

    def config_options(self):
        if self.settings.os == "Windows":
            del self.options.fPIC

    def configure(self):
        if self.options.shared:
            # If os=Windows, fPIC will have been removed in config_options()
            # use rm_safe to avoid double delete errors
            self.options.rm_safe("fPIC")

    def layout(self):
        cmake_layout(self)

    def requirements(self):
        self.requires("opencv/[^4.10.0]")
        self.requires("fmt/[^11.0.2]")
        self.requires("pulseaudio/[^14.0]")

        self.test_requires("gtest/1.11.0")

        # self.requires("libmp3lame/[^3.100]")

    def build_requirements(self):
        self.tool_requires("cmake/[^3.30.1]")
        self.tool_requires("ninja/[^1.12.1]")

    def validate(self):
        check_min_cppstd(self, "23")
        check_max_cppstd(self, "23")

    # https://stackoverflow.com/questions/71548337/how-to-choose-ninja-as-cmake-generator-with-conan
    def generate(self):
        deps = CMakeDeps(self)
        deps.generate()
        tc = CMakeToolchain(self)
        tc.generate()

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

    def package(self):
        cmake = CMake(self)
        cmake.install()
        copy(
            self,
            "LICENSE",
            src=self.source_folder,
            dst=os.path.join(self.package_folder, "licenses"),
        )

How to reproduce it

when use 'conan install . --build=missing' with the profile,

pulseaudio/14.2: Building from source
pulseaudio/14.2: Package pulseaudio/14.2:11163bd72edfa8a64f1022d859d8f33bc067da22
pulseaudio/14.2: Copying sources to build folder
pulseaudio/14.2: Building your package in /home/wbfw109v2/.conan2/p/b/pulsea584a6dafc735/b
pulseaudio/14.2: Calling generate()
pulseaudio/14.2: Generators folder: /home/wbfw109v2/.conan2/p/b/pulsea584a6dafc735/b/build-debug/conan
pulseaudio/14.2: Generating aggregated env files
pulseaudio/14.2: Generated aggregated env files: ['conanbuild.sh']
pulseaudio/14.2: Calling build()
pulseaudio/14.2: RUN: "/home/wbfw109v2/.conan2/p/b/pulsea584a6dafc735/b/src/configure" --disable-shared --enable-static --prefix=/ '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' --enable-shared=no --enable-static=yes --enable-glib2=no --with-fftw=no '--with-udev-rules-dir=${prefix}/bin/udev/rules.d' --with-systemduserunitdir=/home/wbfw109v2/.conan2/p/b/pulsea584a6dafc735/b/build-debug/ignore --enable-alsa=yes --enable-x11=yes --enable-openssl=yes --enable-dbus=no '--libexecdir=${prefix}/bin'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for stow... no
checking whether make supports nested variables... (cached) yes
checking whether ln -s works... yes
checking for gcc... /usr/bin/clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/clang accepts -g... yes
checking for /usr/bin/clang option to accept ISO C89... none needed
checking whether /usr/bin/clang understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of /usr/bin/clang... gcc3
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/clang++ accepts -g... yes
checking dependency style of /usr/bin/clang++... gcc3
checking how to run the C preprocessor... /usr/bin/clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether /usr/bin/clang needs -traditional... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define EXTENSIONS... yes
checking whether /usr/bin/clang++ supports C++11 features by default... yes
checking for gm4... /home/wbfw109v2/.conan2/p/b/m4838c7df5f758c/p/bin/m4
checking pkg-config is at least version 0.9.0... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking whether NLS is requested... yes
checking for msgfmt... /home/wbfw109v2/.conan2/p/b/gette6532680a6b0b4/p/bin/msgfmt
checking for gmsgfmt... /home/wbfw109v2/.conan2/p/b/gette6532680a6b0b4/p/bin/msgfmt
checking for xgettext... /home/wbfw109v2/.conan2/p/b/gette6532680a6b0b4/p/bin/xgettext
checking for msgmerge... /home/wbfw109v2/.conan2/p/b/gette6532680a6b0b4/p/bin/msgmerge
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for ld used by /usr/bin/clang... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking host operating system... linux
checking whether C compiler accepts -std=gnu11... no
configure: error: *** Compiler does not support -std=gnu11
pulseaudio/14.2: ERROR:
Package '11163bd72edfa8a64f1022d859d8f33bc067da22' build failed
ERROR: pulseaudio/14.2: Error in build() method, line 131
autotools.configure()
ConanException: Error 1 while executing

@memsharded memsharded self-assigned this Aug 29, 2024
@memsharded
Copy link
Member

Hi @wbfw109

Thanks for your feedback.

This might not be an issue of Conan itself, but instead an issue of ConanCenter recipes from the conan-center-index repository. In that case we will move the ticket to that repo.

The thing is that it is possible that some recipes do not build with some different configuration, ConanCenter builds and test a bunch of them but not all.

I am trying to reproduce, but I got a different error in one of the dependencies that builds first, flac/1.4.2:

flac/1.4.2: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/user/.conan2/p/b/flac9e75eca4c6fbc/p" -DCMAKE_POLICY_DEFAULT_CMP0077="NEW" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "/home/user/.conan2/p/b/flac9e75eca4c6fbc/b/src"
-- Using Conan toolchain: /home/user/.conan2/p/b/flac9e75eca4c6fbc/b/build/Debug/generators/conan_toolchain.cmake
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: Defining architecture flag: -m64
-- Conan toolchain: Defining libcxx as C++ flags: -stdlib=libc++
-- Conan toolchain: C++ Standard 23 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- The C compiler identification is Clang 14.0.0
-- The CXX compiler identification is Clang 14.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ - broken
CMake Error at /home/user/.envs/conan2/lib/python3.10/site-packages/cmake/data/share/cmake-3.25/Modules/CMakeTestCXXCompiler.cmake:63 (message):
  The C++ compiler

    "/usr/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/user/.conan2/p/b/flac9e75eca4c6fbc/b/build/Debug/CMakeFiles/CMakeScratch/TryCompile-JmuFRA

    Run Build Command(s):/usr/bin/ninja cmTC_8631b && [1/2] Building CXX object CMakeFiles/cmTC_8631b.dir/testCXXCompiler.cxx.o
    [2/2] Linking CXX executable cmTC_8631b
    FAILED: cmTC_8631b
    : && /usr/bin/clang++ -m64 -stdlib=libc++ -m64 CMakeFiles/cmTC_8631b.dir/testCXXCompiler.cxx.o -o cmTC_8631b   && :
    /usr/bin/ld: cannot find -lc++: No such file or directory
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

Can you please share your full output?
Conan 2 is assumed here, but please clarify your exact Conan version.

@wbfw109
Copy link
Author

wbfw109 commented Aug 30, 2024

Thank @memsharded for comment .

After creating this post, I discovered the existence of the conan-center-index repository, and I believe the issue may be related to that repository. Therefore, I have posted the problem in the issue there. All the relevant environment details and content are clearly specified, so please refer to it there for more information.
conan-io/conan-center-index#25075

Since I have already posted more specific details in that repository, I will monitor the situation and close this issue here myself soon.

Thank you for your response and for testing. : )

@memsharded
Copy link
Member

Thanks for the details there, I have now been able to pass that flac build error, I was missing libc++-dev libc++abi-dev in my Linux machine.

@memsharded
Copy link
Member

I have successfully built it with my clang 14 in my Ubuntu 22.04
The output passes with:

checking where the gettext function comes from... libc
checking host operating system... linux
checking whether C compiler accepts -std=gnu11... yes

Is it possible that such modern clang 18 version might have removed support for the (relative) old gnu11?
Why the

``configure: error: *** Compiler does not support -std=gnu11``
```?

@memsharded
Copy link
Member

Hi @wbfw109

Did you get any further insight about the clang 18 possible issue with gnu11?

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