I've successfully built a cross-platform static library for OSX with the following steps:
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=OFF "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ..
cmake --build .
I have also mostly-successfully linked that library into my own project, but now am getting a slew of linker errors in XCode 5.1.1 about missing symbols:
Undefined symbols for architecture x86_64:
"_SSLClose", referenced from:
_stransport_close in libVAST.a(stransport_stream.c.o)
"_SSLCopyPeerTrust", referenced from:
_stransport_connect in libVAST.a(stransport_stream.c.o)
_stransport_certificate in libVAST.a(stransport_stream.c.o)
"_SSLCreateContext", referenced from:
_git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLHandshake", referenced from:
_stransport_connect in libVAST.a(stransport_stream.c.o)
"_SSLRead", referenced from:
_stransport_read in libVAST.a(stransport_stream.c.o)
"_SSLSetConnection", referenced from:
_git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetIOFuncs", referenced from:
_git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetPeerDomainName", referenced from:
_git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetProtocolVersionMax", referenced from:
_git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetProtocolVersionMin", referenced from:
_git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetSessionOption", referenced from:
_git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLWrite", referenced from:
_stransport_write in libVAST.a(stransport_stream.c.o)
"_SecCertificateCopyData", referenced from:
_stransport_certificate in libVAST.a(stransport_stream.c.o)
"_SecCopyErrorMessageString", referenced from:
_stransport_error in libVAST.a(stransport_stream.c.o)
"_SecTrustEvaluate", referenced from:
_stransport_connect in libVAST.a(stransport_stream.c.o)
" _SecTrustGetCertificateAtIndex", referenced from:
_stransport_certificate in libVAST.a(stransport_stream.c.o)
...
...
and on and on.
I imagine there's an extra step or dependency in there somewhere I'm missing, and I got a few hints that it's not entirely without precedent given this git-hub thread on rust, (https://github.com/rust-lang/cargo/issues/2295) but I'm not entirely sure how to proceed. Thoughts?
The most likely cause is an old version of OSX and libgit2. Some versions of libgit2 assume that the Security framework on OSX/macOS always provides SecureTransport (the library providing the cryptographic/TLS symbols you are missing).
This is not the case for the older opearating systems. This was fixed in late 2015 and the fix is included in the v0.24 release series as well in v0.23.2.
Related
I am trying to build the pocl library on MacOS
System:
MBP 16" 2019
Intel i9, AMD Radeon 5500m
Mac OS 12.4
using bash, instead of zsh
llvm from home-brew, -version 14
I have the following in my .bash_profile to setup the build environment
export PATH=/usr/local/opt/llvm/bin:$PATH
export CC=clang
export CMAKE_C_COMPILER=clang
export CXX=clang++
export CMAKE_CXX_COMPILER=clang++
I go and clone the repo with git, cd into the source directory, mkdir build
Then in build/ run:
cmake .. -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF -DENABLE_ICD=OFF
The config seems to work and then when I run make everything builds, and gets to the end but then gives me the following error:
[100%] Linking C executable poclcc
clang-14: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
Undefined symbols for architecture x86_64:
"_clBuildProgram", referenced from:
_main in poclcc.c.o
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clCreateCommandQueue", referenced from:
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clCreateContext", referenced from:
_main in poclcc.c.o
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clCreateContextFromType", referenced from:
_poclu_create_any_context in libpoclu.a(misc.c.o)
"_clCreateProgramWithBinary", referenced from:
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clCreateProgramWithIL", referenced from:
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clCreateProgramWithSource", referenced from:
_main in poclcc.c.o
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clGetDeviceIDs", referenced from:
_main in poclcc.c.o
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clGetDeviceInfo", referenced from:
_main in poclcc.c.o
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clGetPlatformIDs", referenced from:
_main in poclcc.c.o
_poclu_create_any_context in libpoclu.a(misc.c.o)
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clGetProgramBuildInfo", referenced from:
_main in poclcc.c.o
_poclu_show_program_build_log in libpoclu.a(misc.c.o)
"_clGetProgramInfo", referenced from:
_main in poclcc.c.o
_poclu_show_program_build_log in libpoclu.a(misc.c.o)
"_clReleaseContext", referenced from:
_main in poclcc.c.o
"_clReleaseProgram", referenced from:
_main in poclcc.c.o
ld: symbol(s) not found for architecture x86_64
I checked and libOpenCL.dylib was successfully built in the pocl/build/lib/CL/ directory. Just as a check, I tried compiling clinfo with a direct link to this library and it gave me the same set of error messages shown above.
Running nm libOpenCL.dylib | grep clBuildProgram prints the following:
0000000000013850 t _clBuildProgram
So its in there, but it is a local text section symbol. I don't actually know what that means though, and if that means it should work, or should not work. I don't actually understand what the problem is here or why this linking is failing, or what to do about it. Looking for some guidance on that.
The meaning of the lower case t is that the symbols are local, i.e. not externally visible to linking programs. Upper case T would be externally visible.
POCL has a number of configuration options, not all of which are documented in the Build section of the docs. The VISIBILITY_HIDDEN option is on by default unless the ENABLE_PROXY option is on.
In build/, running:
cmake .. -DENABLE_ICD=OFF -DVISIBILITY_HIDDEN=OFF
and then:
make
the compile succeeds to the end. Then in build/lib/CL/ running:
nm libOpenCL.dylib | grep clBuildProgram
now prints:
0000000000013790 T _clBuildProgram
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 months ago.
Improve this question
I have included the library <GLUT/glut.h> and all my syntax is correct, yet I am receiving this error.
Undefined symbols for architecture arm64:
"_glBegin", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glClear", referenced from:
displayTriangle() in main.cpp.o
"_glClearColor", referenced from:
_main in main.cpp.o
"_glColor3f", referenced from:
drawTetrahedron(int) in main.cpp.o
"_glEnable", referenced from:
_main in main.cpp.o
"_glEnd", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glFlush", referenced from:
displayTriangle() in main.cpp.o
"_glLoadIdentity", referenced from:
displayTriangle() in main.cpp.o
"_glMatrixMode", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glOrtho", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glVertex3fv", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glViewport", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glutCreateWindow", referenced from:
_main in main.cpp.o
"_glutDisplayFunc", referenced from:
_main in main.cpp.o
"_glutInit", referenced from:
_main in main.cpp.o
"_glutInitDisplayMode", referenced from:
_main in main.cpp.o
"_glutInitWindowSize", referenced from:
_main in main.cpp.o
"_glutMainLoop", referenced from:
_main in main.cpp.o
"_glutPostRedisplay", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glutReshapeFunc", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
My cmakefile I feel like is my issue, but I have no idea where to begin.
Please provide more details like your relevant section of CMakeLists.txt for getting more info and getting quicker help from community.
Now, coming to the error logs, it seems you are cross-compiling the source files using a arm-based compilers.
The error message "ld: symbol(s) not found for architecture arm64" looks to me as a linker issue and you should be having the find_package() and linking calls in CMakeLists.txt for OpenGL.
So to start with , you should follow two steps initially and see if it solves your problem:
1. Make sure the CMake build system is pointing to correct compiler tool chain path (arm compilers in here).
Refer official website of CMake for same:
https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html
2. Make sure you are linking OpenGL
find_package(OpenGL REQUIRED)
target_include_directories(your_executable_name PUBLIC ${OPENGL_INCLUDE_DIR})
target_link_libraries(your_executable_name PUBLIC ${OPENGL_LIBRARIES})
I am trying to make a C application on OSX(10.9.5) which will connect to mongodb and perform CRUD operations. I am using the release 1.3.5 which I downloaded from: https://github.com/mongodb/mongo-c-driver/releases/tag/1.3.5
I was sucessfully able to install mongo on my system. I am making my application which will use the library to perform CRUD operations. I am using Xcode 6.1.1 as my IDEon osx. I have given the appropriate path for header files in the ide and have no warnings or error before the run. I have given search path for dynamic libraries as well so I think linking should be happening fine as well. However when I try to run I get the following error:
Undefined symbols for architecture x86_64:
"_bson_as_json", referenced from:
_main in find.o "_bson_destroy", referenced from:
_main in find.o "_bson_free", referenced from:
_main in find.o "_bson_new", referenced from:
_main in find.o "_mongoc_cleanup", referenced from:
_main in find.o "_mongoc_client_destroy", referenced from:
_main in find.o "_mongoc_client_get_collection", referenced from:
_main in find.o "_mongoc_client_new", referenced from:
_main in find.o "_mongoc_collection_destroy", referenced from:
_main in find.o "_mongoc_collection_find", referenced from:
_main in find.o "_mongoc_cursor_destroy", referenced from:
_main in find.o "_mongoc_cursor_next", referenced from:
_main in find.o "_mongoc_init", referenced from:
_main in find.o ld: symbol(s) not found for architecture x86_64 clang:error: linker command failed with exit code 1 (use -v to see invocation)
Where am I going wrong?
Looks like you've specified the dynamic library path for libmongoc-1.0.so but not the library it depends on, libbson-1.0.so. Both libraries were installed when you built the driver, so you should be able to specify an additional path and your program will link correctly.
When i compile my cocos2d-x V3 project in Xcode, it runs fine but on including AdMob framework, it displays following linker error.
I already have included "-ObjC" in "Other linker" section under Build Settings.
Undefined symbols for architecture armv7:
"_kCMTimeZero", referenced from:
-[GADVideoPlayer setAudioMixVolume:] in GoogleMobileAds(GADVideoPlayer.o)
"_CMTimeMakeWithSeconds", referenced from:
-[GADVideoPlayer seekToTime:] in GoogleMobileAds(GADVideoPlayer.o)
"_CMTimeGetSeconds", referenced from:
-[GADVideoPlayer notifyVideoPlayerWithTime:] in GoogleMobileAds(GADVideoPlayer.o)
-[GADVideoPlayer notifyVideoReadyToPlay] in GoogleMobileAds(GADVideoPlayer.o)
"_CMTimeMake", referenced from:
-[GADVideoPlayer observePlayer] in GoogleMobileAds(GADVideoPlayer.o)
"_OBJC_CLASS_$_EKEventEditViewController", referenced from:
objc-class-ref in GoogleMobileAds(GADOpener.o)
"_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
objc-class-ref in GoogleMobileAds(GADOpener.o)
"_SCNetworkReachabilityCreateWithAddress", referenced from:
l001 in GoogleMobileAds(GADGestureUtil.o)
"_OBJC_CLASS_$_MFMessageComposeViewController", referenced from:
objc-class-ref in GoogleMobileAds(GADDevice.o)
objc-class-ref in GoogleMobileAds(GADOpener.o)
"_SCNetworkReachabilitySetCallback", referenced from:
___35-[GADNetwork enableNetworkChecking]_block_invoke in GoogleMobileAds(GADNetwork.o)
"_SCNetworkReachabilityGetFlags", referenced from:
l001 in GoogleMobileAds(GADGestureUtil.o)
"_OBJC_CLASS_$_EKEventStore", referenced from:
objc-class-ref in GoogleMobileAds(GADSlot+MRAID.o)
objc-class-ref in GoogleMobileAds(GADOpener.o)
"_SCNetworkReachabilitySetDispatchQueue", referenced from:
___35-[GADNetwork enableNetworkChecking]_block_invoke in GoogleMobileAds(GADNetwork.o)
___36-[GADNetwork disableNetworkChecking]_block_invoke in GoogleMobileAds(GADNetwork.o)
"_OBJC_CLASS_$_EKEvent", referenced from:
objc-class-ref in GoogleMobileAds(GADOpener.o)
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in GoogleMobileAds(GADDevice.o)
objc-class-ref in GoogleMobileAds(GADInAppPurchaseTransactionReporter.o)
objc-class-ref in GoogleMobileAds(GADGestureIdUtil.o)
objc-class-ref in GoogleMobileAds(GADMAdURLAdapter.o)
"_SCNetworkReachabilityCreateWithName", referenced from:
___35-[GADNetwork enableNetworkChecking]_block_invoke in GoogleMobileAds(GADNetwork.o)
"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in GoogleMobileAds(GADDevice.o)
"_CTRadioAccessTechnologyDidChangeNotification", referenced from:
___48-[GADDevice enableRadioAccessTechnologyChecking]_block_invoke_2 in GoogleMobileAds(GADDevice.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ahh! finally solved it by adding the following frameworks in my project, in Link Binary With Libraries section under Build Phases in Xcode.
AdSupport
AudioToolbox
AVFoundation
CoreGraphics
CoreMedia
CoreTelephony
EventKit
EventKitUI
MessageUI
StoreKit
SystemConfiguration
I am trying to install zathura-pdf-poppler-0.2.5 on a Mac OS X running Yosemite. When I try and make, I get the following error:
LD pdf.so
Undefined symbols for architecture x86_64:
"_zathura_document_get_data", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_document_get_password", referenced from:
_pdf_document_open in document.o
"_zathura_document_get_path", referenced from:
_pdf_document_open in document.o
"_zathura_document_information_entry_list_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_information_entry_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_set_data", referenced from:
_pdf_document_open in document.o
_pdf_document_free in document.o
"_zathura_document_set_number_of_pages", referenced from:
_pdf_document_open in document.o
"_zathura_index_element_new", referenced from:
_pdf_document_index_generate in index.o
_build_index in index.o
"_zathura_link_free", referenced from:
_pdf_page_links_get in links.o
"_zathura_link_new", referenced from:
_poppler_link_to_zathura_link in utils.o
"_zathura_page_get_document", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_page_get_height", referenced from:
_pdf_page_links_get in links.o
_pdf_page_search_text in search.o
"_zathura_page_get_index", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_data", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_height", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_width", referenced from:
_pdf_page_init in page.o
"_zathura_plugin_add_mimetype", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_name", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_register_functions_function", referenced from:
_zathura_plugin_register in plugin.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: *** [pdf.so] Error 1
I have the following path set in $PKG_CONFIG_PATH:
/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10
Does anyone know how to fix the problem.
Many thanks
I don't know the exact reason that this happens, but I have applied a patch to makefiles and config.mk from MacPort. You can download them in plaintext and use patch Makefile < make.diff and patch config.mk < config.diff to apply the patch.
patch files
I had to change /usr/lib/zathura/pdf.dylib to /usr/lib/zathura/pdf.so after the make install in order to make zathura display pdf files.