Opened 7 months ago

Closed 5 months ago

#68478 closed defect (fixed)

switchaudio-osx @1.2.2: fatal error: 'CoreAudio/AudioHardwareBase.h' file not found

Reported by: RobK88 Owned by: i0ntempest
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: snowleopard lion mountainlion mavericks yosemite elcapitan sierra highsierra mojave catalina bigsur Cc: RobK88
Port: switchaudio-osx

Description

The port switchaudio-osx fails to build. I see that the MacPorts build bots are also unable to build switchaudio-osx on Snow Leopard through to Big Sur. I tried building using other compilers. It made no difference.

According to the developer's website, switchaudio-osx should build on Lion and greater.

It looks like there is a missing header -- CoreAudio/AudioHardwareBase.h

See below and the attached main.log

bash-3.2$ sudo port clean switchaudio-osx
--->  Cleaning switchaudio-osx
bash-3.2$ 
bash-3.2$ sudo port -v install switchaudio-osx
--->  Fetching archive for switchaudio-osx

etc etc

--->  Building switchaudio-osx
Build settings from command line:
    ARCHS = x86_64
    CLANG_CXX_LIBRARY = libc++
    GCC_VERSION = com.apple.compilers.llvm.clang.1_0
    INSTALL_PATH = /Applications/MacPorts
    MACOSX_DEPLOYMENT_TARGET = 10.7
    OBJROOT = /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/
    SDKROOT = 
    SYMROOT = build

=== BUILD NATIVE TARGET SwitchAudioSource OF PROJECT AudioSwitcher WITH CONFIGURATION Release ===
Check dependencies

CompileC build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.o audio_switch.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2
    setenv LANG en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -std=c99 -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.7 -g -fvisibility=hidden -Wno-sign-conversion -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-generated-files.hmap -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-own-target-headers.hmap -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-all-target-headers.hmap -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-project-headers.hmap -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/Release/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/DerivedSources/x86_64 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/DerivedSources -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/Release -MMD -MT dependencies -MF /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.d --serialize-diagnostics /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.dia -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/audio_switch.c -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.o
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/audio_switch.c:30:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/audio_switch.h:36:10: fatal error: 'CoreAudio/AudioHardwareBase.h' file not found
#include <CoreAudio/AudioHardwareBase.h>
         ^
1 error generated.

CompileC build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/main.o main.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2
    setenv LANG en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -std=c99 -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.7 -g -fvisibility=hidden -Wno-sign-conversion -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-generated-files.hmap -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-own-target-headers.hmap -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-all-target-headers.hmap -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/SwitchAudioSource-project-headers.hmap -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/Release/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/DerivedSources/x86_64 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/DerivedSources -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/Release -MMD -MT dependencies -MF /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/main.d --serialize-diagnostics /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/main.dia -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/main.c -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/main.o
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/main.c:1:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/audio_switch.h:36:10: fatal error: 'CoreAudio/AudioHardwareBase.h' file not found
#include <CoreAudio/AudioHardwareBase.h>
         ^
1 error generated.

2023-10-15 12:42:15.511 xcodebuild[78084:4503]  DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-2110/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:87
Details:  Failed to load dependencies output contents from ``/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “audio_switch.d” couldn’t be opened because there is no such file." UserInfo=0x4011c7f20 {NSFilePath=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.d, NSUnderlyingError=0x4011c7700 "The operation couldn’t be completed. No such file or directory"}. User info: {
    NSFilePath = "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.d";
    NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *, void (^)(NSString *))
Thread:   <NSThread: 0x4001dae00>{name = (null), num = 4}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

** BUILD FAILED **


The following build commands failed:
	CompileC build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/audio_switch.o audio_switch.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
	CompileC build/AudioSwitcher.build/Release/SwitchAudioSource.build/Objects-normal/x86_64/main.o main.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2" && /usr/bin/xcodebuild -project "AudioSwitcher.xcodeproj" -target "SwitchAudioSource" -configuration Release build INSTALL_PATH=/Applications/MacPorts  OBJROOT="/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/" SYMROOT="/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/work/switchaudio-osx-1.2.2/build/" MACOSX_DEPLOYMENT_TARGET=10.7 ARCHS=x86_64 SDKROOT="" GCC_VERSION=com.apple.compilers.llvm.clang.1_0 CLANG_CXX_LIBRARY="libc++" SYMROOT=build
