Skip to content

Static packages generation bug fix #3112

Merged
galabovaa merged 11 commits into
latestfrom
static-packages
Jun 30, 2026
Merged

Static packages generation bug fix #3112
galabovaa merged 11 commits into
latestfrom
static-packages

Conversation

@galabovaa

@galabovaa galabovaa commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Fix to the build of static release binaries.

Closes #3105 and #3117

added tests too 😅

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.15%. Comparing base (9713e3d) to head (37b8004).

Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #3112      +/-   ##
==========================================
- Coverage   73.15%   73.15%   -0.01%     
==========================================
  Files         430      430              
  Lines      103937   103937              
  Branches    16717    16717              
==========================================
- Hits        76039    76037       -2     
- Misses      27622    27624       +2     
  Partials      276      276              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jajhall jajhall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on this, so have to trust you

@mathgeekcoder mathgeekcoder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm assuming BUILD_STATIC_EXE is released as apache license (when HIPO=ON).

At some point we'll need to see why NO_AVX512 is necessary.

@galabovaa

Copy link
Copy Markdown
Contributor Author

BUILD_STATIC_EXE is used for both the apache and the MIT licenses. Should I set some other flags in CMake? Is this not OK for the extras?

For the MIT build, I get locally

[100%] Linking CXX executable ../bin/highs
/usr/bin/ld: ../lib/libhighs.a(HighsDynamicLibrary.cpp.o): in function `HighsDynamicLibrary::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
HighsDynamicLibrary.cpp:(.text+0x1a2): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
[100%] Built target highs-bin

This is the workflow:

eg this line was only necessary for the apache binaries

-DCMAKE_EXE_LINKER_FLAGS="-static -static-libgcc -static-libstdc++"

perpaps I should add it now to the MIT ones as well? Even with that I still get the warnings above

@mathgeekcoder

Copy link
Copy Markdown
Collaborator

BUILD_STATIC_EXE is used for both the apache and the MIT licenses. Should I set some other flags in CMake? Is this not OK for the extras?

Interesting. For BUILD_STATIC_EXE we probably want both BUILD_SHARED_LIBS=OFF and BUILD_SHARED_EXTRAS_LIB=OFF. This would be completely static and will never call dlopen, which is in line with the assumptions of the -static flag.

I've tested the BUILD_SHARED_LIBS=OFF and BUILD_SHARED_EXTRAS_LIB=ON, which I assume is the combination that -static doesn't like. If we want this combination, we can simply drop the -static flag and it'll be partially static.

@mathgeekcoder

Copy link
Copy Markdown
Collaborator

BUILD_STATIC_EXE is used for both the apache and the MIT licenses. Should I set some other flags in CMake? Is this not OK for the extras?

Ignore my previous comment. For BUILD_STATIC_EXE we already have both BUILD_SHARED_LIBS=OFF and BUILD_SHARED_EXTRAS_LIB=OFF.

The warning is for HighsDynamicLibrary::load, which won't be called, but is still compiled. I believe we can safely ignore this warning for now.

It might become relevant depending on how we support cuda etc. in the future.

@galabovaa

Copy link
Copy Markdown
Contributor Author

Yes, I think that is right! Optionally adding HighsDynamicLibrary to cmake seems to clear the warning: 63be509

If you are happy with this I can merge it to this branch, but I don't think it's essential

@galabovaa galabovaa merged commit 1c6e5a7 into latest Jun 30, 2026
495 checks passed
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 this pull request may close these issues.

3 participants