Clang error unsupported option fopenmp

The "clang: error: unsupported option '-fopenmp'" could happen because clang doesn't support OpenMP on Mac. Read more to learn other causes of this error.

Why is clang error unsupported option ‘ fopenmpThe “clang: error: unsupported option ‘-fopenmp’” error can appear because the clang doesn’t support the -fopenmp flag and can be fixed by installing the latest versions of LLVM or clang. This article contains all the reasons for this error, solutions, and experts’ ideas. Keep reading to learn somelearnck techniques to get rid of this error.

Contents

  • Why Are You Getting the “Clang: Error: Unsupported Option ‘-Fopenmp’” Error?
    • – Clang Doesn’t Support OpenMP on Mac
    • – Linker Errors After Compilation
    • – Travis
    • – C++
    • – Sparseconvnet Build Error
    • – Chempy Library
  • How To Fix the Error
    • – Clang Doesn’t Support OpenMP on Mac
    • – Use OpenMP With Apple Clang and Homebrew Libomp
    • – Linker Errors After Compilation
    • – Travis
    • – C++
    • – SparseConvNet Build Error
    • – Chempy Library
  • FAQs
    • – What Is Openmp Support?
    • – How Does OpenMP Work?
    • – Example of Using OpenMP for C or C++ Language
    • – What Is Clang in Mac?
    • – How Does Clang Work?
  • Conclusion

Why Are You Getting the “Clang: Error: Unsupported Option ‘-Fopenmp’” Error?

– Clang Doesn’t Support OpenMP on Mac

If you are using Mac and facing the error “clang: error: unsupported option ‘-fopenmp,’” that is probably the provided default clang by Apple that doesn’t support Mac. You would get the error when you run the following:

Clang -fopenmp program_name.c. The error describes that your clang doesn’t support the -fopenmp flag.

– Linker Errors After Compilation

Sometimes the linker error also creates the same issues. After completing the compilation, you might see the linker error about missing the x86_64 symbol from the libomp library.

– Travis

This error can be received while deploying the project using OpenMP, you can get the ‘-fopenmp’ on Travis.

– C++

If you have multiple C++ files in your folder and run the C++ code in the terminal, you can get the “clang: error: unsupported option ‘-fopenmp’” error.

– Sparseconvnet Build Error

If you are getting this error while building SparseConvNet on Mac, this could be because your MacOS version of clang is not negatively supporting. Or changing the compiler version could also be the cause here. You can also get that error after running bash develop.sh on your terminal.

– Chempy Library

If you are working in Chempy library in Python, having the homebrew and GCC installed, and getting this issue, there could be two causes of this error.

The chempy is supported only on Linux, so it is possible that after working on your compilers, you are running neither on Mac nor on Windows. That could be one of the reasons you are getting that error.

You might not be using the correct Clang version from the Anaconda environment.

How To Fix the Error

– Clang Doesn’t Support OpenMP on Mac

If you are using Mac and getting the “clang: error: unsupported option ‘-fopenmp’” error, the cause is Apple-provided default clang doesn’t support Mac. So here, to avoid error, first of all, what you need to do is to install the latest version of LLVM, which might fix the problem.

If your problem is still not fixed, you should install the latest version of clang on your Mac that supports OpenMP by default and enable it. You need to install brew LLVM LIBOMP, but make sure that the clang version should be the latest one to compile with the -fopenmp flag.

As you download the LLVM, you have access to all the binaries in /usr/local/opt/llvm/bin. Then you should compile the OpenMP program. Put omp_ProgramNAme.c in a file and use the following extension:

/usr/local/opt/llvm/bin/clang -fopenmp -L/usr/local/opt/llvm/lib omp_ProgramName.c -o ProgramName

You might also need to set the “CPPFLAGS” with -I/usr/local/opt/llvm/include.

– Use OpenMP With Apple Clang and Homebrew Libomp

Another solution to that problem is to use the OpenMP with Apple clang and install brew libomp. You just need to replace a command like a clang -fopenmp test.c with clang -Xpreprocesssor -fopenmp test.c -lomp.

Here you might face problems in finding omp.h for inclusion. OMP is installed under /usr/local/Cellar/libomp/10.0.0/include symbolically linked to /usr/local/include. There could be any bug in the installation process, so if you are sure that you have successfully installed the libomp under Homebrew, you can ask about this issue on the Homebrew forum.

– Linker Errors After Compilation

After compilation, you should use the OpenMP with Apple clang if you have the linker error issue after compilation. For that, you need to follow a few steps as follows:

In the first step, you need to install LLVM with OpenMP and libomp with brew.

brew update

brew install llvm libomp

