When building the Julia 1.7.0-beta2 RPM package for Fedora, I set CFLAGS and LDFLAGS to the standard Fedora values, as required by distro policies. This makes the libblastrampoline build fail, as apparently it requires CFLAGS to include -fPIC and LDFLAGS to include -shared. These are included by default in Make.inc, but are lost when overriding the variables. Unfortunately, if adding these flags when calling make in Julia makes the build fail elsewhere (in libuv).
I think that libblastrampoline shouldn't rely on the user setting these flags. Instead, they should be added unconditionally, as they are absolutely required. For example, Julia uses the custom JCFLAGS variable which includes both -fPIC and $CFLAGS by default.
For reference, here's a simple reproducer:
$ LANG=C make CFLAGS="" LDFLAGS=""
cc -o build/libblastrampoline.so build/libblastrampoline.o build/dl_utils.o build/config.o build/autodetection.o build/threading.o build/deepbindless_surrogates.o build/trampolines/trampolines_x86_64.o build/f2c_adapters.o
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: build/dl_utils.o: in function `throw_dl_error':
[...]
When building the Julia 1.7.0-beta2 RPM package for Fedora, I set
CFLAGS
andLDFLAGS
to the standard Fedora values, as required by distro policies. This makes the libblastrampoline build fail, as apparently it requiresCFLAGS
to include-fPIC
andLDFLAGS
to include-shared
. These are included by default in Make.inc, but are lost when overriding the variables. Unfortunately, if adding these flags when callingmake
in Julia makes the build fail elsewhere (in libuv).I think that libblastrampoline shouldn't rely on the user setting these flags. Instead, they should be added unconditionally, as they are absolutely required. For example, Julia uses the custom
JCFLAGS
variable which includes both-fPIC
and$CFLAGS
by default.For reference, here's a simple reproducer: