-
Notifications
You must be signed in to change notification settings - Fork 542
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
[libflame] Initial build scripts. #8671
Open
jd-foster
wants to merge
24
commits into
JuliaPackaging:master
Choose a base branch
from
jd-foster:flame-init
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0b516cc
Initial build scripts.
jd-foster 63c650a
Move to single build_tarballs file, try adding windows build
jd-foster 1906898
Try again to enable windows builds
jd-foster fb87262
Simplify platform defs and configure flags
jd-foster 3218272
Typo: missing p
jd-foster c80132d
Enable libblastrampoline?
jd-foster 9368233
Get apple-darwin working
jd-foster 3f5567d
Revert: explictly enable-max-arg-list-hack
jd-foster f50c25f
Build on windows?
jd-foster ba61034
Try windows without major soname
jd-foster 2382166
Test: disable static build, whole archive on macos
jd-foster 452f7af
Get clang flags right
jd-foster 178cde5
Keep flailing wildly with flags
jd-foster 1a0c748
More wild flailing
jd-foster 9e7c2d1
Keep it up.
jd-foster c84208c
Allow static build in macos
jd-foster 709ef7d
Drop mac patch
jd-foster a00ad2d
Revert
jd-foster 93b06f1
rpath-link -> rpath
jd-foster 08e4816
Revert mac patch
jd-foster 91cf56a
Set LBT compat to 5.8
jd-foster c857799
Test rpath/rpath-link again
jd-foster 310a7e1
Fix rpath/rpath-link again
jd-foster 52e1f32
Remove rpath-link
jd-foster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name = "libflame" | ||
|
||
using BinaryBuilder, Pkg | ||
|
||
version = v"5.2.0" | ||
|
||
# Collection of sources required to build lapack | ||
sources = [ | ||
GitSource("https://github.com/flame/libflame", | ||
"646ed9075cc45aeffb53632a3ec88defb423fefa"), | ||
DirectorySource("bundled"), | ||
] | ||
|
||
# Bash recipe for building across all *64-bit* platforms | ||
# We try to maintain consistency with the blis Yggdrasil build scripts. | ||
|
||
script = raw""" | ||
cd $WORKSPACE/srcdir/libflame | ||
|
||
# We might need newer `config.guess`` and `config.sub` files | ||
update_configure_scripts | ||
|
||
extra_flags=" --disable-static-build " | ||
|
||
if [[ "${target}" == *-apple-* ]]; then | ||
extra_flags=" --enable-static-build " | ||
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/mac-update-makefile.patch | ||
fi | ||
|
||
if [[ "${target}" == *-w64-mingw32* ]]; then | ||
extra_flags+=" --enable-windows-build " | ||
# disable time & clock functions on windows (mingw): sys/times.h is missing | ||
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/windows-remove-time.patch | ||
# update the make build scripts for windows cross-compiling with gcc: | ||
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/windows-update-build.patch | ||
fi | ||
|
||
if [[ "${target}" == *mingw* ]]; then | ||
LBT="-L${libdir} -lblastrampoline-5" | ||
else | ||
LBT="-L${libdir} -lblastrampoline" | ||
fi | ||
|
||
# - Compile and build a LAPACK compatibility layer with --enable-lapack2flame | ||
# - If a static library is not needed, use --disable-static-build | ||
# - Enable a dynamic build with --enable-dynamic-build | ||
./configure \ | ||
--prefix=${prefix} --build=${MACHTYPE} --host=${target} \ | ||
--enable-multithreading=openmp \ | ||
--enable-lapack2flame \ | ||
--enable-dynamic-build \ | ||
--enable-max-arg-list-hack \ | ||
--disable-autodetect-f77-ldflags --disable-autodetect-f77-name-mangling \ | ||
$extra_flags | ||
|
||
make -j${nproc} BLAS_LIB="${LBT}" | ||
make install | ||
|
||
install_license LICENSE | ||
""" | ||
|
||
# These are the platforms we will build for by default, unless further | ||
# platforms are passed in on the command line | ||
platforms = supported_platforms() | ||
|
||
filter!(p -> arch(p) != "i686", platforms) | ||
filter!(p -> arch(p) != "armv7l", platforms) | ||
filter!(p -> arch(p) != "armv6l", platforms) | ||
filter!(p -> arch(p) != "powerpc64le", platforms) | ||
|
||
# Enable the following line if trying to link against Fortran code: | ||
# platforms = expand_gfortran_versions(platforms) | ||
|
||
# Dependencies that must be installed before this package can be built | ||
dependencies = [ | ||
Dependency(PackageSpec(name="libblastrampoline_jll", uuid="8e850b90-86db-534c-a0d3-1478176c7d93"), compat="5.8"), | ||
# For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD | ||
# systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else. | ||
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); platforms=filter(!Sys.isbsd, platforms)), | ||
Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); platforms=filter(Sys.isbsd, platforms)), | ||
] | ||
|
||
products = [ | ||
LibraryProduct("libflame", :libflame), | ||
] | ||
|
||
# Build the tarballs | ||
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; | ||
preferred_gcc_version=v"11", lock_microarchitecture=false, julia_compat="1.6") | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/Makefile b/Makefile | ||
index c7a2b7f7..0c509288 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -140,7 +140,7 @@ LIBFLAME_SO_OUTPUT_NAME := $(LIBFLAME_SO_PATH) | ||
ifeq ($(OS_NAME),Darwin) | ||
# OS X shared library link flags. | ||
SOFLAGS := -dynamiclib | ||
-SOFLAGS += -Wl,-install_name,$(LIBFLAME_SONAME) | ||
+SOFLAGS += -Wl,-install_name,@rpath/$(LIBFLAME_SONAME) | ||
else | ||
SOFLAGS := -shared | ||
# Linux shared library link flags. | ||
@@ -670,7 +670,7 @@ ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes) | ||
$(SORT) $(AR_OBJ_LIST_FILE) | $(UNIQ) > $(AR_OBJ_LIST_FILE).sotmp | ||
$(CAT) $(AR_OBJ_LIST_FILE).sotmp | xargs -n$(AR_CHUNK_SIZE) $(AR) $(ARFLAGS) $(LIBFLAME_A) | ||
ifeq ($(OS_NAME),Darwin) | ||
- $(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A) $(LDFLAGS) | ||
+ $(LINKER) $(SOFLAGS) -o $@ -Wl,-rpath,$(BASE_LIB_PATH):$(LIBFLAME_A_PATH) -Wl,-all_load $(LDFLAGS) | ||
else | ||
$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive $(LIBFLAME_A) -Wl,--no-whole-archive $(LDFLAGS) | ||
endif | ||
@@ -686,7 +686,7 @@ ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes) | ||
@$(SORT) $(AR_OBJ_LIST_FILE) | $(UNIQ) > $(AR_OBJ_LIST_FILE).sotmp | ||
@$(CAT) $(AR_OBJ_LIST_FILE).sotmp | xargs -n$(AR_CHUNK_SIZE) $(AR) $(ARFLAGS) $(LIBFLAME_A) | ||
ifeq ($(OS_NAME),Darwin) | ||
- @$(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A) $(LDFLAGS) | ||
+ $(LINKER) $(SOFLAGS) -o $@ -Wl,-rpath,$(BASE_LIB_PATH):$(LIBFLAME_A_PATH) -Wl,-all_load $(LDFLAGS) | ||
else | ||
@$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive $(LIBFLAME_A) -Wl,--no-whole-archive $(LDFLAGS) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
diff --git a/src/map/common/lapacksrc/install/static/dsecnd.c b/src/map/common/lapacksrc/install/static/dsecnd.c | ||
index 2711ccee..89626f23 100644 | ||
--- a/src/map/common/lapacksrc/install/static/dsecnd.c | ||
+++ b/src/map/common/lapacksrc/install/static/dsecnd.c | ||
@@ -1,5 +1,5 @@ | ||
#include "FLA_f2c.h" | ||
-#include <sys/times.h> | ||
+// #include <sys/times.h> | ||
//#include <sys/types.h> | ||
//#include <time.h> | ||
|
||
@@ -7,11 +7,11 @@ | ||
#define CLK_TCK 60 | ||
#endif | ||
|
||
-doublereal dsecnd_( void ) | ||
-{ | ||
- struct tms rusage; | ||
+// doublereal dsecnd_( void ) | ||
+// { | ||
+// struct tms rusage; | ||
|
||
- times(&rusage); | ||
- return (doublereal)(rusage.tms_utime) / CLK_TCK; | ||
+// times(&rusage); | ||
+// return (doublereal)(rusage.tms_utime) / CLK_TCK; | ||
|
||
-} /* dsecnd_ */ | ||
+// } /* dsecnd_ */ | ||
diff --git a/src/map/common/lapacksrc/install/static/second.c b/src/map/common/lapacksrc/install/static/second.c | ||
index 68fbb062..915446f9 100644 | ||
--- a/src/map/common/lapacksrc/install/static/second.c | ||
+++ b/src/map/common/lapacksrc/install/static/second.c | ||
@@ -1,5 +1,5 @@ | ||
#include "FLA_f2c.h" | ||
-#include <sys/times.h> | ||
+// #include <sys/times.h> | ||
//#include <sys/types.h> | ||
//#include <time.h> | ||
|
||
@@ -7,11 +7,11 @@ | ||
#define CLK_TCK 60 | ||
#endif | ||
|
||
-real second_( void ) | ||
-{ | ||
- struct tms rusage; | ||
+// real second_( void ) | ||
+// { | ||
+// struct tms rusage; | ||
|
||
- times(&rusage); | ||
- return (real)(rusage.tms_utime) / CLK_TCK; | ||
+// times(&rusage); | ||
+// return (real)(rusage.tms_utime) / CLK_TCK; | ||
|
||
-} /* second_ */ | ||
+// } /* second_ */ | ||
diff --git a/src/map/common/lapacksrc/install/util/other/dtime_.c b/src/map/common/lapacksrc/install/util/other/dtime_.c | ||
index 6a09b3e9..5d87552d 100644 | ||
--- a/src/map/common/lapacksrc/install/util/other/dtime_.c | ||
+++ b/src/map/common/lapacksrc/install/util/other/dtime_.c | ||
@@ -13,7 +13,7 @@ | ||
#define _INCLUDE_POSIX_SOURCE /* for HP-UX */ | ||
#define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ | ||
#include "sys/types.h" | ||
-#include "sys/times.h" | ||
+// #include "sys/times.h" | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
@@ -30,34 +30,34 @@ extern "C" { | ||
#endif | ||
#endif | ||
|
||
- REAL | ||
-#ifdef KR_headers | ||
-dtime_(tarray) float *tarray; | ||
-#else | ||
-dtime_(float *tarray) | ||
-#endif | ||
-{ | ||
-#ifdef USE_CLOCK | ||
-#ifndef CLOCKS_PER_SECOND | ||
-#define CLOCKS_PER_SECOND Hz | ||
-#endif | ||
- static double t0; | ||
- double t = clock(); | ||
- tarray[1] = 0; | ||
- tarray[0] = (t - t0) / CLOCKS_PER_SECOND; | ||
- t0 = t; | ||
- return tarray[0]; | ||
-#else | ||
- struct tms t; | ||
- static struct tms t0; | ||
+// REAL | ||
+// #ifdef KR_headers | ||
+// dtime_(tarray) float *tarray; | ||
+// #else | ||
+// dtime_(float *tarray) | ||
+// #endif | ||
+// { | ||
+// #ifdef USE_CLOCK | ||
+// #ifndef CLOCKS_PER_SECOND | ||
+// #define CLOCKS_PER_SECOND Hz | ||
+// #endif | ||
+// static double t0; | ||
+// double t = clock(); | ||
+// tarray[1] = 0; | ||
+// tarray[0] = (t - t0) / CLOCKS_PER_SECOND; | ||
+// t0 = t; | ||
+// return tarray[0]; | ||
+// #else | ||
+// struct tms t; | ||
+// static struct tms t0; | ||
|
||
- times(&t); | ||
- tarray[0] = (double)(t.tms_utime - t0.tms_utime) / Hz; | ||
- tarray[1] = (double)(t.tms_stime - t0.tms_stime) / Hz; | ||
- t0 = t; | ||
- return tarray[0] + tarray[1]; | ||
-#endif | ||
- } | ||
+// times(&t); | ||
+// tarray[0] = (double)(t.tms_utime - t0.tms_utime) / Hz; | ||
+// tarray[1] = (double)(t.tms_stime - t0.tms_stime) / Hz; | ||
+// t0 = t; | ||
+// return tarray[0] + tarray[1]; | ||
+// #endif | ||
+// } | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
diff --git a/src/map/common/lapacksrc/install/util/other/etime_.c b/src/map/common/lapacksrc/install/util/other/etime_.c | ||
index 2d9a36d8..15ceca93 100644 | ||
--- a/src/map/common/lapacksrc/install/util/other/etime_.c | ||
+++ b/src/map/common/lapacksrc/install/util/other/etime_.c | ||
@@ -13,7 +13,7 @@ | ||
#define _INCLUDE_POSIX_SOURCE /* for HP-UX */ | ||
#define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ | ||
#include "sys/types.h" | ||
-#include "sys/times.h" | ||
+// #include "sys/times.h" | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
@@ -30,28 +30,28 @@ extern "C" { | ||
#endif | ||
#endif | ||
|
||
- REAL | ||
-#ifdef KR_headers | ||
-etime_(tarray) float *tarray; | ||
-#else | ||
-etime_(float *tarray) | ||
-#endif | ||
-{ | ||
-#ifdef USE_CLOCK | ||
-#ifndef CLOCKS_PER_SECOND | ||
-#define CLOCKS_PER_SECOND Hz | ||
-#endif | ||
- double t = clock(); | ||
- tarray[1] = 0; | ||
- return tarray[0] = t / CLOCKS_PER_SECOND; | ||
-#else | ||
- struct tms t; | ||
+// REAL | ||
+// #ifdef KR_headers | ||
+// etime_(tarray) float *tarray; | ||
+// #else | ||
+// etime_(float *tarray) | ||
+// #endif | ||
+// { | ||
+// #ifdef USE_CLOCK | ||
+// #ifndef CLOCKS_PER_SECOND | ||
+// #define CLOCKS_PER_SECOND Hz | ||
+// #endif | ||
+// double t = clock(); | ||
+// tarray[1] = 0; | ||
+// return tarray[0] = t / CLOCKS_PER_SECOND; | ||
+// #else | ||
+// struct tms t; | ||
|
||
- times(&t); | ||
- return (tarray[0] = (double)t.tms_utime/Hz) | ||
- + (tarray[1] = (double)t.tms_stime/Hz); | ||
-#endif | ||
- } | ||
+// times(&t); | ||
+// return (tarray[0] = (double)t.tms_utime/Hz) | ||
+// + (tarray[1] = (double)t.tms_stime/Hz); | ||
+// #endif | ||
+// } | ||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets try not using LLD and instead using the other linker to see if these flags work then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed up the gcc ld
-whole-archive
vs. clang lld-force_load
but didn't seem to like it anyway. Might need to try your approach.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flagon
utility.