Then you need to add include and link directories in CMakeList.txt by using the following code:

include_directories(“/usr/local/include” “/usr/local/opt/llvm/include”)

link_directories(“/usr/local/lib” “/usr/local/opt/llvm/lib”)

Then you need to run CMake with the new compilers by the following code:

CMake -DCMAKE_C_COMPILER+”/usr/local/opt/llvm/bin/clang” -DCMAKE_CXX_COMPILER=”/usr/local/opt/llvm/bin/clang++” ..

This is how you can install the latest version of Clang.

You can also use brew –prefix llvm if you don’t want to assume /usr/local/opt/llvm.

– Travis

If you are working on Travis and getting the “clang: error: unsupported option ‘-fopenmp’” error, you should know that Apple’s LLVM doesn’t support -fopenmp. You should use brew’s LLVM. This is how you can link OpenMP

brew install llvm libomp

export CPP=/usr/local/opt/llvm/bin/clang;

– C++

If you are working on C++ code and getting the same error; first of all, what you need to do is to install the libomp with homebrew by using:

brew install libomp

And then you can compile an OpenMP with this:

clang -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.c -o main

You would also want the following:

Clang++ -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.cpp -o main

– SparseConvNet Build Error

If you are getting this error while building SparseConvNet on Mac, you should follow the same solution given above in this article in the “clang doesn’t support OpenMP on Mac” portion.

– Chempy Library

First of all, you need to install homebrew by using this:

/usr/local/bin/g++-10

Now you have to make sure what is installed and where it is installed using this:

brew ls gcc

Then, you can use the following to find the symlinked binaries that you should be using

Cs /usr/local/bin

ls -1 | grep gcc

First, you need to determine what compiler you want to use and then tell your build tool how to use it. Make sure you are using the correct package to use Hebrew.

To find out the different compilers, you can use the following methods:

  • CMake: CXX=/usr/local/bin/g++-10 cmake ..
  • Make: make CXX=/usr/local/bin/g++-10
  • Autconf: ./configure CXX=/usr/local/bin/g++-10

FAQs

– What Is Openmp Support?

OpenMP is not any software or a tool, it’s an API, or you can say that it is a set of directives for programs written in C, C++, or FORTRAN. The OpenMP stands for open source multi-processing. OpenMP is used for multi-threading. OpenMP finds out those blocks of codes that can run in parallel. OpenMP is also called a shared memory model and Fork-join model.

– How Does OpenMP Work?

It starts with one main thread in each process, so first of all, we create one main thread. That one main thread is called the master thread. Then at some part of the program, we require multip-threading, so we make multiple threads. All threads other than master threads are called slave threads.

Once slave threads have completed their work, they give their result back to their master thread. So again, our process is completed in a single thread. As these multiple threads share the memory of the primary process, and that is the reason the OpenMP is also called the shared memory model. The below example explains how you can use the OpenMP for C or C++ language.

– Example of Using OpenMP for C or C++ Language

First, we have to include a header file “omp.h”, so all the functions related to OpenMP have a defined “omp.h” header. Make sure to mention the preprocessor directive, and then you can create a simple statement in C or C++ language. Here is the preprocessor directive in “#pragma omp parallel.”

Now suppose we want to create multiple threads, but the question is, how many threads can be made? Well, the default number of threads created is equal to the number of processor cores. That means if you have i3, i5, or i7 processor, by default, it has four cores, and if a processor has four cores, the preprocessor directive statement will create four threads.

If we want to create, we need to add “num_threads(5)”. Here we assigned ‘5’ so five threads would be made. So here we have five threads, and all of them are in the form of that simple statement. All five threads will run simultaneously and do the same task.

– What Is Clang in Mac?

Clang is a compiler that is used in front-end development. It compiles the C, C++, Objective C++, and Objective C programming languages into machine codes. Clang is also used for frameworks like OpenMP, OpenCL, CUDA, HIP, and RenderScript.

For the back end, the Clang uses the LLVM compiler.

– How Does Clang Work?

The clang is designed to work like other compilers. There are three stages for the Clang to work.

The first stage is all about the front-end, where the compiler is used to parse source code. The compiler identifies errors and builds the AST to work as an input code. The second stage optimizes the generated AST. At the same time, the third stage is all about the back end. Here, the compiler generates the final code that the machine will execute.

Conclusion

Let’s conclude what we learned today:

  • There could be many causes of this problem but the important one is you clang would not be supporting OpenMP on Mac.
  • The latest LLVM and Clang version that supports OpenMP is essential to avoid this error.
  • Installing libomp with brew is a must case to solve this error.

