Opened 7 years ago

Closed 7 years ago

#56097 closed defect (fixed)

audacity: not always respecting CXXFLAGS

Reported by: mojca (Mojca Miklavec) Owned by: RJVB (René Bertin)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: audacity

Description

From a failed build on 10.7:

/opt/local/bin/clang++-mp-5.0 -I. -I. -pipe -Os -Wno-inconsistent-missing-override -Wno-overloaded-virtual -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-libstdc++ -arch x86_64 -fPIC -Wall    -c -o examples/plugins.o examples/plugins.cpp
ar r libvamp-sdk.a src/vamp-sdk/PluginAdapter.o src/vamp-sdk/RealTime.o src/vamp-sdk/FFT.o src/vamp-sdk/acsymbols.o
/opt/local/bin/clang++-mp-5.0  -dynamiclib -o libvamp-sdk.so src/vamp-sdk/PluginAdapter.o src/vamp-sdk/RealTime.o src/vamp-sdk/FFT.o src/vamp-sdk/acsymbols.o
ar: creating archive libvamp-sdk.a
Undefined symbols for architecture x86_64:
  "std::ctype<char>::_M_widen_init() const", referenced from:
      _VampPlugin::Vamp::PluginAdapterBase::Impl::getDescriptor() in PluginAdapter.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To me this looks like a completely missing block with -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-libstdc++ -arch x86_64 -fPIC -Wall in compiler call.

Attachments (2)

libvamp-Makefile-for-osx.diff (1.6 KB) - added by RJVB (René Bertin) 7 years ago.
audacity.diff (7.9 KB) - added by RJVB (René Bertin) 7 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 7 years ago by mojca (Mojca Miklavec)

Off-topic, but here's the error from attempts to fetch audacity-devel from git:

fatal: unable to access 'https://github.com/audacity/audacity.git/': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

I suggest to remove the fetching from git, or perhaps at least fetch via the git protocol. You can still turn it on locally with a single line when you want to experiment.

Last edited 7 years ago by mojca (Mojca Miklavec) (previous) (diff)

comment:2 Changed 7 years ago by mojca (Mojca Miklavec)

Bu also note that the library included in Audacity is nearly 5 years old (version 2.5): https://github.com/c4dm/vamp-plugin-sdk/releases

It might be time to request an update.

comment:3 in reply to:  description Changed 7 years ago by RJVB (René Bertin)

Replying to mojca:

To me this looks like a completely missing block with -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-libstdc++ -arch x86_64 -fPIC -Wall in compiler call.

You mean in the compile command for PluginAdapter.cpp? In my builds that command does include the expected CXXFLAGS.

