Xcode 4 Mavericks Creating Universal Binary for OSX hangs - c++

was it ever possbile to create a C++ command line tool as a fat binary in XCode (32bit and 64bit in one file)? I thought it was, but if I try it now, XCode hangs during "Creating Universal Binary."
I updated to OSX Mavericks and I am using XCode 4.6.2. It doesn't matter which compiler I choose. As soon as I set "Build Active Architecture Only" to false, the compiler hangs during "Creating Universal Binary".
Additionally I am building a static C++ library in my project which has no problems to be build for 32 and 64 bit in one file.
I hope you can help me.
Cheers
Georg

I had the same problem after updating to Mavericks. Both Xcode 4.6.3. and Xcode 3.2.6 were hanginig endlessly during "Creating Universal Binary."
As it's the lipo command line tool that's creating the universal binaries I did some research and found this discussion which solved my problems:
Installing psycopg2 has it stuck between xcrun and lipo
According to the answers given there Xcode apparently didn't find lipo in the end but unfortunately shows no error message in this case.
After backing up the 10.9 version of /usr/bin/lipo and linking in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo as described in the post creating the universal binaries was working again.

Related

Trying to build c++ for a remote arm device on QtCreator, executable is 64bit

I have a board with zynq chipset and Armv7 processor and Ubuntu 12.04. I want to remotely build and debug a c++ program on it with QtCreator.
I tried to create a kit for building the program using this link. added the compiler in the toolchains of board and added qt version 4.8.1 to the kit (version of qt on the board is 4.8.1).
The code builds successfully. the problem is the binary is not executable on my board because it seems it is a 64bit binary and my board is not 64bit.
Am I missing something?
how can I check if my config for compiling qt everywhere source was correct and it resulted in the qmake I wanted?
btw my own OS is Ubuntu 16.04 64bit.
The instruction on the Xilinx's page instruct how to build a cross compiler for ARM, however I belive they assumed you're going to follow these steps on 32-bit Linux platform. On the other hand -xplatform qws/linux-arm-gnueabi-g++ option should produce 32bit compiler.
Are you sure your code is build with right compiler build with right option? have you trie to build any minimal example from command line and check what file command is telling you about the binary produced? For me it looks like, do don't really cross-compile your project.
after hours and hours of searching and trying different things I found the reason. First of all as #michal-f said I installed 32-bit Ubuntu. making in terminal was resulting in ARM binary but QtCreator just compiled for intel proccessor.
as stupid as it seems the reason was that I did not know that Qt variables is not related to system variables and though I had added CROSS_COMPILE variable in terminal, I should have added it to my kit environmental variables too.
so the phrase ${CROSS_COMPILE}g++ in MakeFile was simply g++ and the output was a binary compile with system g++.
I know it was something I should have found sooner, but something this stupid should have been somewhere on internet for beginners like me. So hopefully next person encountering this same problem will find this post.

QT enable cross-compiling using MinGW (precompiled)

Good day all
I have been searching for a method of cross-compiling for QT-Creator in Linux for sometime now, and I have been having alot of trouble with it.
Background info
please note: I am on a Linux machine, and would like to cross compile Windows Apps
My system:
Ubuntu Gnome 16.10
QT Creator 4.0.2 (based on QT 5.7)
I have came across a few SO links, a few blogs with broken instructions, etc and one seeming helpful but dependencies could not be found.
I have also attempted another compiler MXE and cloned and attempted to build the MXE compiler from the GIT repo, which failed (no solution for the build error - VTK build error)
I decided to download precompiled MinGW compilers (i686 and x86_x64 versions) from sourceforge
Issue:
In QT Creator, adding the compiler is done without an issue, adding the "Kit" and selecting the newly added compiler, an red exclamation gives an error
The Compiler (x86_windows_msys_pe_64bit) cannot produce code for QT version 5.7.0 GCC 64Bit (x86_linux_generic_elf_64bit)
This occurs for both 32 + 64 bit compilers.
I think that you should have a QT version that matches your compiler ABI. The error tells you that the MinGW compiler doesn't match the Linux version of QT you have used. Therefore, get a windows version of QT and use it instead (just as you've added WinGW).
You can download Qt Binaries from here.

Stanford Engineering Everywhere CS106B C++ Libraries in XCode 4.6.2

