Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
7d57bd0e
Verified
Commit
7d57bd0e
authored
Jun 21, 2021
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
macOS package: hack to statically link libquadmath in Fortran MEX files
parent
38b2f2e5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
macOS/build.sh
+20
-4
20 additions, 4 deletions
macOS/build.sh
with
20 additions
and
4 deletions
macOS/build.sh
+
20
−
4
View file @
7d57bd0e
...
...
@@ -21,9 +21,12 @@ set -ex
ROOTDIR
=
$(
pwd
)
/..
# Set the GCC version
GCC_VERSION
=
10
# Set the compilers
CC
=
gcc-
10
CXX
=
g++-
10
CC
=
gcc-
$GCC_VERSION
CXX
=
g++-
$GCC_VERSION
# Set the number of threads
NTHREADS
=
$(
nproc
)
...
...
@@ -61,9 +64,22 @@ else
LOCATION
=
$(
echo
"
$VERSION
"
|
cut
-f1
-d
"-"
|
cut
-c
1-5
)
-
"
$DATE
"
fi
## Hack for statically linking libquadmath, similar to the one used in
## deps/Makefile for several libraries (there is no -static-libquadmath flag,
## see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539).
##
## NB: The hack done for Windows (see m4/ax_mexopts.m4) does not work for two reasons:
## - the macOS linker is different from GNU ld and does not have the equivalent of -Bstatic/-Bdynamic
## - libgfortran.spec does not include --as-needed on macOS, hence it will link the library anyways
## Also, it does not seem possible to override libgfortran.spec with the --specs option.
QUADMATH_DIR
=
$(
mktemp
-d
)
ln
-s
/usr/local/opt/gcc/lib/gcc/
$GCC_VERSION
/libquadmath.a
$QUADMATH_DIR
##
## Compile Dynare doc, dynare++, preprocessor, mex for MATLAB < 2018a
##
## NB: In Homebrew, -static-libgfortran is implied by -static-libgcc (see “gfortran -dumpspecs”)
## NB2: We use the hack for libquadmath in LDFLAGS
cd
"
$ROOTDIR
"
[[
-f
configure
]]
||
autoreconf
-si
./configure
\
...
...
@@ -72,7 +88,7 @@ cd "$ROOTDIR"
CC
=
$CC
\
CXX
=
$CXX
\
CPPFLAGS
=
-I
/usr/local/include
\
LDFLAGS
=
-static-libgcc
\
LDFLAGS
=
"
-static-libgcc
-L
$QUADMATH_DIR
"
\
LEX
=
/usr/local/opt/flex/bin/flex
\
YACC
=
/usr/local/opt/bison/bin/bison
\
--with-gsl
=
"
$LIB64
"
/gsl
\
...
...
@@ -154,7 +170,7 @@ make clean
CC
=
$CC
\
CXX
=
$CXX
\
CPPFLAGS
=
-I
/usr/local/include
\
LDFLAGS
=
-static-libgcc
\
LDFLAGS
=
"
-static-libgcc
-L
$QUADMATH_DIR
"
\
--with-gsl
=
"
$LIB64
"
/gsl
\
--with-matio
=
"
$LIB64
"
/matio
\
--with-slicot
=
"
$LIB64
"
/Slicot/with-underscore
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment