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

Autotools are not aware of ObjectiveC #387

Closed
mojca opened this issue Nov 9, 2019 · 9 comments
Closed

Autotools are not aware of ObjectiveC #387

mojca opened this issue Nov 9, 2019 · 9 comments
Labels
community build bugs Bug in non-official builds, such as distro-repos or self-compiled ones

Comments

@mojca
Copy link
Contributor

mojca commented Nov 9, 2019

Describe the bug

When building Audacity on macOS with a configure script rather than Xcode, some files are not built correctly due to the use of ObjectiveC. (The Xcode project explicitly marks those files as ObjectiveC, but automake doesn't know anything about the file types.)

The autotools would probably at least need to define AC_PROG_OBJC, but further changes might be needed. A quick-and-dirty workaround for us was to rename some files from .cpp to .mm, but that's probably not suitable to be upstreamed as these files are regular C++ files for any other platform. Another dirty workaround might be to simply always add -ObjC when using wxWidgets with Cocoa.

Clang as the default compiler on macOS builds ObjectiveC if one either passes the -ObjC compiler flag, or if the file ends with a suitable extension.

Even if the CMake support gets added, the problem will not simply disappear as CMake would call the compiler based on file ending as well.

The list of affected files is roughly the following:

src/KeyboardCapture
src/VSTControlOSX
src/commands/CommandManager
src/effects/Effect
src/effects/lv2/LV2Effect
src/menus/WindowMenus

A slightly related problem is the following piece of code blindly assuming that everyone using VST must be using GTK. We work around it by replacing VSTControlGTK.cpp with VSTControlOSX.mm, but this needs some conditional on WXMAC as well.

if USE_VST
audacity_CPPFLAGS += $(VST_CFLAGS)
audacity_LDADD += $(VST_LIBS)
audacity_SOURCES += \
	effects/VST/aeffectx.h \
	effects/VST/VSTEffect.cpp \
	effects/VST/VSTEffect.h \
	effects/VST/VSTControlGTK.cpp \
	effects/VST/VSTControlGTK.h \
	$(NULL)
endif

To Reproduce
Build Audacity on macOS with autotools.

Additional information (please complete the following information):

  • OS: macOS (version not important)
  • Version: master branch as of November 19

@RJVB @Paul-Licameli

@RJVB
Copy link
Contributor

RJVB commented Nov 10, 2019 via email

@Paul-Licameli
Copy link
Collaborator

Paul-Licameli commented Nov 10, 2019 via email

@RJVB
Copy link
Contributor

RJVB commented Nov 10, 2019 via email

@Paul-Licameli
Copy link
Collaborator

Paul-Licameli commented Nov 10, 2019 via email

@RJVB
Copy link
Contributor

RJVB commented Nov 10, 2019 via email

@JamesCrook JamesCrook added the community build bugs Bug in non-official builds, such as distro-repos or self-compiled ones label Nov 12, 2019
@JamesCrook JamesCrook added this to the Audacity 2.4.0 milestone Nov 14, 2019
@eszlari
Copy link

eszlari commented Nov 22, 2019

cmake 3.16 will have support for Objective C/C++:

https://cmake.org/cmake/help/v3.16/release/3.16.html

@mojca
Copy link
Contributor Author

mojca commented Nov 22, 2019

I know, but that doesn't help in any way at the moment. If files have wrong extension and you don't provide any explicit hints to it, CMake will also not magically recognise the need for objective C. Most importantly though the CMake build system is not yet ready.

@RJVB
Copy link
Contributor

RJVB commented Nov 22, 2019 via email

@JamesCrook
Copy link
Contributor

CMake is now used to build Audacity, so this issue closed. Thanks to all who contributed to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community build bugs Bug in non-official builds, such as distro-repos or self-compiled ones
Projects
None yet
Development

No branches or pull requests

5 participants