Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8154471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:21:49+00:00 2026-06-06T16:21:49+00:00

i am using openmp in fortran and before the program gets much done at

  • 0

i am using openmp in fortran and before the program gets much done at all, it runs into a segfault by simply trying to write to a line as seen below:

783       module Lines
784 
785       character*80 eline, dline
786 
787       contains
788 
789       subroutine InitializeLines
790       print*, 'writing to eline'
791       write(eline,'(1x,79(''#''))')
792       print*, 'writing to dline'
793       write(dline,'(1x,79(''-''))')
794       end subroutine InitializeLines
795 
796       end module Lines

in the main routine, when i try to call InitializeLines, it simply prints out writing to eline before giving me a segfault. Now, the program runs perfectly fine when i compile without -fopenmp. Note also, that there is only one thread active in this section (a simply get_num_threads() reveals that I am entering InitializeLines with only one thread). As soon as i take off -fopenmp, there is no segfault and the program executes correctly.

note also that i have a -DUSEOPENMP flag in my makefile for when i want to use openmp. if i have not defined that, then no openmp actions will take place. this is important because when i compile without -DUSEOPENMP, but with -fopenmp, i get the same segfault problem even though i am 100% sure i am not even calling any extra threads or using any part of openmp.

Now, with a bit of playing around i have found that this problem goes away when i take out the -static as a compilation option. my question is – why? why is it that -static and -fopenmp don’t work together and is it a problem that i can address in some other way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:21:51+00:00Added an answer on June 6, 2026 at 4:21 pm

    This is a glibc specific problem – static linking doesn’t play well with threaded programs, including OpenMP. There is a workaround though: force the linker to link the whole libpthread.a archive and not only the directly referenced symbols with -Wl,--whole-archive -lpthread -Wl,--no-whole-archive.

    Unless you have a really good reason to link system libraries statically, don’t do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to use OpenMP in my program (i am newbie using OpenMP)
I'm currently parallelizing program using openmp on a 4-core phenom2. However I noticed that
I am trying to parallelize my code using openmp. I have managed to parallelize
I am writing simple parallel program in C++ using OpenMP. I am working on
I have a serial application that I parallelized using OpenMP. I simply added the
I am writing a multi-threaded program using OpenMP in C++. At one point my
I'm trying to implement the distance matrix in parallel using openmp in which I
I'm getting the following errors trying to compile a project: (fortran, using gfortran) undefined
I am using openmp and my program looks like as follows: \#pragma omp parallel
I try to write simple application using OpenMP. Unfortunately I have problem with speedup.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.