Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static build broken #142

Closed
mbanck opened this issue Jan 12, 2023 · 4 comments · Fixed by #176
Closed

Static build broken #142

mbanck opened this issue Jan 12, 2023 · 4 comments · Fixed by #176

Comments

@mbanck
Copy link

mbanck commented Jan 12, 2023

Describe the bug

Is the static build (-DSTATIC_BUILD=ON) tested regularly? I just tried it and then the tests fails with segfaults:

1: 
1: Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
1: 
1: Backtrace for this error:
  1/118 Test   #9: compare_proteins .................***Failed    0.47 sec
Backtrace for this error:
#0  0x6d65b2 in ???
#1  0x6d5c15 in ???
#2  0x74e45f in ???
#3  0x0 in ???
In attempting to run:  ['/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/mopac', 'Compare_two_protein_structures.mop']
stdout:  None
stderr:  None
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/run_test.py", line 29, in <module>
    out_line, out_list = parse_mopac_out_file(out_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/tests/compare_output.py", line 61, in parse_mopac_out_file
    with open(path,'r') as file:
         ^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'Compare_two_protein_structures.out'
[...]
0% tests passed, 118 tests failed out of 118

To Reproduce

Configure CMake with DSTATIC_BUILD=ON and run CTest

Expected behavior

Tests pass.

Operating system

Debian unstable

@susilehtola
Copy link
Collaborator

Verified on Fedora.

@godotalgorithm
Copy link
Collaborator

The static build option was a contributed feature from mid-2022 (#35), and I have not been actively testing it as other aspects of the build system were modified. Code coverage of MOPAC is only at 67% at the moment, and while expanding coverage is a high priority in 2023, active coverage of this particular feature is a low priority relative to other, core features of MOPAC.

On my Mac, I'm getting BLAS/LAPACK linking errors that are preventing the static executable from being built at the moment. I'll look into fixing this. It's probably a quick fix, but sometimes this kind of problem can be stubborn to diagnose.

@godotalgorithm
Copy link
Collaborator

I've been looking into this some more. Fully static linking isn't possible on Mac because many system libraries are only available as shared libraries. Static linking seems to be possible on Linux, but you need to make sure all necessary static libraries are available (including low-level system libraries like libm & libc) and they are often not availably by default. I'm doing Linux development on an HPC system right now, and static versions of many libraries (including libm & libc) are not available to perform or test a static build.

Do CMake and Make also flag errors or warnings when you try to perform a static build?

I don't think static builds are a feature that can be expected to work "out of the box" for most people. I'm not sure there is anything for me to do here except perhaps to add a warning message about the requirements of a successful static build.

@godotalgorithm
Copy link
Collaborator

After a closer examination of this issue, I've determined that the most likely culprit in a failed static build is the OpenMP linking. I've added an extra warning message to the static build option that directs users to set THREADS_KEYWORD=OFF if their static build fails. I've also added a test of the static build to the routine CI process, and I can statically build MOPAC without any problems as long as OpenMP is off.

From a quick Google search, it seems like static linking of OpenMP is possible, but it ends up being very platform-specific. I'm fine with MOPAC having static build options, but getting a static build working with OpenMP is an extremely low priority for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants