Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.59k stars 12.33k forks source link

SDL2_mixer change broke pkg-config output #123141

Closed Kreeblah closed 1 year ago

Kreeblah commented 1 year ago

brew gist-logs <formula> link OR brew config AND brew doctor output

brew config:
HOMEBREW_VERSION: 3.6.21-99-g2a417f1
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2a417f14163aacfb4ffcb754fe9dea71c46f6ad0
Last commit: 3 hours ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: d6729912106b6f8d8fcc294c96a069bb8c8e1f8f
Core tap last commit: 45 minutes ago
Core tap branch: master
Core tap JSON: 01 Feb 07:22 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.xPr6U29AbD/org.xquartz:0
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_NO_INSTALL_FROM_API: set
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.39.1 => /opt/homebrew/bin/git
Curl: 7.86.0 => /usr/bin/curl
macOS: 13.2-arm64
CLT: 14.2.0.0.1.1668646533
Xcode: 14.2
Rosetta 2: false

brew doctor:
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  sdl_image
  sdl_mixer

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libCAPSImage.dylib
  /usr/local/lib/libMoltenVK.dylib
  /usr/local/lib/libSPIRV-Tools-shared.dylib
  /usr/local/lib/libVkLayer_api_dump.dylib
  /usr/local/lib/libVkLayer_device_simulation.dylib
  /usr/local/lib/libVkLayer_khronos_profiles.dylib
  /usr/local/lib/libVkLayer_khronos_synchronization2.dylib
  /usr/local/lib/libVkLayer_khronos_validation.dylib
  /usr/local/lib/libdxcompiler.3.7.dylib
  /usr/local/lib/libshaderc_shared.1.dylib
  /usr/local/lib/libspirv-cross-c-shared.0.48.0.dylib
  /usr/local/lib/libvulkan.1.3.204.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/dxc/Support/WinAdapter.h
  /usr/local/include/dxc/dxcapi.h
  /usr/local/include/glslang/HLSL/hlslAttributes.h
  /usr/local/include/glslang/HLSL/hlslGrammar.h
  /usr/local/include/glslang/HLSL/hlslOpMap.h
  /usr/local/include/glslang/HLSL/hlslParseHelper.h
  /usr/local/include/glslang/HLSL/hlslParseables.h
  /usr/local/include/glslang/HLSL/hlslScanContext.h
  /usr/local/include/glslang/HLSL/hlslTokenStream.h
  /usr/local/include/glslang/HLSL/hlslTokens.h
  /usr/local/include/glslang/Include/BaseTypes.h
  /usr/local/include/glslang/Include/Common.h
  /usr/local/include/glslang/Include/ConstantUnion.h
  /usr/local/include/glslang/Include/InfoSink.h
  /usr/local/include/glslang/Include/InitializeGlobals.h
  /usr/local/include/glslang/Include/PoolAlloc.h
  /usr/local/include/glslang/Include/ResourceLimits.h
  /usr/local/include/glslang/Include/ShHandle.h
  /usr/local/include/glslang/Include/SpirvIntrinsics.h
  /usr/local/include/glslang/Include/Types.h
  /usr/local/include/glslang/Include/arrays.h
  /usr/local/include/glslang/Include/glslang_c_interface.h
  /usr/local/include/glslang/Include/glslang_c_shader_types.h
  /usr/local/include/glslang/Include/intermediate.h
  /usr/local/include/glslang/MachineIndependent/Initialize.h
  /usr/local/include/glslang/MachineIndependent/LiveTraverser.h
  /usr/local/include/glslang/MachineIndependent/ParseHelper.h
  /usr/local/include/glslang/MachineIndependent/RemoveTree.h
  /usr/local/include/glslang/MachineIndependent/Scan.h
  /usr/local/include/glslang/MachineIndependent/ScanContext.h
  /usr/local/include/glslang/MachineIndependent/SymbolTable.h
  /usr/local/include/glslang/MachineIndependent/Versions.h
  /usr/local/include/glslang/MachineIndependent/attribute.h
  /usr/local/include/glslang/MachineIndependent/gl_types.h
  /usr/local/include/glslang/MachineIndependent/glslang_tab.cpp.h
  /usr/local/include/glslang/MachineIndependent/iomapper.h
  /usr/local/include/glslang/MachineIndependent/localintermediate.h
  /usr/local/include/glslang/MachineIndependent/parseVersions.h
  /usr/local/include/glslang/MachineIndependent/preprocessor/PpContext.h
  /usr/local/include/glslang/MachineIndependent/preprocessor/PpTokens.h
  /usr/local/include/glslang/MachineIndependent/propagateNoContraction.h
  /usr/local/include/glslang/MachineIndependent/reflection.h
  /usr/local/include/glslang/Public/ShaderLang.h
  /usr/local/include/glslang/SPIRV/GLSL.ext.AMD.h
  /usr/local/include/glslang/SPIRV/GLSL.ext.EXT.h
  /usr/local/include/glslang/SPIRV/GLSL.ext.KHR.h
  /usr/local/include/glslang/SPIRV/GLSL.ext.NV.h
  /usr/local/include/glslang/SPIRV/GLSL.std.450.h
  /usr/local/include/glslang/SPIRV/GlslangToSpv.h
  /usr/local/include/glslang/SPIRV/Logger.h
  /usr/local/include/glslang/SPIRV/NonSemanticDebugPrintf.h
  /usr/local/include/glslang/SPIRV/SPVRemapper.h
  /usr/local/include/glslang/SPIRV/SpvBuilder.h
  /usr/local/include/glslang/SPIRV/SpvTools.h
  /usr/local/include/glslang/SPIRV/bitutils.h
  /usr/local/include/glslang/SPIRV/disassemble.h
  /usr/local/include/glslang/SPIRV/doc.h
  /usr/local/include/glslang/SPIRV/hex_float.h
  /usr/local/include/glslang/SPIRV/spvIR.h
  /usr/local/include/glslang/build_info.h
  /usr/local/include/shaderc/env.h
  /usr/local/include/shaderc/shaderc.h
  /usr/local/include/shaderc/status.h
  /usr/local/include/shaderc/visibility.h
  /usr/local/include/spirv-tools/libspirv.h
  /usr/local/include/spirv_cross/GLSL.std.450.h
  /usr/local/include/spirv_cross/spirv.h
  /usr/local/include/spirv_cross/spirv_cross_c.h
  /usr/local/include/vk_video/vulkan_video_codec_h264std.h
  /usr/local/include/vk_video/vulkan_video_codec_h264std_decode.h
  /usr/local/include/vk_video/vulkan_video_codec_h264std_encode.h
  /usr/local/include/vk_video/vulkan_video_codec_h265std.h
  /usr/local/include/vk_video/vulkan_video_codec_h265std_decode.h
  /usr/local/include/vk_video/vulkan_video_codec_h265std_encode.h
  /usr/local/include/vk_video/vulkan_video_codecs_common.h
  /usr/local/include/vulkan/vk_enum_string_helper.h
  /usr/local/include/vulkan/vk_icd.h
  /usr/local/include/vulkan/vk_layer.h
  /usr/local/include/vulkan/vk_platform.h
  /usr/local/include/vulkan/vk_sdk_platform.h
  /usr/local/include/vulkan/vulkan.h
  /usr/local/include/vulkan/vulkan_android.h
  /usr/local/include/vulkan/vulkan_beta.h
  /usr/local/include/vulkan/vulkan_core.h
  /usr/local/include/vulkan/vulkan_directfb.h
  /usr/local/include/vulkan/vulkan_fuchsia.h
  /usr/local/include/vulkan/vulkan_ggp.h
  /usr/local/include/vulkan/vulkan_ios.h
  /usr/local/include/vulkan/vulkan_macos.h
  /usr/local/include/vulkan/vulkan_metal.h
  /usr/local/include/vulkan/vulkan_screen.h
  /usr/local/include/vulkan/vulkan_vi.h
  /usr/local/include/vulkan/vulkan_wayland.h
  /usr/local/include/vulkan/vulkan_win32.h
  /usr/local/include/vulkan/vulkan_xcb.h
  /usr/local/include/vulkan/vulkan_xlib.h
  /usr/local/include/vulkan/vulkan_xlib_xrandr.h