Exit code: 65
Error: Failed to build switchaudio-osx: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_switchaudio-osx/switchaudio-osx/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port switchaudio-osx failed
bash-3.2$

Attachments (1)

main.log (21.9 KB) - added by RobK88 7 months ago.

Download all attachments as: .zip

Change History (8)

Changed 7 months ago by RobK88

Attachment: main.log added

comment:1 Changed 7 months ago by RobK88

Cc: RobK88 added

comment:2 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: i0ntempest removed
Keywords: snowleopard lion mountainlion mavericks yosemite elcapitan sierra highsierra mojave catalina bigsur added
Owner: set to i0ntempest
Status: newassigned
Summary: switchaudio-osx @1.2.2 - Fails to Build - Missing Header file - CoreAudio/AudioHardwareBase.hswitchaudio-osx @1.2.2: fatal error: 'CoreAudio/AudioHardwareBase.h' file not found

Please report the bug to the developer so they can fix it.

I agree the project's readme says it was tested on 10.7 and later but it appears not to have been tested on macOS versions that old for some time given that there is another bug already filed about a different build failure that affects 10.14.

comment:3 Changed 7 months ago by RobK88

I agree Ryan. It looks like the readme.md file on the project's GitHub page is out of date since the latest source code now relies on new symbols that are only available on macOS 12 Monterey and later.

P.S. I did report the bug to the developer. But I think the real bug is with the readme.md file which should be updated to indicate that the program now only runs on macOS12 Monterey and later.

Last edited 7 months ago by RobK88 (previous) (diff)

comment:4 Changed 7 months ago by RobK88

Please note that version 1.1.0 of switchaudio-osx still builds on Lion and presumably on all macOS versions. See below. Versions 1.2.0 and newer do not build.

Maybe we should create a switchaudio-osx-legacy port for the older macOS's and restrict this port to Monterey and newer?

rob$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.7.5
BuildVersion:	11G63


rob$ ./AudioSwitcher
Please specify audio device.
Usage: ./AudioSwitcher [-a] [-c] [-t type] [-n] -s device_name | -i device_id | -u device_uid
  -a             : shows all devices
  -c             : shows current device

  -f format      : output format (cli/human/json). Defaults to human.
  -t type        : device type (input/output/system).  Defaults to output.
  -n             : cycles the audio device to the next one
  -i device_id   : sets the audio device to the given device by id
  -u device_uid  : sets the audio device to the given device by uid or a substring of the uid
  -s device_name : sets the audio device to the given device by name


rob$ ./AudioSwitcher -c
Built-in Line Output
Last edited 7 months ago by RobK88 (previous) (diff)

comment:5 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Or make the single switchaudio-osx port install 1.1.0 when building for Big Sur and earlier and 1.2.0 for Monterey and later. It would probably want to decide based on ${macosx_deployment_target} rather than ${os.major}.

I don't like the idea of a separate port with "legacy" in the name. It's not very specific. What happens if version 1.3.0 drops support for Monterey? Do you then create a third port called switchaudio-osx-not-quite-as-legacy for 1.2.0? If separate ports need to be created for separate versions, the best idea is usually to put the relevant portion of the version number into the port name.

There don't appear to be any ports that depend on switchaudio-osx so either strategy could be used, but in the case of ports that are used by other ports I prefer not having separate ports because it makes it easier on all the other ports. Separate ports require those other ports to know on which OS versions to depend on which port.

comment:6 Changed 7 months ago by RobK88

@Ryan -- interesting idea -- using a single port for the current version and the legacy version. But wouldn't that confuse users? When one gets info on the port (e.g. port info switchaudio-osx), one will see only the current version listed. And when they install the port on an old Mac, they may think they are running the most recent version when in fact they are not.

Perhaps having separate ports with the version number in the port name makes the most sense.

Last edited 7 months ago by RobK88 (previous) (diff)

comment:7 Changed 5 months ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In fbe70d6671b06a1f60a49e266b99c5ec454ac473/macports-ports (master):

switchaudio-osx: fallback version for older systems

closes: #68478

Note: See TracTickets for help on using tickets.