Do I understand correctly that the legacy builders try to build the port without C++11? That should probably work for libvamp (if it's really that old), but I'm not sure it will for the rest of the port. Building with a recent GCC might work out better, but how can we achieve and test that?

comment:4 Changed 7 years ago by mojca (Mojca Miklavec)

I mean the command with -o libvamp-sdk.so. In these builders the flags are clearly missing (in all of < 10.9 builders, I believe).

Legacy builders do build C++11, but in a way that's somehow abi-compatible with the old libstdc++. If CXXFLAGS are in fact missing, I doubt that gcc would be of any help, but if you have access to a VM with 10.6 you can try configure.compiler=macports-gcc-6. I still believe it's not working correctly though.

If you have an account, I would be grateful if you could ask Audacity to update libvamp.

comment:5 Changed 7 years ago by RJVB (René Bertin)

Ah, right. That's not completely unheard of (or wrong): CXXFLAGS is for compiling, the command generating libvamp-sdk.so is a link command. Is the -stdlib=macports-stdc++ option added to configure.ldflags? Libvamp's Makefile does inclde $(LDFLAGS) in its link commands, but the variable appears to be empty. There is already a patch for that Makefile, adding a mod that will allow setting LDFLAGS explicitly will be trivial.

I no longer have a 10.6 VM with a functional (let alone up-to-date) MacPorts install, unfortunately.

You had a look at the libvamp repo, does it look like something we might prefer providing in MacPorts instead of relying on an embedded copy?

comment:6 in reply to:  5 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to RJVB:

Ah, right. That's not completely unheard of (or wrong): CXXFLAGS is for compiling, the command generating libvamp-sdk.so is a link command. Is the -stdlib=macports-stdc++ option added to configure.ldflags?

No; I think that would only work if the linker is a C++ compiler, and MacPorts can't know if that's the case for a particular port. I think we decided that projects' Makefiles should pass CXXFLAGS to the linker, if linking C++ code. If you don't want to make that change, you can manually add the -stdlib flag to configure.ldflags like some other ports already do.

comment:7 Changed 7 years ago by RJVB (René Bertin)

I just tested: clang 4 and 5 seem to ignore the -stdlib=foo argument when invoked as the C driver. To the extent that the argument's rvalue is truly moot, even.

In this case the overall argument is moot too as libvamp's Makefile doesn't see configure.ldflags at all but I think your assumption needs a bit more testing. It's a bit of a pity to have a convenience way to declare the required C++ runtime that still leaves a crucial part to the user/Portfile.

comment:8 in reply to:  4 Changed 7 years ago by RJVB (René Bertin)

Replying to mojca:

If you have an account, I would be grateful if you could ask Audacity to update libvamp.

http://forum.audacityteam.org/viewtopic.php?p=344439#p344439

comment:9 Changed 7 years ago by RJVB (René Bertin)

Attaching a fix together with the upgrade I was already working on.

The patch is large because I moved the post-patch block inside the Portfile. I also reorganised the Portfile so as to minimise the differences with my personal, original version - and thus the time required to transfer changes.

Last edited 7 years ago by RJVB (René Bertin) (previous) (diff)

Changed 7 years ago by RJVB (René Bertin)

Changed 7 years ago by RJVB (René Bertin)

Attachment: audacity.diff added

comment:10 Changed 7 years ago by mojca (Mojca Miklavec)

I believe this particular error was solved, but we have another issue with some C++11 mixup. I guess I'll commit these changes anyway and this can then be fixed later.

In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:21:22: error: declaration conflicts with target of using declaration already in scope
inline long long int llrint(float __x) { return __builtin_llrintf(__x); }
                     ^
/opt/local/include/gcc/c++/cmath:1530:3: note: target of using declaration
  llrint(float __x)
  ^
/opt/local/include/gcc/c++/math.h:94:12: note: using declaration
using std::llrint;
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:23:22: error: declaration conflicts with target of using declaration already in scope
inline long long int llrint(long double __x) { return __builtin_llrintl(__x); }
                     ^
/opt/local/include/gcc/c++/cmath:1534:3: note: target of using declaration
  llrint(long double __x)
  ^
/opt/local/include/gcc/c++/math.h:94:12: note: using declaration
using std::llrint;
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:46:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::hash;
                   ^
/opt/local/include/gcc/c++/tr1/functional_hash.h:45:12: note: target of using declaration
    struct hash : public std::unary_function<_Tp, size_t>
           ^
/opt/local/include/gcc/c++/bits/functional_hash.h:101:12: note: conflicting declaration
    struct hash : __hash_enum<_Tp>
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:49:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::shared_ptr;
                   ^
/opt/local/include/gcc/c++/tr1/shared_ptr.h:983:11: note: target of using declaration
    class shared_ptr
          ^
/opt/local/include/gcc/c++/bits/shared_ptr.h:93:11: note: conflicting declaration
    class shared_ptr : public __shared_ptr<_Tp>
          ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:50:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::weak_ptr;
                   ^
/opt/local/include/gcc/c++/tr1/shared_ptr.h:1071:11: note: target of using declaration
    class weak_ptr
          ^
/opt/local/include/gcc/c++/bits/shared_ptr.h:520:11: note: conflicting declaration
    class weak_ptr : public __weak_ptr<_Tp>
          ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:52:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::remove_reference;
                   ^
/opt/local/include/gcc/c++/tr1/type_traits:643:12: note: target of using declaration
    struct remove_reference
           ^
/opt/local/include/gcc/c++/type_traits:1628:12: note: conflicting declaration
    struct remove_reference
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:53:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::is_unsigned;
                   ^
/opt/local/include/gcc/c++/tr1/type_traits:567:12: note: target of using declaration
    struct is_unsigned
           ^
/opt/local/include/gcc/c++/type_traits:747:12: note: conflicting declaration
    struct is_unsigned
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:54:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::is_const;
                   ^
/opt/local/include/gcc/c++/tr1/type_traits:308:12: note: target of using declaration
    struct is_const
           ^
/opt/local/include/gcc/c++/type_traits:655:12: note: conflicting declaration
    struct is_const
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:55:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::add_const;
                   ^
/opt/local/include/gcc/c++/tr1/type_traits:426:12: note: target of using declaration
    struct add_const
           ^
/opt/local/include/gcc/c++/type_traits:1579:12: note: conflicting declaration
    struct add_const
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:56:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::add_pointer;
                   ^
/opt/local/include/gcc/c++/tr1/type_traits:491:12: note: target of using declaration
    struct add_pointer
           ^
/opt/local/include/gcc/c++/type_traits:2002:12: note: conflicting declaration
    struct add_pointer
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:57:20: error: target of using declaration conflicts with declaration already in scope
   using std::tr1::remove_pointer;
                   ^
/opt/local/include/gcc/c++/tr1/type_traits:482:12: note: target of using declaration
    struct remove_pointer
           ^
/opt/local/include/gcc/c++/type_traits:1987:12: note: conflicting declaration
    struct remove_pointer
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:59:32: error: redefinition of 'add_rvalue_reference'
   template<typename T> struct add_rvalue_reference {
                               ^
/opt/local/include/gcc/c++/type_traits:1663:12: note: previous definition is here
    struct add_rvalue_reference
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:63:32: error: redefinition of 'default_delete'
   template<typename X> struct default_delete
                               ^
/opt/local/include/gcc/c++/bits/unique_ptr.h:56:12: note: previous definition is here
    struct default_delete
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:86:32: error: redefinition of 'default_delete<X []>'
   template<typename X> struct default_delete<X[]>
                               ^~~~~~~~~~~~~~~~~~~
/opt/local/include/gcc/c++/bits/unique_ptr.h:86:12: note: previous definition is here
    struct default_delete<_Tp[]>
           ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:95:11: error: definition of type 'nullptr_t' conflicts with typedef of the same name
   struct nullptr_t
          ^
/opt/local/include/gcc/c++/x86_64-apple-darwin10/bits/c++config.h:235:29: note: 'nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:125:69: error: 'move' is missing exception specification 'noexcept'
   template<typename T> inline typename remove_reference<T>::type&& move(T&& t)
                                                                    ^
                                                                                noexcept
/opt/local/include/gcc/c++/bits/move.h:98:5: note: previous declaration is here
    move(_Tp&& __t) noexcept
    ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:128:63: error: redefinition of 'unique_ptr'
   template<typename T, typename D = default_delete<T>> class unique_ptr
                                                              ^
/opt/local/include/gcc/c++/bits/unique_ptr.h:157:11: note: previous definition is here
    class unique_ptr
          ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:226:43: error: redefinition of 'unique_ptr<T [], D>'
   template<typename T, typename D> class unique_ptr<T[], D>
                                          ^~~~~~~~~~~~~~~~~~
/opt/local/include/gcc/c++/bits/unique_ptr.h:397:11: note: previous definition is here
    class unique_ptr<_Tp[], _Dp>
          ^
In file included from BlockFile.cpp:43:
In file included from ./BlockFile.h:15:
./MemoryX.h:309:16: error: 'operator==' is missing exception specification 'noexcept'
   inline bool operator== (nullptr_t, const unique_ptr<U, E>& ptr)
               ^
                                                                   noexcept
/opt/local/include/gcc/c++/bits/unique_ptr.h:694:5: note: previous declaration is here
    operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

comment:11 Changed 7 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed

In 1f460f769ac5bd887670ca7f3941ed589dd5cb8f/macports-ports:

audacity: add missing stdlib flags

Closes: #56097

Note: See TracTickets for help on using tickets.