CMake No rule to make target - macos

I'm trying to build ORB_SLAM2 on macOS 11.4 with clang 12 and OpenCV4 and have run into this error:
make[2]: *** No rule to make target `/usr/lib/libz.dylib', needed by `../lib/libORB_SLAM2.dylib'. Stop.
This file does not exist on my Mac and I cannot add this symlink due to macOS's SIP. The correct path should be /usr/local/opt/zlib/lib/libz.dylib
How can I fix this /usr/lib/libz.dylib reference?
Here is my branch with my macOS build changes.
I've tried to fix the problem by:
Inspecting each of the project's direct dependencies with otool -L and rebuilt from source where necessary (such as OpenCV) to make sure /usr/lib/libz.dylib is not referenced (fix suggested here)
Using CMake's FindZLIB.cmake module in the ORB_SLAM2 CMakeLists.txt to ensure the correct ZLIB is found
Below is the output showing ZLIB is found but still no luck:
-- Found ZLIB: /usr/local/opt/zlib/lib/libz.dylib (found version "1.2.11")

Solved: I checked the CMakeFiles/Makefile.cmake and it showed me that the Pangolin library I was using was actually one from another project of mine. Building Pangolin in this project solved the issue.

Related

Linking libxml with MinGW using OMNETPP shell on windows 10

How can I link libxml on MinGW when using an omnetpp shell?
I am using omnetpp on a windows 10 machine.
My problem happens when I am trying to install the 3rd party package from here
I think that there is a problem in the Makefile failing to locate the libxml library
Following Rudi's answer (following the question) I changed the Makefile libxml path to I/mingw64/include/libxml2 but I still
get a undefined reference to 'xmlFunctionName' error (for many function names)
I tried to isolate the problem and to compile a sample of code from libxml2
Following the compilation guide: using gcc `xml2-config --cflags --libs` -o tree2 tree2.c
I got a fatal error: 'libxml/parser.h' file not found
When I replaced xml2-config --cflags --libs with -I/mingw64/include/libxml2
I got the same error as before undefined reference to 'xmlFunctionName'
what can I do to resolve that issue?
To this specific problem: libxml2 is actually already present as OMNET 5.x also uses it. All dependencies and tools are available in the tools/win64/mingw64 directory. The problem is that (for unknown reasons) the include file of the include/libxml2/libxml folder. The configure script correctly detects this and makes it available in the Makefile.inc as XML_CFLAGS= = -I/mingw64/include/libxml2
This must be added to the compiler flags for each file where you want to use the XML parser. (the library files are in the /mingw64/lib folder) so those are detected and can be used without additional config.
Generally, third party libraries should be available in the /mingw64/include and /mingw64/lib folders. You can either copy them manually there or try to install it with the mingw package manager (however that will most likely ruin your omnet installation as mingw64 is not particularly consistent and it is a rolling release - i.e. this is highly not recommended).

Linker complains about missing vtkCommon when using PCL

I try to get a pcl setup running on macOS 10.13.5 unsing homebrew.
I tried to install pcl with both techniques brew install pcl and brew install --build-from-source pcl
As dependencie vtk (8.1.1) is installed automatically and I can see that those libaries are installed in /usr/local.
But in the linking stage I get the following error:
ld: library not found for -lvtkCommon
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I check the list of installed libraries I can verify that there is not vtkCommon only a vtkCommonCore
In CMake I use the following lines to include PCL, the vtkCommon appears in the ${PCL_LIBRARIES} variable.
find_package(PCL REQUIRED COMPONENTS filters surface kdtree features segmentation)
list(APPEND include_directories ${PCL_INCLUDE_DIRS})
list(APPEND used_libraries ${PCL_LIBRARIES})
Does anyone know why this happens and how it can be solved?
As mentioned by #Tsyvarev the problem was that an a not match PCLConfig.cmake was existed alongside to the correct one, deleting that incorrect on solved the problem.

libcocos2d tvOS.a(bio_lib.o)' does not contain bitcode

