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

link libgomp statically on glibc #679

Closed
wants to merge 5 commits into from
Closed

Conversation

DubbleClick
Copy link
Collaborator

What does this PR do?

gcc linking against glibc tries to link everything dynamically by default. with -l:libgomp.a we force it to link gomp statically.

@DubbleClick DubbleClick linked an issue Mar 27, 2025 that may be closed by this pull request
Copy link
Owner

@crazywhalecc crazywhalecc left a comment

Choose a reason for hiding this comment

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

I haven't tried it locally, but if it just for glibc build and your local test is good, no extra changes needed.

@DubbleClick
Copy link
Collaborator Author

Haven't tried frankenphp with it yet

@DubbleClick
Copy link
Collaborator Author

2025/03/27 09:39:37 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /go/src/app/dist/frankenphp-linux-x86_64 -buildmode=pie -tags cgo,netgo,osusergo,nobadger,nomysql,nopgx -ldflags -linkmode=external -extldflags '-pie' -w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP d3589f97706eac585cdafddbc059cdd53711faf9 PHP 8.4.5 Caddy'
# caddy
/usr/local/go/pkg/tool/linux_amd64/link: running /opt/rh/devtoolset-10/root/usr/bin/gcc failed: exit status 1
/opt/rh/devtoolset-10/root/usr/bin/gcc -m64 -s -Wl,-z,relro -pie -Wl,--build-id=0x6683f6e35cc6e38a8f9fd9d88804d17a0d92edfa -o $WORK/b001/exe/a.out -Wl,--export-dynamic-symbol=_cgo_panic -Wl,--export-dynamic-symbol=_cgo_topofstack -Wl,--export-dynamic-symbol=crosscall2 -Wl,--export-dynamic-symbol=go_apache_request_headers -Wl,--export-dynamic-symbol=go_frankenphp_after_script_execution -Wl,--export-dynamic-symbol=go_frankenphp_before_script_execution -Wl,--export-dynamic-symbol=go_frankenphp_finish_php_request -Wl,--export-dynamic-symbol=go_frankenphp_finish_worker_request -Wl,--export-dynamic-symbol=go_frankenphp_main_thread_is_ready -Wl,--export-dynamic-symbol=go_frankenphp_on_thread_shutdown -Wl,--export-dynamic-symbol=go_frankenphp_shutdown_main_thread -Wl,--export-dynamic-symbol=go_frankenphp_worker_handle_request_start -Wl,--export-dynamic-symbol=go_get_custom_php_ini -Wl,--export-dynamic-symbol=go_getenv -Wl,--export-dynamic-symbol=go_getfullenv -Wl,--export-dynamic-symbol=go_handle_file_watcher_event -Wl,--export-dynamic-symbol=go_is_context_done -Wl,--export-dynamic-symbol=go_log -Wl,--export-dynamic-symbol=go_putenv -Wl,--export-dynamic-symbol=go_read_cookies -Wl,--export-dynamic-symbol=go_read_post -Wl,--export-dynamic-symbol=go_register_variables -Wl,--export-dynamic-symbol=go_sapi_flush -Wl,--export-dynamic-symbol=go_ub_write -Wl,--export-dynamic-symbol=go_write_headers -Wl,--compress-debug-sections=zlib /tmp/go-link-509791397/go.o /tmp/go-link-509791397/000000.o /tmp/go-link-509791397/000001.o /tmp/go-link-509791397/000002.o /tmp/go-link-509791397/000003.o /tmp/go-link-509791397/000004.o /tmp/go-link-509791397/000005.o /tmp/go-link-509791397/000006.o /tmp/go-link-509791397/000007.o /tmp/go-link-509791397/000008.o /tmp/go-link-509791397/000009.o /tmp/go-link-509791397/000010.o /tmp/go-link-509791397/000011.o /tmp/go-link-509791397/000012.o /tmp/go-link-509791397/000013.o /tmp/go-link-509791397/000014.o /tmp/go-link-509791397/000015.o /tmp/go-link-509791397/000016.o /tmp/go-link-509791397/000017.o /tmp/go-link-509791397/000018.o /tmp/go-link-509791397/000019.o /tmp/go-link-509791397/000020.o /tmp/go-link-509791397/000021.o /tmp/go-link-509791397/000022.o /tmp/go-link-509791397/000023.o /tmp/go-link-509791397/000024.o /tmp/go-link-509791397/000025.o /tmp/go-link-509791397/000026.o /tmp/go-link-509791397/000027.o /tmp/go-link-509791397/000028.o /tmp/go-link-509791397/000029.o /tmp/go-link-509791397/000030.o /tmp/go-link-509791397/000031.o /tmp/go-link-509791397/000032.o -Wl,-O1 -pie -Wl,--allow-multiple-definition -Wl,--export-dynamic /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlicommon.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlienc.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlidec.a /go/src/app/dist/static-php-cli/buildroot/lib/libwatcher-c.a -L/go/src/app/dist/static-php-cli/buildroot/lib -Wl,--whole-archive -lphp -Wl,--no-whole-archive -lc -lyaml -ltidy -llz4 -lsqlite3 -lpq -lpgport -lpgcommon -lreadline -lonig -llber -lldap -lsodium -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -lzip -lheif -laom -lde265 -ltiff -lintl -lncurses -lgmp -lfreetype -ljpeg -lturbojpeg -lwebp -lwebpdecoder -lwebpdemux -lwebpmux -lsharpyuv -lavif -lpng16 -lcurl -lzstd -lnghttp2 -lxml2 -licui18n -licuio -licuuc -licudata -liconv -lcharset -lbrotlidec -lbrotlienc -lbrotlicommon -lssh2 -lssl -lcrypto -lz -lbz2 -l:libgomp.a -ldl -lpthread -lm -lresolv -lutil -lrt -lstdc++ -lresolv -L/usr/local/lib -L/usr/lib -lphp -ldl -lm -lutil -Wl,-O1 -pie -Wl,--allow-multiple-definition -Wl,--export-dynamic /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlicommon.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlienc.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlidec.a /go/src/app/dist/static-php-cli/buildroot/lib/libwatcher-c.a -L/go/src/app/dist/static-php-cli/buildroot/lib -Wl,--whole-archive -lphp -Wl,--no-whole-archive -lc -lyaml -ltidy -llz4 -lsqlite3 -lpq -lpgport -lpgcommon -lreadline -lonig -llber -lldap -lsodium -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -lzip -lheif -laom -lde265 -ltiff -lintl -lncurses -lgmp -lfreetype -ljpeg -lturbojpeg -lwebp -lwebpdecoder -lwebpdemux -lwebpmux -lsharpyuv -lavif -lpng16 -lcurl -lzstd -lnghttp2 -lxml2 -licui18n -licuio -licuuc -licudata -liconv -lcharset -lbrotlidec -lbrotlienc -lbrotlicommon -lssh2 -lssl -lcrypto -lz -lbz2 -l:libgomp.a -ldl -lpthread -lm -lresolv -lutil -lrt -lstdc++ -lbrotlicommon -lbrotlidec -lbrotlienc -Wl,-O1 -pie -Wl,--allow-multiple-definition -Wl,--export-dynamic /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlicommon.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlienc.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlidec.a /go/src/app/dist/static-php-cli/buildroot/lib/libwatcher-c.a -L/go/src/app/dist/static-php-cli/buildroot/lib -Wl,--whole-archive -lphp -Wl,--no-whole-archive -lc -lyaml -ltidy -llz4 -lsqlite3 -lpq -lpgport -lpgcommon -lreadline -lonig -llber -lldap -lsodium -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -lzip -lheif -laom -lde265 -ltiff -lintl -lncurses -lgmp -lfreetype -ljpeg -lturbojpeg -lwebp -lwebpdecoder -lwebpdemux -lwebpmux -lsharpyuv -lavif -lpng16 -lcurl -lzstd -lnghttp2 -lxml2 -licui18n -licuio -licuuc -licudata -liconv -lcharset -lbrotlidec -lbrotlienc -lbrotlicommon -lssh2 -lssl -lcrypto -lz -lbz2 -l:libgomp.a -ldl -lpthread -lm -lresolv -lutil -lrt -lstdc++ -lpthread -Wl,-O1 -pie -Wl,--allow-multiple-definition -Wl,--export-dynamic /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlicommon.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlienc.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlidec.a /go/src/app/dist/static-php-cli/buildroot/lib/libwatcher-c.a -L/go/src/app/dist/static-php-cli/buildroot/lib -Wl,--whole-archive -lphp -Wl,--no-whole-archive -lc -lyaml -ltidy -llz4 -lsqlite3 -lpq -lpgport -lpgcommon -lreadline -lonig -llber -lldap -lsodium -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -lzip -lheif -laom -lde265 -ltiff -lintl -lncurses -lgmp -lfreetype -ljpeg -lturbojpeg -lwebp -lwebpdecoder -lwebpdemux -lwebpmux -lsharpyuv -lavif -lpng16 -lcurl -lzstd -lnghttp2 -lxml2 -licui18n -licuio -licuuc -licudata -liconv -lcharset -lbrotlidec -lbrotlienc -lbrotlicommon -lssh2 -lssl -lcrypto -lz -lbz2 -l:libgomp.a -ldl -lpthread -lm -lresolv -lutil -lrt -lstdc++ -Wl,-O1 -pie -Wl,--allow-multiple-definition -Wl,--export-dynamic /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlicommon.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlienc.a /go/src/app/dist/static-php-cli/buildroot/lib/libbrotlidec.a /go/src/app/dist/static-php-cli/buildroot/lib/libwatcher-c.a -L/go/src/app/dist/static-php-cli/buildroot/lib -Wl,--whole-archive -lphp -Wl,--no-whole-archive -lc -lyaml -ltidy -llz4 -lsqlite3 -lpq -lpgport -lpgcommon -lreadline -lonig -llber -lldap -lsodium -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -lzip -lheif -laom -lde265 -ltiff -lintl -lncurses -lgmp -lfreetype -ljpeg -lturbojpeg -lwebp -lwebpdecoder -lwebpdemux -lwebpmux -lsharpyuv -lavif -lpng16 -lcurl -lzstd -lnghttp2 -lxml2 -licui18n -licuio -licuuc -licudata -liconv -lcharset -lbrotlidec -lbrotlienc -lbrotlicommon -lssh2 -lssl -lcrypto -lz -lbz2 -l:libgomp.a -ldl -lpthread -lm -lresolv -lutil -lrt -lstdc++ -lwatcher-c -lstdc++ -pie
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(critical.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(icv.o): relocation R_X86_64_32 against hidden symbol `gomp_global_icv' can not be used when making a PIE object
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(loop.o): relocation R_X86_64_32 against hidden symbol `gomp_global_icv' can not be used when making a PIE object
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(parallel.o): relocation R_X86_64_32 against hidden symbol `gomp_global_icv' can not be used when making a PIE object
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(task.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(team.o): relocation R_X86_64_32 against hidden symbol `gomp_global_icv' can not be used when making a PIE object
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(proc.o): relocation R_X86_64_32 against hidden symbol `gomp_global_icv' can not be used when making a PIE object
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(affinity.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(target.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(splay-tree.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(oacc-async.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(priority_queue.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(affinity-fmt.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(oacc-profiling.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(alloc.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(env.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(error.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(oacc-init.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/libgomp.a(oacc-host.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status

Looks like libgomp was not compiled with -fPIE on the rhel gcc 10 toolset?

@DubbleClick
Copy link
Collaborator Author

DubbleClick commented Mar 27, 2025

I won't have time to look further at this until some time next week. It works to create a non-PIE frankenphp, but that's not a great solution. We should find a way to link libgomp statically without removing -pie.

Can you look at this please?

FYI to test with the dockerfile you can

if [ "${os}" = "linux" ] && [ "${SPC_LIBC}" = "glibc" ]; then
        CGO_LDFLAGS="${CGO_LDFLAGS//-lgomp/-l:libgomp.a}" <-- new line here
	CGO_LDFLAGS="${CGO_LDFLAGS//-lphp/-Wl,--whole-archive -lphp -Wl,--no-whole-archive}"
	# shellcheck disable=SC2046
	ar d "${PWD}/buildroot/lib/libphp.a" $(ar t "${PWD}/buildroot/lib/libphp.a" | grep '\.a$')
fi

@crazywhalecc
Copy link
Owner

It's hard for me to find enough time to solve open source problems completely in two weeks. But I should be able to take a quick look at the current PR over the weekend.

@DubbleClick
Copy link
Collaborator Author

DubbleClick commented Mar 27, 2025

Okay no problem, @dunglas sorry, it may take a little bit until we can get rid of the dynamic -lgomp dependency. I've noticed that FrankenPHP generally links a lot of libraries dynamically that could be linked statically - libgcc.so, libstdc++.so, libgomp.so and more.

The php-cli we produce links them statically.

[root@localhost frankenphp]# ldd frankenphp
        linux-vdso.so.1 (0x00007ffd37ba6000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fa0b3800000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa0b3aae000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fa0b3aa3000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa0b3a9e000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fa0b3725000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fa0b3a8a000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007fa0b3a85000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fa0b3a7e000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fa0b3400000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fa0b3a64000)
[root@localhost static-php-cli]# ldd buildroot/bin/php
        not a dynamic executable
[root@localhost static-php-cli]# buildroot/bin/php -d "zend_extension=/opt/static-php-cli/buildroot/lib/xdebug.so" -v
PHP 8.4.5 (cli) (built: Mar 27 2025 06:19:22) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.4.5, Copyright (c) Zend Technologies
    with Xdebug v3.4.2, Copyright (c) 2002-2025, by Derick Rethans
    with Zend OPcache v8.4.5, Copyright (c), by Zend Technologies

I'm very surprised by the latter, to be honest. Does that mean it would run under alpine? Because it can load shared extensions lol. No it doesn't mean that, but it can run on systems without libgomp. We'll have to figure out why it fails to relocate for FrankenPHP but not for php-cli.

@dunglas
Copy link
Contributor

dunglas commented Mar 27, 2025

Thank you to both of you for working on this. Improvements are welcome as always!

@DubbleClick
Copy link
Collaborator Author

To be honest, I'm caught quite off guard that libgomp isn't available on ubuntu 22.04 on ARM. It's a part of gcc and gcc is installed, very weird that they decided to split that off. In the meantime you should maybe add a note to apt install libgomp1 for those affected. The other issue with illegal instructions doesn't seem related as I cannot reproduce it at all and it also happens for users with the musl version.

@crazywhalecc crazywhalecc added bug Something isn't working kind/dependency Issues related to dependencies os/linux Things only for Linux OS labels Mar 29, 2025
@crazywhalecc
Copy link
Owner

Do you think it's necessary to statically link libgcc and libstdc++ by the way?

@DubbleClick
Copy link
Collaborator Author

Not necessary as they were pre-installed on all distros I've tested, but generally preferable. This doesn't require us to change our code though, because there are -static-libgcc and -static-libstdc++ linker flags.

Copy link
Collaborator Author

@DubbleClick DubbleClick left a comment

Choose a reason for hiding this comment

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

I think this is a bug? If we compile with musl it'll report /usr/lib64/libgomp.a, but /usr/local/musl/x86_64-linux-musl/lib/libgomp.a should be used.

@DubbleClick
Copy link
Collaborator Author

Also is the system libgomp on the centos 7 container able to be linked against when creating a PIE object? The devtoolset-10 one seems to have been compiled without -fPIC -fPIE.

@crazywhalecc
Copy link
Owner

crazywhalecc commented Mar 29, 2025

Unfortunately, there is no devtoolset-11-gcc-* in aarch64 CentOS 7 vault website. The latest version we can easily install is 10.

Either we disable OpenMP support or compile another gcc like musl-toolchain.

@DubbleClick
Copy link
Collaborator Author

DubbleClick commented Mar 29, 2025

I'm not even sure if the 11 toolset was compiled with -fPIC. The 14 toolset was but that's also only available on RHEL 8

I'm not sure what the best course of action is here. We can either:

  • compile gcc ourselves, might be complex
  • find a precompiled PIC version on Centos 7 (unlikely?)
  • use a newer OS version and therefore bump up glibc requirement.
  • got rid of openmp by adding --with-imagick=... ac_has_omp_pause_resource_all=no or something like that

@DubbleClick
Copy link
Collaborator Author

Wait, I have a super stupid idea. Can you try linking against the libgomp from our musl toolset? I compiled that one with -fPIC.

@crazywhalecc
Copy link
Owner

Action 1 is similar to musl-toolchain. It's more like we just need to build GNU/gcc-10 in CentOS 7 and pack it for deployment.

Action 2 I haven't found any other alternative.

Action 3, I don't think it's a good option. According to most of the enterprises and individual users I work with, CentOS 7-level operating systems are still the main usage. And this is a sweet spot for building independent binaries. This may change in the future, but I don't think it is right now.

Action 4 is the easist option for us. Just assume nobody cares whether imagemagick openmp used.

Action 5 (link musl gomp) is really a stupid idea. I've tried it and got many undefined symbols in libgomp.a. Some of symbols are linking with musl libc related things.

@DubbleClick
Copy link
Collaborator Author

Action 3, I don't think it's a good option. According to most of the enterprises and individual users I work with, CentOS 7-level operating systems are still the main usage. And this is a sweet spot for building independent binaries. This may change in the future, but I don't think it is right now.

To be fair, the chance these companies would use imagick or FrankenPHP is close to zero.

Action 5 (link musl gomp) is really a stupid idea. I've tried it and got many undefined symbols in libgomp.a. Some of symbols are linking with musl libc related things.

Haha yeah I expected that, but there was a chance it only used weak references.

It's between 1) and 4). I think providing our own gcc toolset like we provide our own musl toolset is a good idea, but maybe it's not worth it just yet at this time.

Create a separate issue for that and try to disable openmp for now instead?

@crazywhalecc
Copy link
Owner

Create a separate issue for that and try to disable openmp for now instead?

So it looks like that's the way to go.

@crazywhalecc
Copy link
Owner

Ah I was confused by myself: #424

I fixed imagick openmp build bug 1 year ago.

@crazywhalecc crazywhalecc deleted the fix/llbgomp-static branch March 29, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kind/dependency Issues related to dependencies os/linux Things only for Linux OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libgomp dependency in imagick
3 participants