monero-lws icon indicating copy to clipboard operation
monero-lws copied to clipboard

Clang build issue: Undefined symbols for architecture x86_64 _IOPSGetTimeRemainingEstimate

Open selsta opened this issue 4 years ago • 2 comments

Sorry for spamming issues, but after solving the first two issues and adding openssl include dir to INTERFACE_INCLUDE_DIRECTORIES I get the following:

[ 84%] Linking CXX executable monero-lws-admin
Undefined symbols for architecture x86_64:
  "_IOPSGetTimeRemainingEstimate", referenced from:
      cryptonote::miner::background_worker_thread() in libcryptonote_basic.a(miner.cpp.o)
      cryptonote::miner::on_battery_power() in libcryptonote_basic.a(miner.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/monero-lws-admin] Error 1
make[1]: *** [src/CMakeFiles/monero-lws-admin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

selsta avatar Sep 24 '20 23:09 selsta

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 665e29c..0a9283d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -151,6 +151,10 @@ foreach (LIB ${MONERO_LIBRARIES})
   unset(LIB_PATH CACHE)
 endforeach()
 
+if (APPLE)
+  list(APPEND IMPORTED_MONERO_LIBRARIES "-framework IOKit")
+endif()
+
 add_library(monero::libraries INTERFACE IMPORTED)
 set_property(TARGET monero::libraries PROPERTY
   INTERFACE_INCLUDE_DIRECTORIES

solves this for me, though I’m not sure if this is the right way to add this framework.

selsta avatar Oct 06 '20 18:10 selsta

This worked for me too.

LeoNero avatar Aug 09 '22 07:08 LeoNero