When compiling cocos2d-js for AppleTV project I receive this error:
ld: '/Users/pepa/Library/Developer/Xcode/DerivedData/GameXY-gwkkxwmtiilmalhdxfdjgqdfhedy/Build/Products/Debug-appletvos/libcocos2d
tvOS.a(bio_lib.o)' does not contain bitcode. You must rebuild it with
bitcode enabled (Xcode setting ENABLE_BITCODE) or obtain an updated
library from the vendor for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I believe that I've included only libs built for AppleTV target with bitcode enabled. But the compiler is still complaining. Is the hint to tell which library miss the bitcode in the brackets? (bio_lib.o)
If so, would you know which library it belongs to? I did not find it on my computer.
I'm using the prebuilt binaries from here: https://github.com/elvman/cocos2d-x-3rd-party-libs-bin/tree/tvos
Use next steps:
Install git, make, autoconf, automake, libtool. If you are using Homebrew this can be done by:
brew install git make autoconf automake libtool
Clone repository:
git clone https://github.com/cocos2d/cocos2d-x-3rd-party-libs-src.git
Go to cocos2d-x-3rd-party-libs-src/build and change 2 lines in file tvos.ini:
cfg_build_release_mode="-O3 -DNDEBUG -fembed-bitcode"
cfg_build_debug_mode="-O0 -g -DDEBUG -fembed-bitcode"
Run build script:
build.sh -p=tvos --libs=curl --arch=arm64,x86_64 --mode=release
update libcurl.a crypto and ssl library
Ok for anyone coming here trying to build cocos2d-x (3.10) for iOS using Bitcode enabled. I did it, based on the answer of user1675169 ( https://stackoverflow.com/a/33969215/129202 ) but of course I replaced the os in the build.sh line, and I had to replace all of these one by one:
libtiff.a
libwebp.a
libchipmunk.a
libjpeg.a
libpng.a
libfreetype.a
It took me a while to replace each and everyone of these. Depending on what you use in your cocos2d-x project, you might need to replace other libraries as well. Probably in the end cocos2d-x 3.11 will be delivered with all of these libraries recompiled with bitcode enabled in the first place.
A recompile line could look like this:
build.sh -p=ios --libs=tiff --arch=arm64,x86_64 --mode=release
In the end I was able to precompile the whole libcocos2d with bitcode enabled. I haven't tried sending this to iTunes Connect yet but I guess it might actually work in the end.

error "missing separator" in build qwt-6.1

My environment:
QT: Qt_5_0_2
QWT: qwt-6.1-rc3
MinGW: mingw47_32
OS: win7_32
I follow the introduction file "INSTALL"'s step:
C) Win32/MinGW
Check that your Qt version has been built with MinGW - not with MSVC !
Start a Shell, where Qt4 is initialized. ( F.e. with
"Programs->Qt by Trolltech ...->Qt 4.x.x Command Prompt" ).
Check if you can execute "make" or something like "mingw32-make".
qmake qwt.pro
make
make install
I get the error in the step "make":
C:\qwt-6.1-rc3>qmake qwt.pro
C:\qwt-6.1-rc3>mingw32-make
cd src\ && ( if not exist Makefile E:\Qt\5.0.2\5.0.2\mingw47_32\bin\qmake.exe C:
\qwt-6.1-rc3\src\src.pro -o Makefile ) && mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'C:/qwt-6.1-rc3/src'
mingw32-make -f Makefile.Release all
mingw32-make[2]: Entering directory 'C:/qwt-6.1-rc3/src'
Makefile.Release:305: *** missing separator. Stop.
mingw32-make[2]: Leaving directory 'C:/qwt-6.1-rc3/src'
Makefile:40: recipe for target 'release-all' failed
mingw32-make[1]: *** [release-all] Error 2
mingw32-make[1]: Leaving directory 'C:/qwt-6.1-rc3/src'
makefile:44: recipe for target 'sub-src-make_first-ordered' failed
mingw32-make: *** [sub-src-make_first-ordered] Error 2
The lines 304,305 in "Makefile.Release" are:
304 qmake: FORCE
305 #$(QMAKE) -o Makefile.Release src.pro
Where is wrong?
thanks
Makefile.Release:305: *** missing separator. Stop.
This usually means this Makefile is not of the right format for mingw32-make;
Since the Makefile is generated by qmake, you should check the QMAKESPEC of your qmake. It should be win32-g++, not win32-mvsc.
This issue is strongly linked to the first warning of the qwt INSTALL note :
Check that your Qt version has been built with MinGW - not with MSVC !
Guess your broken Makefile is leftover from some earlier attempts - remove the Qwt build directory completely and start from scratch.
For loading the Qwt designer plugin in the Qt creator you need to have a version that is compatible with how the creator had been built. AFAIR the 5.0.2 mingw package contains a version 2.7.0 of the creator, that had been built for Qt 4.8 with MSVC ( see About->Qt creator ). If true it means you need to have 2 different builds of Qwt - one for your application, the other one for the designer plugin.
For the future I'm planning to offer precompiled versions of the designer plugin that are compatible with current binary packages of the Qt creator.
Also note that in SVN trunk the default settings for building the plugin have been changed since rc3: on windows the library is statically linked into the plugin and on better systems you have a similar effect with compiling in the install path of the library ( see RPATH ).
I had the same problem. The reason was that I wanted to prepare sources second time. I had sources in svn floder. I solved proble erasing folder and update sources again. After this operation I was able to run 'qmake proj.pro' correctly.