Like many others, I'm taking the CS106B class on iTunes and, although the class is old, I am attempting to use the Stanford C++ libraries that are current. They are found here: http://www.stanford.edu/class/cs106b/.
During the Build Phase of projects, I have inserted into "Link Binary with Libraries" the files "random.h" and "libStanfordCPPlib.a". When I do this, I get the following error messages:
Check dependencies
warning: skipping file '/Users/lewis/Documents/Think Like a Programmer/CS106/VotingSimulation/../../../Programming Abstractions/Assignment 1/Assignment1-xcode/0 - Warmup/StanfordCPPLib/random.h' (unexpected file type 'sourcecode.c.h' in Frameworks & Libraries build phase)
ld: warning: ignoring file /Users/lewis/Documents/Programming Abstractions/Assignment 1/Assignment1-xcode/0 - Warmup/StanfordCPPLib/libStanfordCPPLib.a, file was built for archive which is not the architecture being linked (x86_64): /Users/lewis/Documents/Programming Abstractions/Assignment 1/Assignment1-xcode/0 - Warmup/StanfordCPPLib/libStanfordCPPLib.a
Undefined symbols for architecture x86_64:
"randomChance(double)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using Mac OS X 10.7.5 and XCode 4.6.2. I have set the Build Settings Base SDK to OS X 10.7 for both the Project and the Target.
It appears to me that the "libStanfordCPPlib.a" file may be an archive file that I have to unarchive before I can link the implementation code for the header files. Is this what I need to do, and if so, how do I do it? Am I doing something else wrong in linking the files?
I'm a noob and I'd appreciate help from anyone who has been successful in getting the current Stanford CS106B C++ libraries to work in XCode 4.6.2.
I just ran into this problem myself after upgrading to the newest version of xcode (ver. 5.0, OSX ver. 10.8.5).
Try switching the architecture of the project to 32-bit Intel (i386). The default is "Standard Architectures 64-bit Intel (x86_64)".
I'm currently using xcode 6.4 and trying to work through the cs 106b course work, I had the same issue of not being able to run the sample files and assignment files (can be found here btw http://web.stanford.edu/class/archive/cs/cs106b/cs106b.1136/ ). After changing the Architectures for both the Project and Target to 32-bit-intel as listed above I still received errors. I had to take the additional step of changing the OSX deployment target from 10.10 to 10.8 under the Project info.
This allowed the program to build but I received a notification that i needed to install the Java Runtime Environment, and there was no consult output. Installing this did not resolve the issue. I was only able to fully execute the code after installing the Java Development Kit. I am now able to compile all files for the course.
I hope this update helps more recent attempts to access this info.
I hope you've found an answer to your problem by now, but as I was suffering from a similar problem, trying to get xcode 5.1 to compile Warmup.cpp, I thought I'd post my solution for those others trying to get xcode to work with the cs106b libraries.
After struggling with xcode 5.1.1 and 5.0.2, I downloaded xcode 4.6.3 off of the apple dev site, www.developer.apple.com, and trashed the later versions. After installing 4.6.3, I still got errors, but after switching the Architecures for the Project and for the Target, to "32-bit-Intel", as messysaurus suggests, the warmupp.cpp compiled fine. Trying this same technique with xcode 5.1.1 and 5.0.2 yielded no results.
Hope this helps anyone else running into problems.

32-bit OpenCV on OS X Lion? Possible?

I've been googling and trying for days now, trying to figure out how to get 32-bit OpenCV working on OS X Lion, but can just find 64-bit version.
So i have the following questions:
OpenCV libraries come in 32-bit or 64-bit arch, is that correct?
How do I get 32-bit OpenCV working on Lion? I've trying the following ways:
- Install OpenCV via MacPorts: nope, MacPorts installs a 64-bit version.BI removed OpenCV and MacPorts.
Install OpenCV 2.4.1 via Homebrew, using the following command:
brew install opencv --build32
but looks like they are 64-bit too. Removed OpenCV and Homebrew.
Install OpenCV 2.4.1 by myself using standard unix makefiles. Nope, they still look like 64-bit.
I've written "they look like 64-bit" because i have to replace OpenC in a Xcode project made under OS X Snow Leopard, targeted for 32-bit Mac, and I always get tons of errors like:
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)
so i suppose that the OpenCV stuff is 64-bit. If i force the project to run in 64-bit, it rubs but doesn't work properly and gets stuck.
Is there a standard way to check if my OpenCV libraries are 64-bit or 32-bit?
Where can i get 32-bit OpenCV?
Solved the problem.
Recap: it is possible to have 32-bit OpenCV libraries on 64-bit Mac OSX Lion.
How?
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: Enjoy!
For forther reference please visit Mac OS X OpenCV Port Page
Thanks all for putting me on the right track:
#karlphilip: I tried to do as you suggested, but without the make options the compile phase fails, because the architectures are incoherent.
#hamstergene: MacPorts got stuck after the new installation, maybe I have some remains of the older install :( (strange, i followed the official instrusctions to remove it).
#Adrien: That's what I've done, but i had to merge 2 approaches :)
I ve had a hard time configuring OpenCv libraries on a number od different OSs. Turns out that the thing is auto-generating a sample project and then bulding business logic inside it.
See the installation instructions here
The web site of the OpenCV project has been significantly upgraded in the last year.
A new tutorial section is avaiable, i was able to install OpenCV on my 32-bit core Mac OS Lion.
A very cool tutorial is also available at Sadeep's Tech Blog, covering an interesting range of details.
Hope this helps!
Here's something you can try: download OpenCV 2.4 sources and edit the CMakeLists.txt in the root directory. Around line 242 you will see:
# ----------------------------------------------------------------------------
# Path for build/platform -specific headers
# ----------------------------------------------------------------------------
set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
add_definitions(-DHAVE_CVCONFIG_H)
ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
below the add_definitions() call, add this one:
add_definitions(-m32)

Qt + VTK + MAC version based compilation and execution

I have successfully Built and compiled VTK with Qt on Mac osx 10.6.7. Then according to the requirements I changed configuration in CMAKE so that the target version is 10.5. I compiled VTK with Qt again and it was successful, with cones tutorials examples running. But whenever i compile my own application which is built using QVTK Widget i got this error
"Check with the developer to make sure
Application works with this version of MacOS
X. You may need to reinstall the
application ..."
Following is my CMAKE Configuration
BUILD_EXAMPLES checked
BUILD_SHARED_LIBS checked
CMAKE_OSX_ARCHITECTURES x86_64
CMAKE_OSX_DEPLOYMENT_TARGET 10.5
CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk
VTK_USE_COCOA checked
VTK_USE_CARBON unchecked
VTK_USE_QT checked
VTK_USE_QVT_QTOPENGL checked
I have also ran following command on the terminal
export MACOSX_DEPLOYMENT_TARGET=10.5
Every thing in my application compiles with both QtCreator and XCode but does not execute by giving the error as mentioned above.
In the above if i change everything from 10.5 to 10.6 everything start working. But according to requirement i need to have it compatible with 10.5.
Can someone please let me know is there anything else i need to do? Am i missing something here?
Regards,
Rashid