#67038 closed defect (fixed)

libvpx @1.13.0: requires c++11

Reported by: kencu (Ken) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: libvpx

Description (last modified by kencu (Ken))

libvpx already has various compiler blacklisting in the Portfile that approximates a c++11 standard, but it doesn't explicitly require c++11 so the proper MacPorts flags and libraries are not chosen on older systems, for example building here on Leopard Intel:

/opt/local/bin/clang-mp-7.0  -pipe -Os -isysroot/ -arch i386 -DNDEBUG -O3 -fPIC -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wextra-semi -Wfloat-conversion -Wformat=2 -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -I. -I"/opt/local/var/macports/build/_opt_macports-ports_multimedia_libvpx/libvpx/work/libvpx-1.13.0" -c -o md5_utils.c.o md5_utils.c
In file included from vp9/ratectrl_rtc.cc:10:
./vp9/ratectrl_rtc.h:14:10: fatal error: 'cstdint' file not found
#include <cstdint>
         ^~~~~~~~~
1 error generated.
make[1]: *** [vp9/ratectrl_rtc.cc.o] Error 1
make[1]: *** Waiting for unfinished jobs....

However, to match the current Portfile blacklisting, some extra blacklisting will still have to be retained in the Portfile.

Attachments (1)

libvpx-intel-leopard.log (1.2 MB) - added by kencu (Ken) 21 months ago.

Download all attachments as: .zip

Change History (7)

Changed 21 months ago by kencu (Ken)

Attachment: libvpx-intel-leopard.log added

comment:1 Changed 21 months ago by kencu (Ken)

Owner: set to mascguy
Status: newassigned

comment:2 Changed 21 months ago by kencu (Ken)

Description: modified (diff)

comment:3 Changed 21 months ago by kencu (Ken)

This helps:

$ git diff
diff --git a/multimedia/libvpx/Portfile b/multimedia/libvpx/Portfile
index 6c64d842b86..2733fc0dd52 100644
--- a/multimedia/libvpx/Portfile
+++ b/multimedia/libvpx/Portfile
@@ -43,6 +43,9 @@ supported_archs     x86_64 i386 arm64 ppc ppc64
 patchfiles-append   patch-Makefile.diff
 patchfiles-append   patch-configure.sh.diff
 
+# requires c++11 https://trac.macports.org/ticket/67038
+compiler.cxx_standard 2011
+
 # Uses newer assembly features on Intel.
 # Also blacklist clang 8, due to issues like:
 #   error: use of undeclared identifier 'abs'

but unfortunately does not fully fix the build. Later on in the build, there is a link failure, because the required -stdlib=macports-libstdc++ does not make it onto the link line:

cp libvpxrc_g.a libvpxrc.a
/opt/local/bin/clang++-mp-7.0 -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/ -arch i386 -o test_libvpx ivfenc.c.o md5_utils.c.o test/active_map_refresh_test.cc.o test/active_map_test.cc.o test/alt_ref_aq_segment_test.cc.o test/altref_test.cc.o test/aq_segment_test.cc.o test/bench.cc.o test/borders_test.cc.o test/byte_alignment_test.cc.o test/config_test.cc.o test/cpu_speed_test.cc.o test/cq_test.cc.o test/decode_api_test.cc.o test/decode_corrupted.cc.o test/decode_svc_test.cc.o test/decode_test_driver.cc.o test/encode_api_test.cc.o test/encode_test_driver.cc.o test/error_resilience_test.cc.o test/external_frame_buffer_test.cc.o test/frame_size_tests.cc.o test/invalid_file_test.cc.o test/keyframe_test.cc.o test/level_test.cc.o test/realtime_test.cc.o test/resize_test.cc.o test/svc_datarate_test.cc.o test/svc_end_to_end_test.cc.o test/svc_test.cc.o test/test_libvpx.cc.o test/test_vector_test.cc.o test/test_vectors.cc.o test/timestamp_test.cc.o test/user_priv_test.cc.o test/vp8_datarate_test.cc.o test/vp9_datarate_test.cc.o test/vp9_end_to_end_test.cc.o test/vp9_ethread_test.cc.o test/vp9_ext_ratectrl_test.cc.o test/vp9_lossless_test.cc.o test/vp9_motion_vector_test.cc.o test/vp9_skip_loopfilter_test.cc.o test/y4m_test.cc.o third_party/libwebm/mkvparser/mkvparser.cc.o third_party/libwebm/mkvparser/mkvreader.cc.o webmdec.cc.o y4menc.c.o y4minput.c.o -L. -lvpx -lgtest -lpthread -lm -lpthread
Undefined symbols for architecture i386:
  "std::ctype<char>::_M_widen_init() const", referenced from:
      testing::internal::RangeGenerator<int, int>::Iterator::Equals(testing::internal::ParamIteratorInterface<int> const&) const in active_map_refresh_test.cc.o
      testing::internal::ValuesInIteratorRangeGenerator<libvpx_test::TestMode>::Iterator::Equals(testing::internal::ParamIteratorInterface<libvpx_test::TestMode> const&) const in active_map_refresh_test.cc.o
      testing::internal::ValuesInIteratorRangeGenerator<libvpx_test::CodecFactory const*>::Iterator::Equals(testing::internal::ParamIteratorInterface<libvpx_test::CodecFactory const*> const&) const in active_map_refresh_test.cc.o
      __ZNK7testing8internal25CartesianProductGeneratorIJPKN11libvpx_test12CodecFactoryENS2_8TestModeEiEE12IteratorImplINS0_13IndexSequenceIJLm0ELm1ELm2EEEEE6EqualsERKNS0_22ParamIteratorInterfaceISt5tupleIJS5_S6_iEEEE in active_map_refresh_test.cc.o
      testing::internal::ParameterizedTestSuiteInfo<(anonymous namespace)::ActiveMapRefreshTest>::RegisterTests() in active_map_refresh_test.cc.o
      testing::internal::RangeGenerator<int, int>::Iterator::Equals(testing::internal::ParamIteratorInterface<int> const&) const in active_map_test.cc.o
      testing::internal::ValuesInIteratorRangeGenerator<int>::Iterator::Equals(testing::internal::ParamIteratorInterface<int> const&) const in active_map_test.cc.o
      ...
  "std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)", referenced from:
      testing::internal::ParameterizedTestSuiteInfo<(anonymous namespace)::ActiveMapRefreshTest>* testing::internal::ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder<(anonymous namespace)::ActiveMapRefreshTest>(char const*, testing::internal::CodeLocation) in active_map_refresh_test.cc.o
      libvpx_test::EncoderTest::HandleDecodeResult(vpx_codec_err_t, libvpx_test::VideoSource const&, libvpx_test::Decoder*) in active_map_refresh_test.cc.o
      __ZN7testing18WithParamInterfaceISt5tupleIJPKN11libvpx_test12CodecFactoryENS2_8TestModeEiEEE8GetParamEv in active_map_refresh_test.cc.o
      libvpx_test::Encoder::Control(int, int) in active_map_refresh_test.cc.o
      libvpx_test::Encoder::Control(int, vpx_active_map*) in active_map_refresh_test.cc.o
      __ZN7testing8internal18CmpHelperOpFailureIP9vpx_imageDnEENS_15AssertionResultEPKcS6_RKT_RKT0_S6_ in active_map_refresh_test.cc.o
      testing::AssertionResult& testing::AssertionResult::operator<< <char const*>(char const* const&) in active_map_refresh_test.cc.o
      ...
  "std::ostream& std::ostream::_M_insert<void const*>(void const*)", referenced from:
      std::string testing::PrintToString<vpx_image*>(vpx_image* const&) in active_map_refresh_test.cc.o
      std::string testing::PrintToString<__sFILE*>(__sFILE* const&) in active_map_refresh_test.cc.o
      __ZN7testing8internal7PrintToIJPKN11libvpx_test12CodecFactoryENS2_8TestModeEiEEEvRKSt5tupleIJDpT_EEPSo in active_map_refresh_test.cc.o
      std::string testing::PrintToString<__sFILE*>(__sFILE* const&) in active_map_test.cc.o
      std::string testing::PrintToString<vpx_image*>(vpx_image* const&) in active_map_test.cc.o
      __ZN7testing8internal12PrintTupleToISt5tupleIJPKN11libvpx_test12CodecFactoryENS3_8TestModeEiiEELm4EEEvRKT_St17integral_constantImXT0_EEPSo in active_map_test.cc.o
      std::string testing::PrintToString<__sFILE*>(__sFILE* const&) in alt_ref_aq_segment_test.cc.o
      ...
  "std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long)", referenced from:
      __ZN12_GLOBAL__N_147gtest_VP9ActiveMapRefreshTest_EvalGenerateName_ERKN7testing13TestParamInfoISt5tupleIJPKN11libvpx_test12CodecFactoryENS3_8TestModeEiEEEE in active_map_refresh_test.cc.o
      __ZN12_GLOBAL__N_140gtest_VP9ActiveMapTest_EvalGenerateName_ERKN7testing13TestParamInfoISt5tupleIJPKN11libvpx_test12CodecFactoryENS3_8TestModeEiiEEEE in active_map_test.cc.o
      std::string testing::internal::FormatForComparisonFailureMessage<unsigned int, unsigned int>(unsigned int const&, unsigned int const&) in active_map_test.cc.o
      __ZN12_GLOBAL__N_146gtest_VP9AltRefAqSegmentTest_EvalGenerateName_ERKN7testing13TestParamInfoISt5tupleIJPKN11libvpx_test12CodecFactoryENS3_8TestModeEiEEEE in alt_ref_aq_segment_test.cc.o
      __ZN12_GLOBAL__N_137gtest_VP8AltRefTest_EvalGenerateName_ERKN7testing13TestParamInfoISt5tupleIJPKN11libvpx_test12CodecFactoryEiEEEE in altref_test.cc.o
      __ZN12_GLOBAL__N_151gtest_VP8AltRefForcedKeyTestLarge_EvalGenerateName_ERKN7testing13TestParamInfoISt5tupleIJPKN11libvpx_test12CodecFactoryENS3_8TestModeEiEEEE in altref_test.cc.o
      __ZN12_GLOBAL__N_151gtest_VP9AltRefForcedKeyTestLarge_EvalGenerateName_ERKN7testing13TestParamInfoISt5tupleIJPKN11libvpx_test12CodecFactoryENS3_8TestModeEiEEEE in altref_test.cc.o
      ...
  "std::ostream& std::ostream::_M_insert<double>(double)", referenced from:
      testing::AssertionResult testing::internal::CmpHelperOpFailure<double, int>(char const*, char const*, double const&, int const&, char const*) in cpu_speed_test.cc.o
      std::string testing::internal::FormatForComparisonFailureMessage<double, double>(double const&, double const&) in cq_test.cc.o
      std::string testing::internal::FormatForComparisonFailureMessage<double, double>(double const&, double const&) in error_resilience_test.cc.o
      testing::AssertionResult testing::internal::CmpHelperOpFailure<unsigned int, double>(char const*, char const*, unsigned int const&, double const&, char const*) in svc_datarate_test.cc.o
      testing::AssertionResult testing::internal::CmpHelperOpFailure<unsigned int, double>(char const*, char const*, unsigned int const&, double const&, char const*) in vp8_datarate_test.cc.o
      std::string testing::PrintToString<double>(double const&) in vp9_datarate_test.cc.o
      std::string testing::internal::FormatForComparisonFailureMessage<double, double>(double const&, double const&) in vp9_end_to_end_test.cc.o
      ...
  "std::ostream& std::ostream::_M_insert<long>(long)", referenced from:
      testing::AssertionResult testing::internal::CmpHelperEQFailure<long, int>(char const*, char const*, long const&, int const&) in decode_api_test.cc.o
      testing::AssertionResult testing::internal::CmpHelperEQFailure<long, int>(char const*, char const*, long const&, int const&) in encode_api_test.cc.o
  "std::ostream& std::ostream::_M_insert<long long>(long long)", referenced from:
      std::string testing::internal::FormatForComparisonFailureMessage<long long, long long>(long long const&, long long const&) in encode_test_driver.cc.o
      std::string testing::internal::FormatForComparisonFailureMessage<long long, long long>(long long const&, long long const&) in frame_size_tests.cc.o
      (anonymous namespace)::KeyframeTest_TestForceKeyframe_Test::TestBody() in keyframe_test.cc.o
      testing::AssertionResult testing::internal::CmpHelperEQFailure<int, long long>(char const*, char const*, int const&, long long const&) in keyframe_test.cc.o
      (anonymous namespace)::KeyframeTest_TestKeyframeMaxDistance_Test::TestBody() in keyframe_test.cc.o
      (anonymous namespace)::KeyframeTest_TestAutoKeyframe_Test::TestBody() in keyframe_test.cc.o
      (anonymous namespace)::ResizeInternalTest_TestInternalResizeWorks_Test::TestBody() in resize_test.cc.o
      ...
  "std::__throw_out_of_range_fmt(char const*, ...)", referenced from:
      (anonymous namespace)::ExternalFrameBufferMD5Test_ExtFBMD5Match_Test::TestBody() in external_frame_buffer_test.cc.o
      (anonymous namespace)::InvalidFileTest::RunTest() in invalid_file_test.cc.o
      (anonymous namespace)::TestVectorTest_MD5Match_Test::TestBody() in test_vector_test.cc.o
      __ZN7testing8internalL21FormatDeathTestOutputERKSs in libgtest.a(gtest-all.cc.o)
      testing::internal::SplitString(std::string const&, char, std::vector<std::string, std::allocator<std::string> >*) in libgtest.a(gtest-all.cc.o)
      testing::internal::UnitTestImpl::successful_test_suite_count() const in libgtest.a(gtest-all.cc.o)
      testing::internal::UnitTestImpl::successful_test_count() const in libgtest.a(gtest-all.cc.o)
      ...
  "std::chrono::_V2::steady_clock::now()", referenced from:
      testing::TestInfo::Run() in libgtest.a(gtest-all.cc.o)
      testing::TestSuite::Run() in libgtest.a(gtest-all.cc.o)
      testing::internal::UnitTestImpl::RunAllTests() in libgtest.a(gtest-all.cc.o)
  "std::chrono::_V2::system_clock::now()", referenced from:
      testing::internal::GetTimeInMillis() in libgtest.a(gtest-all.cc.o)
      testing::TestInfo::Run() in libgtest.a(gtest-all.cc.o)
      testing::TestSuite::Run() in libgtest.a(gtest-all.cc.o)
      testing::internal::UnitTestImpl::RunAllTests() in libgtest.a(gtest-all.cc.o)
  "std::_Hash_bytes(void const*, unsigned long, unsigned long)", referenced from:
      __ZNSt10_HashtableISsSsSaISsENSt8__detail9_IdentityESt8equal_toISsESt4hashISsENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb1ELb1ELb1EEEE9_M_insertISsNS1_10_AllocNodeISaINS1_10_Hash_nodeISsLb1EEEEEEEESt4pairINS1_14_Node_iteratorISsLb1ELb1EEEbEOT_RKT0_St17integral_constantIbLb1EE in libgtest.a(gtest-all.cc.o)
      std::_Hashtable<std::string, std::string, std::allocator<std::string>, std::__detail::_Identity, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::count(std::string const&) const in libgtest.a(gtest-all.cc.o)
  "std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned long, unsigned long) const", referenced from:
      std::_Hashtable<std::string, std::string, std::allocator<std::string>, std::__detail::_Identity, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::_M_insert_unique_node(unsigned long, unsigned long, std::__detail::_Hash_node<std::string, true>*) in libgtest.a(gtest-all.cc.o)
  "std::runtime_error::runtime_error(char const*)", referenced from:
      testing::UnitTest::AddTestPartResult(testing::TestPartResult::Type, char const*, int, std::string const&, std::string const&) in libgtest.a(gtest-all.cc.o)
      testing::internal::GoogleTestFailureException::GoogleTestFailureException(testing::TestPartResult const&) in libgtest.a(gtest-all.cc.o)
      testing::internal::GoogleTestFailureException::GoogleTestFailureException(testing::TestPartResult const&) in libgtest.a(gtest-all.cc.o)
  "std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)", referenced from:
      testing::internal::edit_distance::CreateUnifiedDiff(std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&, unsigned long) in libgtest.a(gtest-all.cc.o)
  "std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)", referenced from:
      testing::internal::edit_distance::CreateUnifiedDiff(std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&, unsigned long) in libgtest.a(gtest-all.cc.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

So that part can be fixed by modifying the patch like this:

$ git diff
diff --git a/multimedia/libvpx/Portfile b/multimedia/libvpx/Portfile
index 6c64d842b86..fd930add067 100644
--- a/multimedia/libvpx/Portfile
+++ b/multimedia/libvpx/Portfile
@@ -43,6 +43,11 @@ supported_archs     x86_64 i386 arm64 ppc ppc64
 patchfiles-append   patch-Makefile.diff
 patchfiles-append   patch-configure.sh.diff
 
+# requires c++11 https://trac.macports.org/ticket/67038
+compiler.cxx_standard 2011
+# requires MacPorts c++11 flags explicitly added to ldflags https://trac.macports.org/ticket/67038
+configure.ldflags-append {*}${configure.cxxflags}
+
 # Uses newer assembly features on Intel.
 # Also blacklist clang 8, due to issues like:
 #   error: use of undeclared identifier 'abs'

and then we're good:

$ port -v installed libvpx
The following ports are currently installed:
  libvpx @1.13.0_0 (active) requested_variants='' platform='darwin 9' archs='i386' date='2023-03-04T15:38:13-0800'

comment:4 Changed 21 months ago by kencu (Ken)

The existing Portfile blacklisting is for assembly issues and some other problems that could have been c++11 related:

# Uses newer assembly features on Intel.
# Also blacklist clang 8, due to issues like:
#   error: use of undeclared identifier 'abs'
compiler.blacklist-append  {*gcc-[3-4].*} {clang < 900} {macports-clang-3.*}

but as this complements but doesn't clash with the compiler.cxx_standard 2011 settings, it's best to just leave that in the Portfile.

comment:6 Changed 21 months ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In c76def02f731bfe689d3c4846bfe02dc1d5e5547/macports-ports (master):

libvpx: explicitly require c++11

and also ensure MacPorts c++11 flags make it to the link lines

closes: #67038

Note: See TracTickets for help on using tickets.