Installing SFML on CodeLite using Mac - c++

I am on a Mac using CodeLite for C++ and am trying to install the SFML library. I followed a tutorial (found here: https://en.sfml-dev.org/forums/index.php?topic=18820.0) and I get the following error after doing everything the tutorial say:
dyld: Library not loaded: #rpath/libsfml-graphics.2.5.dylib
Referenced from: /Users/willbur/Desktop/School/CompSci142/SFML-
Demo/Debug/SFML-Demo
Reason: image not found
Abort trap: 6
Does anyone know how to fix this? I copied all the .dylib files to the debug folder and I still get the error. The SFML version is the 2.5 MacOS Clang.
Thanks!

After running into this same issue I deleted my downloaded version of SFML and re-installed using Homebrew
brew install sfml
Homebrew will automatically put the sfml folders at:
/usr/local/Cellar/sfml/{installed_version_number}/
From here setup your project in the same manner as in the listed tutorial you followed except replacing the Compiler Include Paths with:
/usr/local/Cellar/sfml/{installed_version_number}/include
and the Linker Libraries search path with:
/usr/local/Cellar/sfml/{installed_version_numer}/lib
You can also follow along with this resource to get it setup: SFML with CodeLite on Mac OS

Related

Homebrew OS X OpenCV - looking for dylib when running on another Mac

I have a cross platform (Windows + Mac) application, built with QT and C++ libraries, which uses OpenCV. I had previously used an OpenCV version downloaded and compiled on the Mac, but decided to try to use the homebrew version to simplify installation on dev machines.
I did brew install opencv --with-contrib and brew link opencv, and managed to get the program to link and run with the libraries from /usr/local/lib.
Problem is, when I install it on another Mac, the program crashes when I try to run it, saying: Library not loaded: /usr/local/Cellar/ilmbase/2.2.1/lib/libIex-2_2.23.dylib.
I'm not sure what to do. I'm not a Mac expert, and certainly no Homebrew expert. Should I go back to compiling OpenCV myself, or can this be solved?
Thanks.
I faced same issue, but I solved it. homebrew installed latest opencv and dependencies. openexr and ilmbase also installed latest version. but opencv.jar refered specific version of library.(ex libIex-2_2.23.dylib)
So, you'd install ilmbase version 2.2.X. and than solve library issue.
https://github.com/Homebrew/homebrew-core/blob/master/Formula/ilmbase.rb
This link is ilmbase install Formula. You can ckeckout v.2.2 Formula commit.
And than uninstall & re-install ilmbase v.2.2.

Error deploying Qt application on OS X

I'm trying to deploy a Qt application on OS X using macdeployqt:
macdeployqt MyApplication.app -dmg
The application uses the Qwt library, which is being included in the PRO file as follows:
macx: QWT_ROOT = /usr/local/qwt-6.1.0
include ( $${QWT_ROOT}/features/qwt.prf )
When I run the macdeployqt command I get the following error message:
ERROR: no file at "/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
I'm not sure but it seems the deployment step is looking for the Qwt library on the wrong path, for example:
"/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
When it should be:
"/Library/Frameworks/qwt.framework/Versions/6/qwt"
How can I solve it?
I have uninstalled other qt versions using brew list, brew remove qt and brew remove qt5. I also noted that I had pyqt installed (and I was not using it), so I also remove it using brew remove pyqt.
Then, I have reinstalled Qt 5.3.2 and had other issues:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
Which was solved changing the isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))) command from the Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf file to isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))), as explained here: Qt Creator - Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild
and
Could not resolve SDK path for 'macosx10.8'
That was solved by changing the QtPath/5.3/clang_64/mkspecs/qdevice.pri from !host_build:QMAKE_MAC_SDK = macosx10.8 to !host_build:QMAKE_MAC_SDK = macosx10.12, as explained here: Error: Could not resolve SDK path for 'macosx10.8'
So, I run the command from my Qt directory:
/Users/kuser/Qt5.3.2/5.3/clang_64/bin/macdeployqt MyApplication.app -dmg
and it worked.
I found these solutions in comments from the following question:
Qt5 cannot find platform plugins Mac OS X
Note: this does not solve the macdeployqt error directly, but as it is part of the Qt installation, reinstalling it solved my problem.

Error installing opencv(3.1.0) on Mac OS X(10.11)

I installed opencv(3.1.0) on Mac OS X(10.11), but it gives me this error:
dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
Referenced from: /usr/local/lib/libopencv_highgui.2.4.dylib Reason:
Incompatible library version: libopencv_highgui.2.4.dylib requires
version 37.0.0 or later, but libpng16.16.dylib provides version 36.0.0
Does anyone know how to fix this?
How did you install opencv 3.1?
One thing that seems strange is that your post title says opencv 3.1, but the libraries that throw the error seem to be from version 2.4. Perhaps you had opencv2.4 and installed opencv3.1 on top of it? If you do have opencv 3.1 then you should make sure that xcode is looking for the opencv libraries in the right place, as that could be throwing things off.
With that said it seems like opencv is expecting a newer version of libpng than the one you have installed. Is it possible to update that library? If so, then maybe updating followed by a reinstall of opencv could fix it.
I'm not sure what version of libpng opencv3.1 expects, so I would make sure you're linking against the opencv3.1 libraries first.