Best way to fix clang error unsupported option ‘ fopenmpWe covered why the “clang: error: unsupported option ‘-fopenmp’” you are getting, and all the possible causes of that problem along with solutions. Now you can get rid of that error as you have this article, and you can find out the cause of your case and the respective solution.

  • Author
  • Recent Posts

Position is Everything

Position Is Everything: Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL.

Position is Everything

I am using Mac OS X Sierra, and I found that clang (LLVM version 8.1.0 (clang-802.0.38)) does not support OpenMP:
when I run clang -fopenmp program_name.c, I got the following error:

clang: error: unsupported option '-fopenmp'

It seems that clang does not support -fopenmp flag.

I could not find any openmp library in homebrew. According to LLVM website, LLVM already supports OpenMP. But I could not find a way to enable it during compiling.

Does this mean that the default clang in Mac does not support OpenMP?
Could you provide any suggestions?

(When I switch to GCC to compile the same program (gcc is installed using brew install gcc --without-multilib), and the compilation is successful.)

Bruno Grieder's user avatar

asked Apr 22, 2017 at 4:58

Starry's user avatar

5

  1. Try using Homebrew’s llvm:

    brew install llvm
    
  2. You then have all the llvm binaries in /usr/local/opt/llvm/bin.

    Compile the OpenMP Hello World program. Put omp_hello.c

    /******************************************************************************
         * FILE: omp_hello.c
         * DESCRIPTION:
         *   OpenMP Example - Hello World - C/C++ Version
         *   In this simple example, the master thread forks a parallel region.
         *   All threads in the team obtain their unique thread number and print it.
         *   The master thread only prints the total number of threads.  Two OpenMP
         *   library routines are used to obtain the number of threads and each
         *   thread's number.
         * AUTHOR: Blaise Barney  5/99
         * LAST REVISED: 04/06/05
         ******************************************************************************/
         #include <omp.h>
         #include <stdio.h>
         #include <stdlib.h>
    
         int main (int argc, char *argv[]) 
         {
         int nthreads, tid;
    
         /* Fork a team of threads giving them their own copies of variables */
         #pragma omp parallel private(nthreads, tid)
           {
    
           /* Obtain thread number */
           tid = omp_get_thread_num();
           printf("Hello World from thread = %dn", tid);
    
           /* Only master thread does this */
           if (tid == 0) 
             {
             nthreads = omp_get_num_threads();
             printf("Number of threads = %dn", nthreads);
             }
    
           }  /* All threads join master thread and disband */
    
         }
    

    in a file and use:

    /usr/local/opt/llvm/bin/clang -fopenmp -L/usr/local/opt/llvm/lib omp_hello.c -o hello
    

    You might also have to set the CPPFLAGS with -I/usr/local/opt/llvm/include.

    The makefile should look like this:

    CPP = /usr/local/opt/llvm/bin/clang
    CPPFLAGS = -I/usr/local/opt/llvm/include -fopenmp
    LDFLAGS = -L/usr/local/opt/llvm/lib
    
    omp_hello: omp_hello.c
         $(CPP) $(CPPFLAGS) $^ -o $@ $(LDFLAGS)
    

Update

In macOS 10.14 (Mojave) you might get an error like

/usr/local/Cellar/llvm/7.0.1/lib/clang/7.0.1/include/omp.h:118:13: fatal error: 'stdlib.h' file not found

If this happens, the macOS SDK headers are missing from /usr/include. They moved into the SDK itself with Xcode 10. Install the headers into /usr/include with

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

blkpingu's user avatar

blkpingu

1,4841 gold badge17 silver badges38 bronze badges

answered Feb 12, 2018 at 12:50

Dirk's user avatar

DirkDirk

2,31524 silver badges36 bronze badges

7

Other people have given one solution (using Homebrew llvm). You can also use OpenMP with Apple Clang and Homebrew libomp (brew install libomp). Just replace a command like clang -fopenmp test.c with clang -Xpreprocessor -fopenmp test.c -lomp.

answered Mar 6, 2020 at 13:20

Yongwei Wu's user avatar

Yongwei WuYongwei Wu

5,06636 silver badges48 bronze badges

3

MacOS Mojave with CMake

  1. Install LLVM with openmp and libomp with brew

     brew update
     brew install llvm libomp
    
  2. add include directories and link directories in CMakeList.txt

     include_directories("/usr/local/include" "/usr/local/opt/llvm/include")
     link_directories("/usr/local/lib" "/usr/local/opt/llvm/lib")
    
  3. run CMake with the new compilers

     cmake -DCMAKE_C_COMPILER="/usr/local/opt/llvm/bin/clang" -DCMAKE_CXX_COMPILER="/usr/local/opt/llvm/bin/clang++" ..
    

The clang version is 7.0.1 at time of writing

