I'm trying to use libmediainfo in an Xcode project but I'm unable to get it to work properly.
I've added the dylib to the Frameworks folder of my project and made sure it is added to the "Link Binary with Libraries" section in the build settings of the target.
Every time I try to build the app it says:
dyld: Library not loaded: /usr/lib/libmediainfo.0.dylib
 Referenced from: ......
Checkout loader path: otool -L libmediainfo.dylib
If it has #loader_path, change it to #rpath with install_name_tool
install_name_tool -id #rpath/libmediainfo.dylib libmediainfo.dylib
Or, you can place the dylib in the MacOS folder and use #executable_path instead of #rpath.
Related
I am trying to get a project running that is using dynamic openCASCADE libraries.
So first i set up a minimal test project using the following CMake file:
...
include_directories(/home/user/occt/build_r/include/opencascade/)
add_executable(testOCCT
main.cpp
step2stl.cpp
)
find_package(OpenCASCADE REQUIRED NO_DEFAULT_PATH)
set(OCCT_LIBS TKMesh; TKSTEP; TKSTL; TKXSBase; TKernel)
target_link_libraries(testOCCT ${OCCT_LIBS})
This is working as it should.
Now i want to link the same libraries to another library that is used in a larger project.
For the project there are 3 CMake files, one for the project and two subdirectory, one for the executable one for the myLib, which are added by add_subdirectory().
In the CMake file for myLib which is inside one of the subdirectories I've added:
...
include_directories(/home/user/occt/build_r/include/opencascade/)
...
add_library(${MY_LIB_NAME} SHARED ${my_sources})
find_package(OpenCASCADE REQUIRED NO_DEFAULT_PATH)
set(OCCT_LIBS TKMesh; TKSTEP; TKSTL; TKXSBase; TKernel)
target_link_libraries(${MY_LIB_NAME} ${OCCT_LIBS})
so basically the same as in the test project.
However now I get an error (at runtime):
symbol lookup error: myLib.so: undefined symbol: _ZN24BRepMesh_IncrementalMeshC1ERK12TopoDS_Shapedbdb
Ok, so i found the problem myself. The reason it did not work was not because of CMake, but that there was some other version of the libraries installed over the packet manager, which then got loaded instead of the right one.
purging those libs solved the problem.
However what I still don't get is why it loaded the correct library version on the test project and the wrong on the other (both tested on the same machine)
My project (Objective C, macOS, Xcode 11) does not use CocoaPods and I'd like to keep it that way.
I want to use libxlsxwriter to export data in Excel format. I cloned libxlsxwriter from GitHub and built it. Now I have libxlsxwriter.a and lbixlsxwriter.dylib.
What I tried so far: I followed the instructions on this site (thanks for the link) to include the dylib. In the "General" settings lbixlsxwriter.dylib is shown as "Embed & Sign", in "Build Phases" it is listed under "Link Binary With Libraries" and it has its own "Copy Files" section. Running from Xcode gives me
dyld: Library not loaded: /usr/lib/libxlsxwriter.dylib
Referenced from: /Users/XXX/Library/Developer/Xcode/DerivedData/XXXefxsacdsioejobcumpvsbklqguri/Build/Products/Debug/XXX.app/Contents/MacOS/XXX
Reason: image not found
What do I have to add to my project: The include folder with all the header files and both of these libs? How do I have to adjust the General settings and Build Phases?
If you have static library and only one loader, eg. main executable, (so you don't need to share it between your components), then you don't need dynamic library at all.
Just add your libxlsxwriter.a into Target > General > Frameworks and Libraries section, and it will be linked in into your executable and just work.
If you really need shared dynamic library then you need to use rpath + LD_RUNPATH_SEARCH_PATHS combination. (Let me know if you need more details on this).
I'm trying to use the ffmpeg libraries in Xcode on Mac. I want to address to 64bit-systems like Lion and Mountain Lion. I tried to compile with
./configure --enable-static --enable-nonfree --enable-version3 --enable-gpl --disable-doc --disable-programs --arch=x86_64 --cc=cc --disable-yasm --host-cflags="-arch x86_64" --host-ldflags="-arch x86_64" --prefix=ffmpeg
Then I copied the ffmpeg-directory (with lib and include folders) into my project folder. I added the .a-files to my project and added the .a files to "Link binaries with Libraries"). Also I adjusted the header and library folder in the project settings. So far so good.
I'm a beginner with those libraries, so I started with opening a video. Works fine.
Now I'm trying to decode a given input file. Therefore I looked at this example file: http://ffmpeg.org/doxygen/1.0/decoding__encoding_8c-source.html
I copied the video_decode_example function. But at compiling I'm getting the following error:
Undefined symbols for architecture x86_64:
"_decode_write_frame", referenced from:
_video_decode_example in cutClass.o
ld: symbol(s) not found for architecture x86_64
What did I wrong at compiling ffmpeg?
decode_write_frame() is not part of ffmpeg — it's part of the sample code you were referring to. Read the sample code more closely and implement your own equivalent. (The implementation in the decoding_encoding.c sample is almost certainly not something you'd want in production code -- it just writes every frame to disk as a PGM image file.)
I want to use GData API in my project for iOS
I've followed official notes on how to add GData to project
Static library was built successfully, I've added references to it and headers folder
Than I put #import "GData.h into one of my source files and get following error while building project:libxml/tree.h : no such file or directory
In build settings - other linker flags I've specified -lxml2 (both for project and target)
In header search paths - /usr/include/libxml2 (no misspellings, I've checked), both for project and target. "${SDKROOT}/usr/include/libxml2" also didn't help
Still get the same errors
Mac OS 10.6.6, Xcode 4.0 Build 4A304a, iOS SDK 4.3
Try this: Project target-->Build Setting-->Header Search Path, Debug mode, ${BUILT_PRODUCTS_DIR}/Headers
Hello
I'm trying to write some tool using code::blocks, wxWidgets and libxml2 on Windows platform.
Things I've done:
copied libxml2.a, libxml2.dll.a and
other libs to MinGW lib/ folder
Wrote some headers like this in my
source file:
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
Added -lxml2 to linker
And now, when I'm trying to build this project I'm getting this error:
error: libxml/xmlmemory.h: No such file or directory
Anyone here experienced this error?
I believe that I misconfigured something but don't really know what.
Thanks for your ideas.
In general, it's better to not move things into the mingw directories, but to leave them in their own directories, and add search paths to the project properties so it knows where to look for them.
If you go into your project properties in Code::Blocks, hit the Project build options button, then inside the Linker Settings tab, add the two libraries you're linking against. Then In the Search directories tab, add the /include to compiler search locations, and optionally, add the /lib directory to Linker locations (This isn't necessary if you gave the full path to the .a in the linker settings.
Ok, I found the solution!
<libxml2/libxml/parser.h>
works perfectly