Skip to content

Fix building of statically linked binaries + MSVC workflow#225

Draft
kratz00 wants to merge 1 commit into
twogood:mainfrom
kratz00:static
Draft

Fix building of statically linked binaries + MSVC workflow#225
kratz00 wants to merge 1 commit into
twogood:mainfrom
kratz00:static

Conversation

@kratz00
Copy link
Copy Markdown
Contributor

@kratz00 kratz00 commented Mar 29, 2026

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/shared_install /home/kratz00/coding/unshield

+-- bin
|   +-- unshield
+-- include
|   +-- libunshield.h
+-- lib
|   +-- cmake
|   |   +-- unshield
|   |       +-- unshieldConfig.cmake
|   |       +-- unshieldConfig-release.cmake
|   +-- libunshield.so -> libunshield.so.1
|   +-- libunshield.so.1 -> libunshield.so.1.6.2
|   +-- libunshield.so.1.6.2
|   +-- pkgconfig
|       +-- libunshield.pc
+-- share
    +-- man
        +-- man1
            +-- unshield.1

10 directories, 9 files


[kratz00@manjaro shared_install]$ file bin/unshield
bin/unshield: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b4ced08f59ad119549dcbe737fd455c2cdf803a1, for GNU/Linux 4.4.0, not stripped


cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/static_install -DBUILD_STATIC=ON /home/kratz00/coding/unshield

+-- bin
|   +-- unshield
+-- include
|   +-- libunshield.h
+-- lib
|   +-- cmake
|   |   +-- unshield
|   |       +-- unshieldConfig.cmake
|   |       +-- unshieldConfig-release.cmake
|   +-- libunshield.a
|   +-- pkgconfig
|       +-- libunshield.pc
+-- share
    +-- man
        +-- man1
            +-- unshield.1

10 directories, 7 files

[kratz00@manjaro static_install]$ file bin/unshield
bin/unshield: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=c0feeb9c364a36d17c919453bc7d8ac86c710e47, for GNU/Linux 4.4.0, not stripped
    

[kratz00@manjaro tmp]$ ls -lah *_install/bin/unshield
-rwxr-xr-x 1 kratz00 users  32K 29.03.2026 20:10 shared_install/bin/unshield
-rwxr-xr-x 1 kratz00 users 944K 29.03.2026 20:09 static_install/bin/unshield

@kratz00
Copy link
Copy Markdown
Contributor Author

kratz00 commented Mar 30, 2026

Looks like Apple does not support statically linked binaries: https://developer.apple.com/library/archive/qa/qa1118/_index.html
I will exclude that combination from the build matrix.

@kratz00 kratz00 force-pushed the static branch 5 times, most recently from a677a10 to 189bf36 Compare April 1, 2026 21:14
@twogood
Copy link
Copy Markdown
Owner

twogood commented Apr 2, 2026

If there are too many ifs and buts maybe just remove BUILD_STATIC?

@kratz00
Copy link
Copy Markdown
Contributor Author

kratz00 commented Apr 2, 2026

Where is the fun in that? I like a challenge and I am learning a lot of new things too.

@kratz00 kratz00 force-pushed the static branch 3 times, most recently from 80550b6 to 6fc3d72 Compare April 2, 2026 19:51
@kratz00
Copy link
Copy Markdown
Contributor Author

kratz00 commented Apr 2, 2026

Everything is building successfully and without warnings (as far as I could see in the logs).

  • the "shared" Windows builds (MINGW and MSVC) are not running, as the dll files are not found yet
  • the "static" Windows builds (MSVC) only have some crashing test case (does not happen on the other compiler/platform combinartions)
  • I had to comment the function call unshield_set_log_level(log_level); in unshield, because this symbol is not exported yet (seems to be related to the static int current_log_level)

I will continue after the holidays - Happy Easter holidays.

@kratz00 kratz00 changed the title Fix building of statically linked binaries. Fix building of statically linked binaries + MSVC workflow Apr 2, 2026
@kratz00 kratz00 force-pushed the static branch 7 times, most recently from 69db2c9 to 6c8d905 Compare April 8, 2026 15:01
@twogood
Copy link
Copy Markdown
Owner

twogood commented Apr 17, 2026

Great work and nice catch with unshield_set_log_level too!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b48a7064-4db7-4b02-a118-8952a6b3d64f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
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.

2 participants