I am getting a link error on the Mac build of my FireBreath plugin looking like this:
Undefined symbols for architecture x86_64:
"_IOIteratorNext", referenced from:
MyFunction(...) in MyFile.o
Please help me solve this link error.
I have similar errors for "_IOObjectRelease", "_IORegistryEntryCreateCFProperty", "_IORegistryEntryGetParentEntry", "_IOServiceGetMatchingServices", "_IOServiceMatching", and "_kIOMasterPortDefault"
.
This leads me to believe that I need to include the Frameworks IOKIT and COREFOUNDATION.
I have concluded that these are the Frameworks that I need because I can temporarily get the build to succeed by adding them directly to Xcode like this:
- In the project navigator select the project.
- Select the target.
- Select the 'Build Phases' tab.
- Open 'Link Binaries With Libraries' expander (You may have to use
'Add Build Phase').
- Click the '+' button once to add each of the Frameworks.
After adding the Frameworks through Xcode, the build succeeds. However, once the prep script 'prepmac.sh' is run again, the Frameworks are lost and the build fails.
I have tried adding the Frameworks through FireBreath in several ways by editing PluginConfig.cmake and Mac/projectDef.cmake, and even considered modifying CMakeLists.txt, but this seems less promising.
I have tried the following statements in various combinations within the two .cmake
files, but I am not confident about where to put them:
find_library(IOKIT_FRAMEWORK IOKit)
message("Finding library IOKit: ${IOKIT_FRAMEWORK}")
find_library(COREFOUNDATION_FRAMEWORK CoreFoundation)
message("Finding library CoreFoundation: ${COREFOUNDATION_FRAMEWORK}")
target_link_libraries(${PROJECT_NAME}
${COREFOUNDATION_FRAMEWORK}
${IOKIT_FRAMEWORK}
${PLUGIN_INTERNAL_DEPS}
)
None of the changes seem to change the build log.
Of course I am generating the project between changes with "prepmac.sh", in which the new 'message' statements report:
Finding library IOKit: /System/Library/Frameworks/Cocoa.framework
Finding library CoreFoundation: /System/Library/Frameworks/CoreFoundation.framework
Solution:
Based on advice from taxilian the solution was both to correctly specify the correct Frameworks in Mac/projectDef.cmake and completely delete the build directory and remake it from scratch with the prepmac.sh script.