answered Feb 15, 2019 at 18:27

Bruno Grieder's user avatar

Bruno GriederBruno Grieder

27k8 gold badges67 silver badges99 bronze badges

6

Conda-Based Compilation Environment

Conda uses clang for OSX compilation (umbrella package cxx-compiler), but I hit similar issues with using llvm-openmp and the -fopenmp flag throwing errors. Solution is rather similar to other answers, but I am including here in case others have more exactly this issue.

Specific solution was to include the Conda environment’s include/ directory in the CFLAGS, namely:

CFLAGS="-I${CONDA_PREFIX}/include"

Note, I also needed to add -lstdc++ -Wl,-rpath ${CONDA_PREFIX}/lib -L${CONDA_PREFIX}/lib when linking, similar to this GitHub Issue.

answered Jul 21, 2020 at 3:53

merv's user avatar

mervmerv

61.6k11 gold badges174 silver badges233 bronze badges

Comments

@Yorko

@Yorko
Yorko

changed the title
unsupported option ‘-fopenmp’ on Mac OS X

[RESOLVED] unsupported option ‘-fopenmp’ on Mac OS X

Oct 17, 2016

guolinke

pushed a commit
that referenced
this issue

Nov 9, 2017

@wxchan

@guolinke

* add init_score & test cpp and python result consistency

* try fix common.h

* Fix tests (#3)

* update atof

* fix bug

* fix tests.

* fix bug

* fix dtypes

* fix categorical feature override

* fix protobuf on vs build (#1004)

* [optional] support protobuf

* fix windows/LightGBM.vcxproj

* add doc

* fix doc

* fix vs support (#2)

* fix vs support

* fix cmake

* fix #1012

* [python] add network config api  (#1019)

* add network

* update doc

* add float tolerance in bin finder.

* fix a bug

* update tests

* add double torelance on tree model

* fix tests

* simplify the double comparison

* fix lightsvm zero base

* move double tolerance to the bin finder.

* fix pylint

* clean test.sh

* add sklearn test

* remove underline

* clean codes

* set random_state=None

* add last line

* fix doc

* rename file

* try fix test

@lock
lock
bot

locked as resolved and limited conversation to collaborators

Apr 18, 2020

I had the same problem.

sudo apt install libomp-dev

Fixed it with Ubuntu 16.10

//test.c
#include "omp.h"
#include <stdio.h>

int main(void) {
  #pragma omp parallel
  printf("thread %dn", omp_get_thread_num());
}

Then

clang test.c -fopenmp
./a.out
thread 0
thread 5
thread 2
thread 1
thread 7
thread 3
thread 4
thread 6

Also

clant-3.9 test.c -fopenmp

works.


GCC and Clang use different OpenMP runtime libraries : libgomp and libomp respectivly.

Clang’s runtime is the LLVM OpenMP runtime which in turn is based on the Intel OpenMP runtime (which is open source).
https://www.openmprtl.org/

On my system GCC installed omp.h at

/usr/lib/gcc/x86_64-linux-gnu/6/include/omp.h

and libomp-dev insalled omp.h at

/usr/include/omp.h

These are different header files which include different function definitions. It may be okay to use either header file for e.g. omp_get_wtime() but in general I think it’s probably better to use the header file that corresponds to the runtime that is linked to.

Содержание

  1. clang: error: unsupported option ‘-fopenmp’ #16
  2. Comments
  3. clang: error: unsupported option ‘-fopenmp’ #64
  4. Comments
  5. error: unsupported option ‘-fopenmp’ #789
  6. Comments
  7. Footer
  8. clang: error: unsupported option ‘-fopenmp’ on Mac OS #3
  9. Comments

clang: error: unsupported option ‘-fopenmp’ #16

Hi, thanks for this great work.

I noticed it doesn’t compile on OSX (using clang), «make» gives these errors:

[dep] third-party/lodepng/lodepng.cc .
clang: error: unsupported option ‘-fopenmp’
[dep] stitch/warp.cc .
clang: error: unsupported option ‘-fopenmp’
[dep] stitch/transform_estimate.cc .
clang: error: unsupported option ‘-fopenmp’
[dep] stitch/stitcherbase.cc .
clang: error: unsupported option ‘-fopenmp’

Compiling with gcc on Ubuntu (and probably OSX if installed gcc) works ok.

Any ideas what to fix in the makefile for clang?

The text was updated successfully, but these errors were encountered:

Clang starts supporting openmp at some version. Works for me with clang on
Linux.

On Aug 3, 2016 11:00 AM, «Jouni Helminen» notifications@github.com wrote:

Hi, thanks for this great work.

I noticed it doesn’t compile on OSX (using clang), «make» gives these
errors:

[dep] third-party/lodepng/lodepng.cc .
clang: error: unsupported option ‘-fopenmp’
[dep] stitch/warp.cc .
clang: error: unsupported option ‘-fopenmp’
[dep] stitch/transform_estimate.cc .
clang: error: unsupported option ‘-fopenmp’
[dep] stitch/stitcherbase.cc .
clang: error: unsupported option ‘-fopenmp’

Compiling with gcc on Ubuntu (and probably OSX if installed gcc) works ok.

Any ideas what to fix in the makefile for clang?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#16, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABUTtVn4u_7-c7eMWOP1S0Fh7vXYZSHnks5qcNZMgaJpZM4Jb6Lp
.

From my dealings with it, the clang on OSX is an Apple-customized one one that doesn’t have OpenMP support. Changing the makefile or even the build system entirely (e.g. to cmake) doesn’t help at all. As you have suggested yourself, the only way you can get around this issue is to get another compiler (latest clang or gcc) as well as their associated libraries and then try building the project again.

Thanks @GitZChen ! I should add these to the readme.

You are right, latest clang should have OpenMP support, but doesn’t (yet) on MacOS. I installed Xcode 8 Beta 4 and it didn’t include any updates to clang/LLVM version (but perhaps MacOS Sierra will).

So after a bit of fiddling, here is how to successfully compile OpenPano on MacOS El Capitan:

  1. Install brew (http://brew.sh/)
  2. «brew install gcc —without-multilib» (grab a coffee, this takes quite a while — but needed because default brew installation of gcc doesn’t have OpenMP support)
  3. «export CXX=/usr/local/Cellar/gcc/6.1.0/bin/g++-6» (use the path from the output of brew gcc install. at the time of writing the above is correct, but may change. Do this or otherwise osx still uses clang to compile)
  4. «brew install eigen»
  5. run «make» in panorama /src — it compiles OK now

For 3, you can maybe try using «brew ls gcc» to list all installed components in the gcc formula then determine the path of g++ binary.

Also, in case anyone really wants to use clang instead of gcc, just substitute «gcc» with «llvm» and the path to «g++-6» with the path to the brew-installed «clang++» in the above instructions.

Though @jounih, don’t you still need libjpeg?

I am following this thread, and tried the method suggested by @jounih, compiling . However I got many of these errors:

/var/folders/5_/k6wvp3594651b83cz4f_f4n80000gn/T//cc2ALrIr.s:1205:no such instruction: vmovaps %xmm0, -160(%rbp)’ /var/folders/5_/k6wvp3594651b83cz4f_f4n80000gn/T//cc2ALrIr.s:1206:no such instruction: vmovaps %xmm1, -144(%rbp)’
/var/folders/5_/k6wvp3594651b83cz4f_f4n80000gn/T//cc2ALrIr.s:1207:no such instruction: vmovaps %xmm2, -128(%rbp)’ /var/folders/5_/k6wvp3594651b83cz4f_f4n80000gn/T//cc2ALrIr.s:1208:no such instruction: vmovaps %xmm3, -112(%rbp)’

Did a quick look on Google, and looks like it is related to AVX on OSX problem. I’ve tried several methods suggested but no luck. Have you ever encountered this issue?

My machine is an 2013 MBP with i5. I did a check and it does have AVX1.0.

Never encountered that problem before compiling GCC. Though isn’t this question off-topic for OpenPano? Maybe you’ll have better luck asking it on SO instead?

How can I perform step 5 of jounih ‘s comment?

I know this is a bit old, but just in case someone is still looking for the solution, I want to say that the solution given by @jounih fixed the same problem I had. Just make sure that you get the right path of ‘/usr/local/Cellar/gcc/6.1.0/bin/g++-6’ for the export. By the time of commenting, mine was «export CXX=»/usr/local/Cellar/gcc/7.2.0/bin/g++-7»

In jounih’s commented on Aug 4, 2016 •
In step 5 «run «make» in panorama /src — it compiles OK now»

what is panorama ? where is /src ?
When I run «make» , I get «make: *** No targets specified and no makefile found. Stop.»

what is above link referring to ?

Hello ppwwyyxx , I need to run step 5 as i stated above.
Sorry I am unable to following from link you gave. Could you please describe what should I do now ?

You are right, latest clang should have OpenMP support, but doesn’t (yet) on MacOS. I installed Xcode 8 Beta 4 and it didn’t include any updates to clang/LLVM version (but perhaps MacOS Sierra will).

So after a bit of fiddling, here is how to successfully compile OpenPano on MacOS El Capitan:

  1. Install brew (http://brew.sh/)
  2. «brew install gcc —without-multilib» (grab a coffee, this takes quite a while — but needed because default brew installation of gcc doesn’t have OpenMP support)
  3. «export CXX=/usr/local/Cellar/gcc/6.1.0/bin/g++-6» (use the path from the output of brew gcc install. at the time of writing the above is correct, but may change. Do this or otherwise osx still uses clang to compile)
  4. «brew install eigen»
  5. run «make» in panorama /src — it compiles OK now

Could you please help me run step 5 ? I did till 4. No clue about step 5 ?
I get below
«make: *** No targets specified and no makefile found. Stop.»
No clue where is «panorama /src» ?

@ppwwyyxx dude, I did all 5 steps but it still is returning the error «unsupported option -fopenmp» 🙁
I’ve reiinstalled the gcc and set the env variable but it is still returning the error

After runing «make -C src» this is the error:

Answering @tpsmahal step 5 can be executed with: «make -C src»

Источник

clang: error: unsupported option ‘-fopenmp’ #64

Upgraded to R 3.4.0, «You Stupid Darkness». When building on Mac I now receive:

clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o vcfR.so NM2winNM.o RcppExports.o ad_frequency.o extractGT2NM.o freq_peak.o gt_to_popsum.o is_het.o masplit.o pair_sort.o rank_variants.o seq_to_rects.o var_window.o vcfRCommon.o vcf_io.o -fopenmp -lgomp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
clang: error: unsupported option ‘-fopenmp’
make: *** [vcfR.so] Error 1
ERROR: compilation failed for package ‘vcfR’

The text was updated successfully, but these errors were encountered:

Note that it appears to be building at CRAN with 3.40, so this is likely specific to my system.

Hi Brian, I ran into a similar issue. If it helps, I’m posting the way I was able to fix it on my machine. If it doesn’t help, then feel free to ignore/delete this.

CRAN has updated to clang 4.0, which is not distributed for OSX. I downloaded clang from r.research.att.com/libs.

The instructions are to un-tar it to / , where it would install at /usr/local/clang4 . Because of the permissions issues in Sierra, I always got an error that it couldn’t modify /usr/ even though Apple says it’s okay to install things into /usr/local , so I un-tar’d it where it was, and moved the output from ./usr/local/clang4 to /usr/local/clang4 .

As suggested by CRAN, I then modified my

/.R/Makevars file to the following (as specified by CRAN):

The clang version sounds spot on! But now I’m generating a segmentation fault. I suspect it has something to do with the contents of my

/Makevars. Perhaps some quality time on writing R extensions will help me sort that out.

I reinstalled all of my packages and now I only have segmentation faults when I use devtools, but I can’t seem to figure out what’s triggering it. It is quite frustrating 😣

Do your segfaults look something like this by any chance

But I’m afraid its a bit mysterious to me. I want to believe it is compiling.

Well, I went scorched earth and removed most of my packages and re-installed them. From R:

And reinstall. Now vcfR magically builds and passes all tests. Zero points for elegance, but it worked. And for the record, my

.R/Makevars file now looks like:

And as a reminder, this is Mac (OSX) specific.

Источник

error: unsupported option ‘-fopenmp’ #789

«error: unsupported option ‘-fopenmp’»

When I try to install the package on the MacOS according to the guidance, it showed the following error.

c++ -g -O3 -std=c++11 -fopenmp -fsigned-char -D_FILE_OFFSET_BITS=64 -I./include -I./htslib -I./minimap2 -I./fast5/include -I./src -I./src/hmm -I./src/thirdparty -I./src/thirdparty/scrappie -I./src/common -I./src/alignment -I./src/pore_model -I./src/io -I./eigen/ -MM src/nanopolish_call_methylation.cpp src/nanopolish_call_variants.cpp src/nanopolish_extract.cpp src/nanopolish_getmodel.cpp src/nanopolish_haplotype.cpp src/nanopolish_index.cpp src/nanopolish_methyltrain.cpp src/nanopolish_phase_reads.cpp src/nanopolish_polya_estimator.cpp src/nanopolish_raw_loader.cpp src/nanopolish_read_db.cpp src/nanopolish_scorereads.cpp src/nanopolish_squiggle_read.cpp src/nanopolish_train_poremodel_from_basecalls.cpp src/nanopolish_variant_db.cpp src/nanopolish_vcf2fasta.cpp src/training_core.cpp src/hmm/nanopolish_duration_model.cpp src/hmm/nanopolish_profile_hmm.cpp src/hmm/nanopolish_profile_hmm_r7.cpp src/hmm/nanopolish_profile_hmm_r9.cpp src/hmm/nanopolish_transition_parameters.cpp src/common/fs_support.cpp src/common/logsum.cpp src/common/nanopolish_alphabet.cpp src/common/nanopolish_bam_processor.cpp src/common/nanopolish_bam_utils.cpp src/common/nanopolish_common.cpp src/common/nanopolish_iupac.cpp src/common/nanopolish_klcs.cpp src/common/nanopolish_variant.cpp src/alignment/nanopolish_alignment_db.cpp src/alignment/nanopolish_anchor.cpp src/alignment/nanopolish_eventalign.cpp src/pore_model/nanopolish_model_names.cpp src/pore_model/nanopolish_pore_model_set.cpp src/pore_model/nanopolish_poremodel.cpp src/io/nanopolish_fast5_io.cpp src/io/nanopolish_fast5_loader.cpp src/io/nanopolish_fast5_processor.cpp src/thirdparty/fet.c src/thirdparty/stdaln.c src/thirdparty/scrappie/event_detection.c src/thirdparty/scrappie/scrappie_common.c > ./.depend;
clang: warning: treating ‘c’ input as ‘c++’ when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating ‘c’ input as ‘c++’ when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating ‘c’ input as ‘c++’ when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating ‘c’ input as ‘c++’ when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
clang: error: unsupported option ‘-fopenmp’
make: *** [.depend] Error 1

I wonder what should I do with that? I am sorry since I am new to bioinformatics without any prior knowledge in computing.

Thank you very much for helping1

The text was updated successfully, but these errors were encountered:

See #279. This is usually a problem on the Mac, because the compiler that comes with it doesn’t have OpenMP enabled. You can use https://brew.sh (Homebrew) to install gcc.

brew install gcc

Then you can find all the versions of GCC you’ve installed

At the time of this comment this should be gcc-9 . So you need to compile with

make CXX=g++-9 CC=gcc-9

I see. Thank you very much for helping! The problem is solved!

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

clang: error: unsupported option ‘-fopenmp’ on Mac OS #3

I tried to run order «python setup.py build» on Mac OS 10.12.3, and got the error
clang: error: unsupported option ‘-fopenmp’

I tried export CC=/usr/bin/gcc, gcc-6, clang or llvm-gcc, they all don’t work.

for gcc-6 case, I got different error:
gcc-6: error: unrecognized command line option ‘-Wshorten-64-to-32’

Has anyone encountered the same issue?

The text was updated successfully, but these errors were encountered:

Yes I am facing the same issue. Any resolution found?

So far no good news. I chose to run pypoisson on a linux system, which separated my code into two parts.

Hope you good luck 🙂

I wanted it for R tool support. So I switched to lower version of R and resolved the issues.

I just ran into this problem, I will try to find a solution by my own. But if anyone got a solution in the meantime, I am interested 🙂

I just tried to install the package as well from a mac. I managed to install but am still not able to run the examples.

I have previously installed gcc and g++ with homebrew. Then, exporting and aliasing them, as
export CC=/usr/local/bin/gcc-8
export CXX=/usr/local/bin/g++-8
alias gcc=‘/usr/local/bin/gcc-8’
alias g++=‘/usr/local/bin/g++-8’

enables me to succesfully run

python setup.py build
python setup.py install

after modifying the first line of pypoisson.pyx,
#cython: language_level=3str
to
#cython: language_level=3

However, running python test.py halts to the error
Traceback (most recent call last):
File «test.py», line 1, in
from pypoisson import poisson_reconstruction
ImportError: dlopen(/anaconda3/lib/python3.6/site-packages/pypoisson.cpython-36m-darwin.so, 2): Symbol not found: _GOMP_parallel
Referenced from: /anaconda3/lib/python3.6/site-packages/pypoisson.cpython-36m-darwin.so
Expected in: flat namespace
in /anaconda3/lib/python3.6/site-packages/pypoisson.cpython-36m-darwin.so

and so far I haven’t been able to advance from here.
When it says this has been tried on OSX, I wonder how and what is the environment like?

Источник

Update 2019-07-16: this no longer works for me. I recommend you brew uninstall llvm, comment out the .R/Makevars lines and conda install llvm.

You can file this one under “I may have the very specific solution if you’re having exactly the same problem.”

So: if you’re running some R code and you see a warning like this:

Warning message:
In checkMatrixPackageVersion() : Package version inconsistency detected.
TMB was built with Matrix version 1.2.14
Current Matrix version is 1.2.15
Please re-install 'TMB' from source using 
install.packages('TMB', type = 'source') or ask CRAN for a binary 
version of 'TMB' matching CRAN's 'Matrix' package

And installation of TMB from source fails like this:

install.packages("TMB", type = "source")
clang: error: unsupported option '-fopenmp'
make: *** [external_metis.o] Error 1
ERROR: compilation failed for package ‘TMB’

And you use Homebrew – first, do this:

brew install llvm

Then create the file ~/.R/Makevars, if it does not exist and edit its contents to look like this:

CC=/usr/local/opt/llvm/bin/clang
CXX=/usr/local/opt/llvm/bin/clang++

Your R package should now compile without error. If it works as it did for me :)

Hi all,

I am having an installation error with opencarp where when I try to build using cmake I get the following error: 

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #5620f4}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; min-height: 13.0px}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #000000}
span.s3 {font-variant-ligatures: no-common-ligatures; color: #ca3323}

macbook-pro-82:openCARP sushruthmanchineella$ cmake —build _build

[ 10%] Built target param

[ 12%] Built target param-bin

[ 13%] Built target carp

[ 17%] Built target numerics

[ 19%] Built target fem

[ 68%] Built target limpet

[ 70%] Built target physics

[ 71%] Built target simulator

[ 71%] Built target opencarp-bin

[ 75%] Built target bench-bin

[ 76%] Built target igbutils_common

[ 78%] Built target igbapd-bin

[ 80%] Built target igbextract-bin

[ 82%] Built target muparser

[ 85%] Built target igbops-bin

[ 86%] Built target igbhead-bin

[ 87%] Built target mesher

[ 89%] Built target mesher-bin

[ 90%] Performing update step for ‘meshtool’

[ 90%] No patch step for ‘meshtool’

[ 90%] No configure step for ‘meshtool’

[ 91%] Performing build step for ‘meshtool’

* compiling: modes/clean_mode.cpp

* compiling: modes/convert_mode.cpp

* compiling: modes/collect_mode.cpp

* compiling: modes/extract_mode.cpp

* compiling: modes/generate_mode.cpp

* compiling: modes/interpolate_mode.cpp

* compiling: modes/insert_mode.cpp

* compiling: modes/itk_mode.cpp

clangclangclangclangclang: clangclang: : : : clang: : : errorerror: errorerror: : error: : error: error: error: unsupported option ‘-fopenmp’

unsupported option ‘-fopenmp’unsupported option ‘-fopenmp’unsupported option ‘-fopenmp’

unsupported option ‘-fopenmp’

unsupported option ‘-fopenmp’

unsupported option ‘-fopenmp’

unsupported option ‘-fopenmp’

make[4]: *** [modes/clean_mode.o] Error 1

make[4]: *** Waiting for unfinished jobs….

make[4]: *** [modes/collect_mode.o] Error 1

make[4]: *** [modes/extract_mode.o] Error 1

make[4]: *** [modes/generate_mode.o] Error 1

make[4]: *** [modes/insert_mode.o] Error 1

make[4]: *** [modes/interpolate_mode.o] Error 1

make[4]: *** [modes/itk_mode.o] Error 1

make[4]: *** [modes/convert_mode.o] Error 1

make[3]: *** [parbuild] Error 2

gmake[2]: *** [external/CMakeFiles/meshtool.dir/build.make:86: external/meshtool/src/meshtool-stamp/meshtool-build] Error 2

gmake[1]: *** [CMakeFiles/Makefile2:825: external/CMakeFiles/meshtool.dir/all] Error 2

gmake: *** [Makefile:156: all] Error 2

I am running python 3.8 and have also run brew install llvm as well as installed and linked g++. Please let me know if anyone knows how to correct this error.

You can file this one under “I may have the very specific solution if you’re having exactly the same problem.”

So: if you’re running some R code and you see a warning like this:

Warning message:
In checkMatrixPackageVersion() : Package version inconsistency detected.
TMB was built with Matrix version 1.2.14
Current Matrix version is 1.2.15
Please re-install 'TMB' from source using 
install.packages('TMB', type = 'source') or ask CRAN for a binary 
version of 'TMB' matching CRAN's 'Matrix' package

And installation of TMB from source fails like this:

install.packages("TMB", type = "source")

clang: error: unsupported option '-fopenmp'
make: *** [external_metis.o] Error 1
ERROR: compilation failed for package ‘TMB’

And you use Homebrew – first, do this:

brew install llvm

Then create the file ~/.R/Makevars, if it does not exist and edit its contents to look like this:

C=/usr/local/opt/llvm/bin/clang
CXX=/usr/local/opt/llvm/bin/clang++

Your R package should now compile without error. If it works as it did for me 🙂

Понравилась статья? Поделить с друзьями:
  • Clamav ошибка обновления
  • Clamav scanning error 8 init error
  • Clack ошибка 103
  • Clack ошибка 102
  • Clack ошибка 101