I am trying to make command "sudo port install py25-gtk" work. The problem is that (at least) one of the dependencies (gcc44) is not compiling.
I have figured out that it always tries to compile in x86_64 mode but everything else is compiled in i386 mode. Thus, libraries do not match.
I have tried to boot my mac into 64bit mode (various methods), but failed. Also, gmp (dependency of gcc44) does not have x86_64 available.
So my only option to satisfy gcc44 dependency in 32bit mode in macports. How do I do that? How can I force compilation in i368 when "+i386" option fails to do that? +universal fails (gmp does not have x86_64)? Can I download just sources? How do I compile them?
Everything has been tried with and without -f (force) and as root. The problem occurred when I upgraded from leopard (default=i386) to snow leopard (partly x86_64, partly i386).
br,
Juha
... 20 hours later... and after asking the right question:
How to force /usr/bin/gcc -> /usr/bin/gcc -m32?
To force compiler in 32bit mode:
hack the default compiler
- in my case: link /usr/bin/gcc-4.2 to gcc-4.2.sh
#!/bin/sh
/usr/bin/gcc-4.2 -m32 "$#"
br,
Juha
Related
I installed the gcc compiler via xcode-select --install but the version installed is 4.2.1 then it isn't possible to use the OpenMp flag -fopenmp for compile the source code.
I tried to install the compile via Homebrew and link this to the gcc exported but it doesn't work. I tried to install gcc building the latest GNU release but after building the operative system asked me if I would install gcc using xcode-select --install.
Moreover, I follow the answer to this question but I have this error:
Error: No available formula with the name "clang-omp"
Is there any solution or suggestion I can follow to execute the OpenMP code on my Mac and on any unix-like device without having to install particular dependencies because in this answer there is a solution but the user can install dependencies?
OpenMP code can be compiled with AppleClang on mojave. Xcode includes an openmp-aware preprocessor which must be invoked.
You must have an omp installed; libomp is the most common. I have also used libiomp5.
Adjust the flags in cmake to point to your openmp solution.:
cmake .. -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DOpenMP_C_FLAGS=-fopenmp=lomp -DOpenMP_CXX_FLAGS=-fopenmp=lomp -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" -DOpenMP_libiomp5_LIBRARY="/opt/local/lib/libomp.dylib" -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp /opt/local/lib/libomp.dylib -I/opt/local/include" -DOpenMP_CXX_LIB_NAMES="libomp" -DOpenMP_omp_LIBRARY=/opt/local/lib/libomp.dylib -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp /opt/local/lib/libomp.dylib -I/opt/local/include"
Similar flags for libiomp5: See this line.
Thanks to Richard answer, I was able to compile a project that uses OpenMP on Mojave. I'm adding this answer because some of his flags are currently wrong or useless.
-DOpenMP_C_LIB_NAMES "libomp"
-DOpenMP_CXX_LIB_NAMES "libomp"
-DOpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/include"
-DOpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/include"
-DOpenMP_omp_LIBRARY "/usr/local/lib/libomp.dylib"
-DOpenMP_libomp_LIBRARY "/usr/local/lib/libomp.dylib"
libomp was installed with brew install libomp.
I eventually want to use valgrind to find what is causing the occasional bizarre output in a C program which refines a model against experimental data using OpenMP parallel programming.
To avoid the use of the nominal gcc (ie clang) compiler, I used brew to install gcc-4.9 on my MacPro running Yosemite (OS x 10.10.5). However, when trying to compile my program with gcc-4.9, with or without -fopenmp, I get numerous error messages of the type:
/var/folders/qc/1j0gr_l48xnfd9001s6tt6f80000gn/T//ccRxnrnU.s:30597:suffix
or operands invalid for `movq'
I have no idea what the problem triggering these error messages is. Can anyone help?
The following summarises what was worked out in the comments section and did lead to the issue being resolved. Not all steps may be necessary, but most are probably good practice.
Step 1 - Clean up
If you have been trying lots of different, potentially incompatible, methods to get OpenMP set up, it is probably a good idea to clean them up first. So, something like:
brew rm --force gcc # or maybe gcc#4.9
Step 2 - Update Xcode and Command Line Tools
If you have upgraded macOS since installing Xcode, it is probably advisable to update Xcode and its "Command Line Tools"
Consider uninstalling and re-installing Xcode - it is available for free from the App Store.
Update/install the "Command Line Tools" after installing/updating with:
xcode-select --install
Step 3 - Install gcc
Now, try installing gcc afresh, ensuring that you use the --without-multilib option:
brew install gcc#4.9 --without-multilib
Hopefully you can now compile OpenMP code with:
/usr/local/bin/gcc -fopenmp program.c -o program
I am unsure exactly why the --without-multilib option is needed and prefer to quote #hristo-iliev:
Multilib usually refers to the coexistence of both 64-bit and 32-bit
versions of each library so that 32-bit software could be run on
64-bit OS. In the GCC case that probably refers to having all GCC
runtime libraries in "fat" Mach-O format, i.e. versions for both i386
and x86_64 in the same shared library file. It could be that libgomp
(the GNU OpenMP runtime library) cannot be built in such a way.
See this question.
Keywords: gcc, g++, GNU Compiler, OpenMP, fopenmp, -fopenmp, Xcode, multilib, Command Line Tools, macOS, OSX, homebrew, brew
I've been trying to install Ruby 2 on my machine running OSX 10.7 via rvm, but run into compilation issues no matter what I try.
So far, I've tried using the OSX GCC Installer, have reinstalled Xcode twice (tried the DMG first, then the App store), and have reinstalled the command line tools.
Compilation fails for both gcc and clang.
Here is what it is failing on (from ~/.rvm/src/ruby-2.0.0-p247/config.log):
configure:3776: checking whether the C compiler works
configure:3798: /usr/bin/clang --I/usr/local/opt/freetype/include -L/usr/local/opt/freetype/lib conftest.c >&5
clang: error: unsupported option '--I/usr/local/opt/freetype/include'
This causes ./configure to output checking whether the C compiler works... no.
As far as I can see, the correct syntax for the option should be -I, rather than --I - how can I get configure to use the correct option?
EDIT: Compiling from source without using rvm results in the same issue.
It turns out that my CPPFLAGS environment variable was the culprit.
Running CPPFLAGS='-I/usr/local/opt/freetype/include' rvm install ruby-2.0.0-p247 did the trick.
To get support I am installing fink on my MacBook Pro. After execute bootstrap script I am getting following error log
Checking package... looks good (fink-0.35.1).
Checking system... i386-apple-darwin12.4.0
This system is supported and tested.
Distribution: 10.8
Architecture: x86_64
Checking cc... not found.
ERROR: There is no C compiler on your system. Make sure that the Developer
Tools are installed.
I didn't find gcc in /usr/bin/ directory.
After reading here, I am guessing x-code provide default support for gcc compiler.
any one have idea what I should to get support of fink or if have any other way to get support of apt-get.
First, you need to install Xcode and its command line tools to get the gcc compiler
Make sure that you have working version of gcc in your /usr/bin directory
Create a symbolic link cc from installed gcc in /usr/bin
Is it possible to use the stock (non-apple) version of g++ on Mac OSX 10.7? I want to be able to use the stock g++ without running a virtual linux box on my mac. The reason I want to do this is because apple's version of g++ doesn't warn you when there are unused variables and etc. I'm doing some assessed C++ problems in my numerical methods course and I want to make sure I'm not making any mistakes.
It was suggested I make a symbolic link to a linux version of g++ for compiling the code for the assessments. How do I go about doing that?
Thanks
A linux version of the compiler will not work on what is (essentially) a bsd port.
Are you sure that the current version of g++ cannot warn on the conditions you expect?
Finally, if #2 is true, there is nothing stopping you from getting another version of g++ (compiled for MacOSX) that doesn't have this issue.
A binary for g++ for Linux won't run on MacOSX.
You could compile GCC from its source code; use the latest release i.e. 4.6.2. But that requires some work. Be sure to follow the installation instructions, in particular care about dependencies (like PPL & Cloog) and configure (appropriately) and compile in a build tree outside of the source tree.