0

I am on a Mac but I am not a Mac user. I need to run a make command (actually make makewisdom) to compile a software, but my compiler does not recognize some commands:

$ make makewisdom
gcc -I/Users/username/presto/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include -I -I/opt/local/include -DUSEFFTW -DUSEMMAP -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -Wall -W -fPIC -O3 -ffast-math -Wno-unused-result -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -fopenmp -o makewisdom makewisdom.c -L/opt/local/lib -lfftw3f

clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [makewisdom] Error 1

I know the problem is with clang. I am reading lots of discussions (such this and this, and more), and trying to workaround the problem, but no luck yet. It maybe that I just need to set a different default compiler? (to, for example, gcc, whatever is the version I have installed):

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Py-ser
  • 1,860
  • 9
  • 32
  • 58
  • How does `cmake` tag relate to the problem? Note, that `make` and `cmake` are quite different things. – Tsyvarev Jul 17 '19 at 16:40
  • I am not expert on this, but I found it related through [this answer](https://stackoverflow.com/a/54715120/2107030). – Py-ser Jul 17 '19 at 16:41
  • How is that not clear? There is an error and I want to get rid of. If changing the compiler is a solution I'd like to be guided to do so because I have tried and did not succeeded. If it makes you feel better I can remove the `cmake` tag. – Py-ser Jul 17 '19 at 16:59
  • E.g. [that answer](https://stackoverflow.com/a/36211162/3440745) describes how to change the compiler. "I have tried and did not succeeded." - Please, describe (in the question post) what **exactly** have you tried and what have you got on that attempt. – Tsyvarev Jul 17 '19 at 17:15
  • I have copied and pasted the new env variables from those answers, but probably something in the path/compiler is different. What is my default compiler? What other compilers I have installed? How do I redefine those variables for my system? This is where I need help – Py-ser Jul 17 '19 at 17:21
  • You still haven't describe what **exactly** you are doing, so it is hard to guess what you are doing wrong... It could be that your Makefile (which you don't show to us) use **hardcoded** `gcc` as a compiler and doesn't refer to `CC` or `CXX` variables. So for use "real" `gcc` compiler you may execute the command line `gcc -I/Users/username/presto/include ...` with "gcc" replaced with that real gcc compiler. Or you may follow [that question](https://stackoverflow.com/questions/19535422/os-x-10-9-gcc-links-to-clang) for make `gcc` points to the real gcc compiler. – Tsyvarev Jul 17 '19 at 20:10
  • There is no make file in the directory where I call the `make makewisdom`, I suppose it will be created by the `make makewisdom` command. I am just blindly following some instructions to install a software, I do not know much about compilers, make, gcc, etc. – Py-ser Jul 17 '19 at 20:15
  • 1
    "I am just blindly following some instructions to install a software, I do not know much about compilers, make, gcc, etc." - And we know a little about your environment and scripts (like Makefile). How do you expect us to help you in this situation? – Tsyvarev Jul 17 '19 at 20:17
  • Experts can ask me the right questions to know the right answers. Most often, a few terminal commands can give all information you need. I will then edit the question to add relevant information. – Py-ser Jul 17 '19 at 20:25
  • Possible duplicate of [OpenMP Support in Xcode 5 and later](https://stackoverflow.com/questions/19208281/openmp-support-in-xcode-5-and-later) – l'L'l Jul 18 '19 at 04:53
  • @l'L'l, please can you show me how that can help me/which answer should I follow. From a first glance it does not really help (for example, I do not know to what "build settings" in [this answer](https://stackoverflow.com/a/55082102/2107030) refers to), also there is no accepted answer. – Py-ser Jul 18 '19 at 14:55
  • @Py-ser: The problem is the compiler version you are using. You’ll want to install a version of clang that supports `OpenMP`. I’m on mobile at the moment, so can’t tell you exactly which one you would need. Usually you can install an alternate version via `MacPorts` or `Homebrew` so that it doesn’t mess with the default Apple one. – l'L'l Jul 19 '19 at 01:44
  • @l'L'l, thank you. A link with some instructions would be great: I do not want to messy up things more than what they already are. – Py-ser Jul 19 '19 at 14:54
  • Use the `-Xpreprocessor` Flag to get apple clang to recognize openmp – Richard Barber Jul 19 '19 at 23:19
  • @RichardBarber, could you write the entire command? Maybe you can also post an answer with that. – Py-ser Jul 20 '19 at 01:57
  • @Py-ser try to add on the flag with an environment variable for instance, `CFLAGS="-Xpreprocessor" make makewisdom` – Richard Barber Jul 20 '19 at 03:33
  • @RichardBarber, it does not change a thing. – Py-ser Jul 23 '19 at 14:34
  • @Py-ser, did you ever find a solution to this problem? I am struggling right now with the same issue. – akaur Oct 10 '19 at 21:19
  • @Phyast10, nope... – Py-ser Oct 10 '19 at 21:21
  • hmm, is there a workaround about it? I am also using it in context of Presto. Please tag me, if you find a solution. I will look around and do the same. – akaur Oct 10 '19 at 21:29

0 Answers0