Compiling pulseaudio on Mac OS X with CoreServices.h

I'm trying to compile pulseaudio on Mac OS X, however by default I get lots of errors about not finding standard files like inttypes.h, errno.h or stdio.h. Putting -isystem/usr/include in CPPFLAGS fixes those errors, but then later on I get fatal error: 'CoreServices/CoreServices.h' file not found.
I've tried also adding -framework CoreServices and/or
-I/System/Library/Frameworks/CoreServices.framework/Headers but neither work.
What's the proper way of making the compiler find it?
I think I'm using clang, gcc produces even more errors.
You are on the right track, those are the framework and include flags but if you use the correct configuration options you will find even the system includes are picked up properly.
The Makefiles will attempt to set the framework appropriately based on the --with-mac-sysroot and --with-mac-version-min attributes.
Example configuration option to specify the SDK location:
--with-mac-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/
--with-mac-version-min=10.7
If you are building on Mountain lion (10.8) you still need to use the 10.7 minimum compatibility as there are headers missing in the 10.8 SDK which PulseAudio makes reference to.
You can pass the configure options to the autogen.sh which will run configure once autoconf has completed. You can try the following command which has been tested on the master branch:
./autogen.sh --prefix=/usr/local --disable-jack --disable-hal --disable-bluez --disable-avahi --with-mac-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/ --with-mac-version-min=10.7 --disable-dbus
If you get m4 macro errors copy the m4 macros from aclocal into the m4 sub-directory and try again.
There are a few other problems but these are bound to be cleared up may date quickly. Adding it here as it may help someone trying to get this built.
error: Multiprocessing.h cannot be found:
This has been deprecated in 10.7 but the headers are still included it CoreServices and will build just change the include instruction in the file src/pulsecore/semaphore-osx.c.
-#include <Multiprocessing.h>
+#include <CoreServices/CoreServices.h>
error: ‘lt_PROGRAM_LTX_preloaded_symbols’ undeclared.
This may be a problem compiling src/daemon/dumpmodules.c and can be fixed by declaring the external macro.
extern const lt_dlsymlist lt_preloaded_symbols[];
error: gdbm.h: No such file or directory
For some reason the default include dir is not considered by the compiler and you can add the path to the src/Makefile look for and set the variable GDBM_CFLAGS.
GDBM_CFLAGS=-I/usr/local/include
nJoy!

Resources