Warning: Unbrewed '.pc' files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected '.pc' files:
  /usr/local/lib/pkgconfig/SPIRV-Tools-shared.pc
  /usr/local/lib/pkgconfig/SPIRV-Tools.pc
  /usr/local/lib/pkgconfig/shaderc.pc
  /usr/local/lib/pkgconfig/spirv-cross-c-shared.pc
  /usr/local/lib/pkgconfig/vulkan.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
  /usr/local/lib/libGenericCodeGen.a
  /usr/local/lib/libHLSL.a
  /usr/local/lib/libMachineIndependent.a
  /usr/local/lib/libOGLCompiler.a
  /usr/local/lib/libOSDependent.a
  /usr/local/lib/libSPIRV-Tools-link.a
  /usr/local/lib/libSPIRV-Tools-lint.a
  /usr/local/lib/libSPIRV-Tools-opt.a
  /usr/local/lib/libSPIRV-Tools-reduce.a
  /usr/local/lib/libSPIRV-Tools.a
  /usr/local/lib/libSPIRV.a
  /usr/local/lib/libSPVRemapper.a
  /usr/local/lib/libglslang-default-resource-limits.a
  /usr/local/lib/libglslang.a
  /usr/local/lib/libshaderc.a
  /usr/local/lib/libshaderc_combined.a
  /usr/local/lib/libshaderc_util.a
  /usr/local/lib/libspirv-cross-c.a
  /usr/local/lib/libspirv-cross-core.a
  /usr/local/lib/libspirv-cross-cpp.a
  /usr/local/lib/libspirv-cross-glsl.a
  /usr/local/lib/libspirv-cross-hlsl.a
  /usr/local/lib/libspirv-cross-msl.a
  /usr/local/lib/libspirv-cross-reflect.a
  /usr/local/lib/libspirv-cross-util.a