How to install gtk on OSX for use with g++/gcc compiler

I already asked this question at apple.stackexchange.com, but I was told it was the wrong place for this question - so I will ask it here, as I was suggested to do.
At my university we got the task to implement a c-program which has a GTK-GUI. The GTK-GUI is already implemented, we just have to implement a algorithm which hands it some data.
I already got gcc/g++ working. But when i try to compile the project the compiler returns the error, that it does not find the gtk:
fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
^
So my question is:
How do I install gtk on OSX Mavericks for using it with gcc/g++ compiler?
My setup: MacBook Pro Retina Mid 2012 with OSX Mavericks. Homebrew is installed and working if it could be useful for the installation.
(Of course the Apple Command Line Developer Tools are installed)
I finally solved the Problem. tojanfoe suggested in a comment the link http://www.hardcoded.net/devlogs/20120426 which turned out to not be helpful.
This is how i solved it:
1.a) Installation of GTK+ 2.x:
brew install gtk+
1.b) Installation of GTK+ 3.x:
You can install gtk+ 3.x via home brew too if you need that, but the 2.x version is enough for my purposes. The command would be:
brew install gtk+3
2.)
But after the installation I had the problem, that cairo could not be found. So i solved it this way:
export PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.12.16/lib/pkgconfig/
3.)
Then the compiler said it could not find the package 'xcb-shm', required by 'cairo'. This can be solved this way:
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig
After this command the compiler worked as expected.
You can download precompiled Gtk2 Framework from: http://r.research.att.com
http://r.research.att.com/libs/GTK_2.24.17-X11.pkg,
or
http://r.research.att.com/libs/GTK_2.18.5-X11.pkg
And Gtk3 Framework from: http://www.tarnyko.net/dl/gtk.htm

XCode 4 & OpenCV Libraries

I've been googling and trying for days to solve my problem I had n luck, so I'm asking my first question here.
I have a MacBook with Lion (1.7.4), Xcode 4.
I need to work on a C++ application made with Leopard and Xcode 3.
The application comes with its own OpenCV.framework and is made for 32-bit Architecture (as u can see in Fig. 1)
I've tried to get it working on Xcode 3, and it works just fine, no need to install OpenCV or stuff (that is because the OpenCV.framework is included in the project, right?).
On Xcode 4 it's not working. That's what I've tried:
Run it "as is": even thought the OpenCV.framework is in the application directory, i get the following error:
dyld: Library not loaded:
#executable_path/../Frameworks/OpenCV.framework/Versions/A/OpenCV
Referenced from:
/Users/fabrizioborgia/Library/Developer/Xcode/DerivedData/suiviGUI-awhilvjpoqatfdansnpqcexpnxaw/Build/Products/Debug/suiviGUI.app/Contents/MacOS/suiviGUI
Reason: image not found
Remove the OpenCV.framework, install OpenCV via MacPorts and link the libraries. Nope, the libraries are 64-bit, and my program is 32. Removed OpenCV AND MacPorts.
Remove the OpenCV.framework, install 32-bit OpenCV via Homebrew (brew install opencv --build32) and link the libraries. Nope, i get the following error, so I assume that the libraries are STILL 64-bit. Right? Removed OpenCV AND Homebrew.
ld: warning: ignoring file
/usr/local/Cellar/opencv/2.4.1/lib/libopencv_calib3d.2.4.1.dylib, file
was built for unsupported file format which is not the architecture
being linked (i386)
Remove the OpenCV.framework, install OpenCV 2.4.1 by myself (with make and stuff) and link the libraries in the project. Nope, if i run the program on 32-bit arch it tells me that the libraries are not for 32-bit arch.
In any case, if I try to run it on 64-bit the compilation is successful but the program doesn't work properly.
Guys, really, I'm out of ideas, maybe I'm on the wrong direction, maybe I just have to find another OpenCV.framework or there is some linking setting that I'm missing, and the program doesn't see the framwork.
Anyone can help?
Solved the problem.
I applied some sort fo "divide et impera approach" and I asked a new question here on SO, you can find it here: 32-bit OpenCV on OS X Lion? Possible? and I found out that MacPorts AND Homebrew AND the Cmake Approach install by default the native architecture (64-bit in my case) OpenCV libraries, I needed the 32-bit, so i followed those steps:
Step 1: Download OpenCV 2.4.0
Step 2: Download and install CMake.
Step 3: Untar the OpenCV package.
Step 4: Make a separate directory inside the OpenCV package for building
mkdir build
cd build
cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=i386 -D CMAKE_C_FLAGS=-m32 -D CMAKE_CXX_FLAGS=-m32 ..
(this will force the 32-bit compile)
make -j8
sudo make install
Step 5: Link the brand-new libraries in the Xcode project using the "Link Binary to Libraries" build phase.
Step 6: Hit "Run" :)
I would suggest that you get OpenCV working (if not already) in Lion with XCode 4 (tutorial). Test it with the example in the linked tutorial. Once that works, then copy over the classes you need from the project that you can't get working.
In other words, abandon the older project and rebuild it from a working project base.