Comments (1)
I was unfamiliar with this option so I looked it up:
Symbols from libraries linked as dependencies no longer resolved by ld
Previously, the
ld
linker resolved any symbols present in any linked library, even if some libraries were linked only implicitly as dependencies of other libraries. This allowed developers to use symbols from the implicitly linked libraries in application code and omit explicitly specifying these libraries for linking.For security reasons,
ld
has been changed to not resolve references to symbols in libraries linked implicitly as dependencies.As a result, linking with
ld
fails when application code attempts to use symbols from libraries not declared for linking and linked only implicitly as dependencies. To use symbols from libraries linked as dependencies, developers must explicitly link against these libraries as well.To restore the previous behavior of
ld
, use the-copy-dt-needed-entries
command-line option. (BZ#1292230)
I assume that ld
here means the GNU linker since the Apple linker doesn't seem to understand this flag. If the flag really is needed on non-Apple linkers, could you do a feature test—use the flag only if you detect that the linker supports it? (I would probably not use if(NOT APPLE)
for this in cmake since it is conceivable that a Mac user might try to compile with GCC and link with the GNU linker.)
I tried removing the flag which failed with undefined symbols at link time; here are the first few:
Undefined symbols for architecture x86_64:
"testing::InitGoogleTest(int*, char**)", referenced from:
_main in libgtest_main.a(gtest_main.cc.o)
"testing::AssertionSuccess()", referenced from:
testing::AssertionResult testing::internal::CmpHelperEQ<bool, bool>(char const*, char const*, bool const&, bool const&) in codepoint_test.cpp.o
testing::AssertionResult testing::internal::CmpHelperEQ<char const*, char const*>(char const*, char const*, char const* const&, char const* const&) in tstring_view_test.cpp.o
testing::AssertionResult testing::internal::CmpHelperEQ<int, unsigned long>(char const*, char const*, int const&, unsigned long const&) in tstring_view_test.cpp.o
testing::AssertionResult testing::internal::CmpHelperEQ<unsigned long, unsigned long>(char const*, char const*, unsigned long const&, unsigned long const&) in tstring_view_test.cpp.o
testing::AssertionResult testing::internal::CmpHelperEQ<char, char>(char const*, char const*, char const&, char const&) in tstring_view_test.cpp.o
testing::AssertionResult testing::internal::CmpHelperEQ<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in url_test.cpp.o
testing::AssertionResult testing::internal::CmpHelperEQ<bool, bool>(char const*, char const*, bool const&, bool const&) in url_path_test.cpp.o
...
"testing::Test::SetUp()", referenced from:
vtable for CSSTest_Url_Test in cssTest.cpp.o
vtable for CSSTest_LengthParse_Test in cssTest.cpp.o
vtable for CSSTest_ElementSelectorParse_Test in cssTest.cpp.o
vtable for MediaQueryTest_Check_Test in mediaQueryTest.cpp.o
vtable for CodepointTest_URLReserved_Test in codepoint_test.cpp.o
vtable for CodepointTest_URLScheme_Test in codepoint_test.cpp.o
vtable for TStringViewTest_DefaultConstructor_Test in tstring_view_test.cpp.o
...
"testing::Test::TearDown()", referenced from:
vtable for CSSTest_Url_Test in cssTest.cpp.o
vtable for CSSTest_LengthParse_Test in cssTest.cpp.o
vtable for CSSTest_ElementSelectorParse_Test in cssTest.cpp.o
vtable for MediaQueryTest_Check_Test in mediaQueryTest.cpp.o
vtable for CodepointTest_URLReserved_Test in codepoint_test.cpp.o
vtable for CodepointTest_URLScheme_Test in codepoint_test.cpp.o
vtable for TStringViewTest_DefaultConstructor_Test in tstring_view_test.cpp.o
...
This is because googletest in my distribution provides only static libraries which is because of google/googletest#3442.
Also linking with the gtest library fixed the problem for me:
--- CMakeLists.txt.orig 2023-05-13 16:46:25.000000000 -0500
+++ CMakeLists.txt 2023-06-19 01:30:19.000000000 -0500
@@ -179,7 +179,6 @@
option(EXTERNAL_GTEST "Use external GoogleTest instead of fetching from GitHub" OFF)
if (EXTERNAL_GTEST)
- link_libraries("-Wl,--copy-dt-needed-entries")
else()
include(FetchContent)
FetchContent_Declare(
@@ -217,6 +217,7 @@
target_link_libraries(
${TEST_NAME}
${PROJECT_NAME}
+ gtest
gtest_main
)
I only tested on macOS 12. I tested both with and without -DEXTERNAL_GTEST=ON
. Maybe someone can test on other systems.
Possibly the order of gtest
and gtest_main
needs to be reversed. I have heard that the GNU linker needs libraries in a specific order but the Apple linker doesn't seem to care so I haven't learned the GNU linker's rules.
from litehtml.
Related Issues (20)
- mis-selected line height for line breaks when styles are nested HOT 4
- default css length units should be "px", not "none" HOT 2
- Incorrect width of "Illinois's delegation(s)..." table on Obama wiki.
- CSS menu doesn't work on old unicode.org HOT 2
- Is this project active? HOT 2
- line-height issue
- bug in inline elements rendering
- issue with padding and background for nested inline elements
- float overlays table HOT 2
- tr bgcolor doesn't work HOT 1
- Most basic display flex example not working HOT 4
- why does test_container does pt_to_px the way it does? HOT 4
- render_test._/"acid1.htm" test fails on x86 architecture HOT 1
- litehtml 0.7/0.8 break qttools-6.5.0 HOT 13
- Build failure with external gtest 1.13.0 which requires C++14 HOT 2
- Error running test executable: Cannot read test directory HOT 2
- CSS background image path is invalid when a CSS is in a subdirectory HOT 1
- some compilers don't like casting void* to enum directly... HOT 1
- Integer underflow in litehtml::media_query::create_from_string(...) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from litehtml.