Verification

What were you trying to do (and why)?

I was trying to build a project that uses pkg-config to find dependencies.

What happened (include all command output)?

This project built fine up until this commit to the sdl2_mixer formula: https://github.com/Homebrew/homebrew-core/commit/e22d6109d1e321659ee5093be91475777cf193c3 Starting with that commit, the code I'm trying to compile no longer does so, even code that compiled fine before. It seems that pkg-config can't satisfy all the dependencies for fluidsynth. In particular, it's complaining about not finding anything for readline:

$ pkg-config --cflags --libs SDL2_mixer
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
Package 'readline', required by 'fluidsynth', not found

What did you expect to happen?

I'd expect that command to output something more like what it does when called for SDL2:

$ pkg-config --cflags --libs SDL2
-D_THREAD_SAFE -I/opt/homebrew/include -I/opt/homebrew/include/SDL2 -L/opt/homebrew/lib -lSDL2

Step-by-step reproduction instructions (by running brew commands)

brew install sdl2 sdl2_mixer pkg-config
pkg-config --cflags --libs SDL2_mixer
cho-m commented 1 year ago

This is expected as readline is keg-only on macOS to avoid conflicting with libedit that Xcode/CLT already provides.

As pkg-config notes:

Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable

This is the same situation for any keg-only formula (e.g. openssl, icu4c, ...). See caveats in brew info readline:

==> Caveats
readline is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides BSD libedit.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/readline/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/readline/lib/pkgconfig"

The alternative would be to try to build fluid-synth with system libedit instead, but it would depend on how fluid-synth is using library and the compatibility between GNU's readline and BSD's libedit.

Kreeblah commented 1 year ago

Hmmm. I guess I'll take a look at getting an update for the fluid-synth formula ready to submit, then. Fluidsynth builds and runs just fine with the system libedit (including passing the same steps as the test in the formula), but it seems to be failing to build when I make what I believe are equivalent changes in the fluid-synth formula. I'll need to figure out what's going on there.

Thanks!

carlocab commented 1 year ago

We can probably fix this by doing something like

inreplace lib/"pkgconfig/fluidsynth.pc",
          /^(Requires\.private:.*) readline/,
          "\\1 #{Formula["readline"].opt_lib}/pkgconfig/readline.pc"

in the fluid-synth formula. This way you don't need to set PKG_CONFIG_PATH to make sure readline can be found.

Kreeblah commented 1 year ago

I think I'm going to need to reopen this to get some help. I have https://github.com/Kreeblah/homebrew-core/blob/fluid-synth_readline/Formula/fluid-synth.rb checked in to a clone of the repo that matches changes I can make to how I build fluidsynth when I download the code myself. Turns out it builds using the built-in libedit just fine, and can render the same file used in the formula's test when built that way. So, it seems like readline isn't required to be installed.

But, for whatever reason, I can't build the fluid-synth formula (even the version currently in homebrew-core) since I get the following error whenever I try to run brew install --build-from-source fluid-synth:

make[2]: *** read jobs pipe: Resource temporarily unavailable. Stop.

I can build other CMake-based formulas just fine, and I can build the fluidsynth CMake project outside of Homebrew, but I'm apparently having environmental issues when building the fluid-synth formula that I'll need to track down.

So, is there anybody who would be willing to either take a look at my commit or to take a look at @carlocab's suggestion? It'd really be nice to not have to specify PKG_CONFIG_PATH for things that use sdl2_mixer.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

carlocab commented 1 year ago

Fixed in #126004.