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

In doctesting, ignore two ld warnings from recent OS X: #36337

Closed

Conversation

jhpalmieri
Copy link
Member

@jhpalmieri jhpalmieri commented Sep 25, 2023

in doctesting, ignore two warnings coming from ld in new OS X/command-line tools/Xcode 15

As of Xcode 15, I see warnings of this sort arising in doctesting:

ld: warning: duplicate -rpath '/path/to/SAGE_ROOT/local/lib' ignored
ld: warning: ignoring duplicate libraries: '-lflint', '-lgmp', '-lmpfr'

These all seem to arise from doctests involving cython(...).

These warnings cause doctests to fail, so we ignore them, as we ignore similar warning messages in src/doctest/parsing.py.

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@jhpalmieri
Copy link
Member Author

I have seen these warnings on two separate machines, but it would be nice if someone else saw them, too.

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

Do you have details of commands where you see these warnings? There are several Sage packages where one sees multiple -rpath in linking commands...

@jhpalmieri
Copy link
Member Author

Do you have details of commands where you see these warnings? There are several Sage packages where one sees multiple -rpath in linking commands...

Here are a few examples:

File "src/sage/misc/cython.py", line 141, in sage.misc.cython.?
Failed example:
    cython(os.linesep.join(code))
Expected nothing
Got:
    ld: warning: duplicate -rpath '/Users/jpalmier/Sage/TESTING/sage-10.2.beta5/local/lib' ignored
    ld: warning: ignoring duplicate libraries: '-lflint', '-lgmp', '-lmpfr'
**********************************************************************
File "src/sage/misc/cython.py", line 153, in sage.misc.cython.?
Failed example:
    cython("# distutils: language = c++\n"+
           "from libcpp.vector cimport vector\n"
           "cdef vector[int] * v = new vector[int](4)\n")
Expected nothing
Got:
    ld: warning: duplicate -rpath '/Users/jpalmier/Sage/TESTING/sage-10.2.beta5/local/lib' ignored

(and a number more in that file) and

File "src/sage/structure/element.pyx", line 1137, in sage.structure.element.Element._richcmp_
Failed example:
    cython(
    '''
    from sage.structure.richcmp cimport rich_to_bool
    from sage.structure.element cimport Element
    cdef class FloatCmp(Element):
        cdef float x
        def __init__(self, float v):
            self.x = v
        cpdef _richcmp_(self, other, int op):
            cdef float x1 = (<FloatCmp>self).x
            cdef float x2 = (<FloatCmp>other).x
            return rich_to_bool(op, (x1 > x2) - (x1 < x2))
    ''')
Expected nothing
Got:
    ld: warning: duplicate -rpath '/Users/jpalmier/Sage/TESTING/sage-10.2.beta5/local/lib' ignored

(and a number more in that file). Summary:

sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/sagedoc.py  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/cython.py  # 11 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/graphs/connectivity.pyx  # 2 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/structure/element.pyx  # 8 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/cachefunc.pyx  # 6 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/sageinspect.py  # 11 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/repl/ipython_extension.py  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/rings/tate_algebra_ideal.pyx  # 2 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/rings/polynomial/ore_polynomial_element.pyx  # 2 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/env.py  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/graphs/graph_decompositions/fast_digraph.pyx  # 5 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/cpython/cython_metaclass.pyx  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/arith/long.pxd  # 3 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/superseded.py  # 2 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/ext/memory_allocator.pyx  # 3 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/parallel/decorate.py  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/ext/memory_allocator.pxd  # 3 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/structure/factory.pyx  # 2 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/session.pyx  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/cpython/getattr.pyx  # 2 doctests failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/inherit_comparison.pyx  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/instancedoc.pyx  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/rings/integer_fake.pxd  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/lazy_attribute.pyx  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/cpython/wrapperdescr.pxd  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/cpython/string.pyx  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/misc/nested_class.pyx  # 1 doctest failed
sage -t --long --random-seed=231430374440504911905034125125918429749 src/sage/symbolic/pynac.pxi  # 1 doctest failed

I also see these messages in sagelib-10.2.beta5.log.

@jhpalmieri
Copy link
Member Author

They all seem to come from doctests involving cython(...).

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

These come from Xcode 15 linker - which caused havoc elsewhere,
e.g. with scipy build.

I presume you also get lots of these in install.log

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

Can you add a comment on this in the source code, and in the (long) commit message - that it's from Xcode 15 "ld"?

@jhpalmieri
Copy link
Member Author

Here's a new commit and I also edited the description at the top of this page.

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

It's probably can be fixed by Cython people (not too easily, I suppose).
Probably Cython does not filter out duplicate libraries it gathers in Cython files,
not too sure about the rpath one (probably the same story).

Maybe Apple will fix this in their ld, who knows. It should also be possible
to use a different ld.

We're finally switching to Cython 3, #36110, perhaps it's fixed there?

@dimpase
Copy link
Member

dimpase commented Sep 28, 2023

Can you check, by saving the following into x.pyx

# distutils: language = c++
from libcpp.vector cimport vector
cdef vector[int] * v = new vector[int](4)

and running

$ cython x.pyx --cplus

that you still see a warning? (Want to make sure it's a small reproducer)

@jhpalmieri
Copy link
Member Author

Can you check, by saving the following into x.pyx

# distutils: language = c++
from libcpp.vector cimport vector
cdef vector[int] * v = new vector[int](4)

and running

$ cython x.pyx --cplus

that you still see a warning? (Want to make sure it's a small reproducer)

I see this:

% sage --cython x.pyx --cplus
/Users/palmieri/Sage/git/sage/local/var/lib/sage/venv-python3.11/lib/python3.11/site-packages/Cython/Compiler/Main.py:384: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /Users/palmieri/Desktop/x.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

@dimpase
Copy link
Member

dimpase commented Sep 29, 2023

No warning here, hmm.

What cython are you using? It should be Sage's one, i.e. run this in Sage shell.

@dimpase
Copy link
Member

dimpase commented Sep 29, 2023

But, wait, this is probably not the whole building of an extension function. One should get a .dylib file, or .so file.

@dimpase
Copy link
Member

dimpase commented Sep 29, 2023

I also see these messages in sagelib-10.2.beta5.log.

can you attach here this log file?

@dimpase
Copy link
Member

dimpase commented Sep 29, 2023

indeed, here in the log of Sage's cython() one sees repeated -rpath in the call to g++ - I took the example from the doctest and added verbose=100 to get it to output the calling sequence:

File "src/sage/misc/cython.py", line 152, in sage.misc.cython.?
Failed example:
    cython("# distutils: language = c++\n"+
           "from libcpp.vector cimport vector\n"
           "cdef vector[int] * v = new vector[int](4)\n", verbose=100)
Expected nothing
Got:
    Compiling /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx_0.pyx because it changed.
    [1/1] Cythonizing /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx_0.pyx
    No `name` configuration, performing automatic discovery
    running build
    running build_ext
    building '_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx_0' extension
    creating /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build
    creating /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build/temp.linux-x86_64-cpython-311
    creating /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build/temp.linux-x86_64-cpython-311/tmp
    creating /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build/temp.linux-x86_64-cpython-311/tmp/tmpe7fse9wc
    creating /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build/temp.linux-x86_64-cpython-311/tmp/tmpe7fse9wc/spyx
    creating /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build/temp.linux-x86_64-cpython-311/tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx
    gcc -Wsign-compare -DNDEBUG -fPIC -I/mnt/opt/Sage/sage-dev -I/mnt/opt/Sage/sage-dev/src -I/usr/lib/python3.11/site-packages/numpy/core/include -I/usr/include/python3.11 -I/usr/include/openblas -I///usr/include -I/mnt/opt/Sage/sage-dev/local/var/lib/sage/venv-python3.11/include -I/usr/include/python3.11 -c /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx_0.cpp -o /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build/temp.linux-x86_64-cpython-311/tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx_0.o -w
    g++ -std=gnu++11 -shared -Wl,-rpath-link,/mnt/opt/Sage/sage-dev/local/lib -L/mnt/opt/Sage/sage-dev/local/lib -Wl,-rpath,/mnt/opt/Sage/sage-dev/local/lib -Wl,-rpath-link,/mnt/opt/Sage/sage-dev/local/lib -L/mnt/opt/Sage/sage-dev/local/lib -Wl,-rpath,/mnt/opt/Sage/sage-dev/local/lib /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/build/temp.linux-x86_64-cpython-311/tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx_0.o -L/mnt/opt/Sage/sage-dev/local/lib -L///usr/lib -L/usr/lib64 -lmpfr -lgmp -lgmpxx -lpari -lm -lec -lgsl -lopenblas -lntl -o /tmp/tmpe7fse9wc/spyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx/_tmp_tmp2s5awx2j_tmp_ua4wxos7_pyx_0.cpython-311-x86_64-linux-gnu.so

probably -rpath added by distutils or setuptools, which gets invoked there.

@jhpalmieri
Copy link
Member Author

No warning here, hmm.

What cython are you using? It should be Sage's one, i.e. run this in Sage shell.

I ran sage --cython and that's with the most recent beta release of Sage.

@jhpalmieri
Copy link
Member Author

jhpalmieri commented Sep 29, 2023

I also see these messages in sagelib-10.2.beta5.log.

can you attach here this log file?

Here it is. This is from an Intel Mac.
sagelib-10.2.beta5.log

@jhpalmieri
Copy link
Member Author

Possibly related (although they say that particular bug has been fixed): https://developer.apple.com/forums/thread/733317

@jhpalmieri
Copy link
Member Author

jhpalmieri commented Sep 29, 2023

See also https://stackoverflow.com/questions/76661812/xcode-15-beta-duplicate-lc-rpath-are-deprecated. Someone suggested adding -ld64 to "Other Linker Flags".

@dimpase
Copy link
Member

dimpase commented Sep 29, 2023

As far as duplicate -rpath is concerned, I gather it's Sage bug. Indeed, check out LDFLAGS:

sage: import os
sage: os.getenv('LDFLAGS')
'-Wl,-rpath-link,/mnt/opt/Sage/sage-dev/local/lib -L/mnt/opt/Sage/sage-dev/local/lib -Wl,-rpath,/mnt/opt/Sage/sage-dev/local/lib -Wl,-rpath-link,/mnt/opt/Sage/sage-dev/local/lib -L/mnt/opt/Sage/sage-dev/local/lib -Wl,-rpath,/mnt/opt/Sage/sage-dev/local/lib '

OTOH, in ./sage -sh the value of LDFLAGS is still OK, so there is something causing doubling up LDFLAGS at Sage startup.

@jhpalmieri
Copy link
Member Author

Can we do something like

os.environ['LDFLAGS'] = ' '.join(set(os.getenv('LDFLAGS').split()))

to eliminate the duplicates? (I'm not sure where this would go.)

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 29, 2023

Trying to eliminate duplicates is too dangerous because order matters.

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 29, 2023

Instead we should try to see where the duplicates are introduced

@jhpalmieri
Copy link
Member Author

With #36364, the full test-suite for me now shows

sage -t --long --random-seed=104661903330434685244134119983619290477 src/sage/rings/polynomial/multi_polynomial_ideal.py  # Killed due to segmentation fault
sage -t --long --random-seed=104661903330434685244134119983619290477 src/sage/libs/giac/__init__.py  # Timed out
sage -t --long --random-seed=104661903330434685244134119983619290477 src/sage/graphs/connectivity.pyx  # 2 doctests failed
sage -t --long --random-seed=104661903330434685244134119983619290477 src/sage/misc/cython.py  # 1 doctest failed

The first two of those are known (#35646) and the last two are the "duplicate libraries" warnings. No "duplicate -rpath" warnings.

@jhpalmieri
Copy link
Member Author

I'm removing the "positive review" tag. Ignoring these warnings shouldn't hurt, so please reinstate if you want, but if we can solve the problem without that, wouldn't it be better?

@dimpase
Copy link
Member

dimpase commented Sep 29, 2023

potentially, "duplicate libraries" might be needed in some cases. So I don't really know what this is all about. Is Apple ld now prohibiting such cases?

@jhpalmieri
Copy link
Member Author

They are just warnings, not errors. The post at https://stackoverflow.com/a/77190575/1401572 suggests adding -ld_classic to LDFLAGS. I don't know the right way to do this, but

 fi
 
 if [ -n "$SAGE_LOCAL" ]; then
-    LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
+    LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,-ld_classic,$SAGE_LOCAL/lib $LDFLAGS"
     if [ "$UNAME" = "Linux" ]; then
         LDFLAGS="-Wl,-rpath-link,$SAGE_LOCAL/lib $LDFLAGS"
     fi

makes tests pass for cython.py and connectivity.pyx. Is this a good thing to do? If so, only do this for DARWIN, presumably. Only for Xcode 15?

@jhpalmieri
Copy link
Member Author

We could do something like this, but I don't know if it's a good idea:

@@ -276,6 +275,14 @@ export UNAME=`uname | sed 's/CYGWIN.*/CYGWIN/' `
 # Mac OS X-specific setup
 if [ "$UNAME" = "Darwin" ]; then
     export MACOSX_VERSION=`uname -r | awk -F. '{print $1}'`
+    # Command-line tools version:
+    XCLT_VERSION=`pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | awk '/version: / { print $NF }' | cut -d. -f-1`
+    # If this didn't produce an integer, set to 0.
+    case $XCLT_VERSION in
+        ''|*[!0-9]*) export XCLT_VERSION=0 ;; # bad
+        *) : ;; # good
+    esac
+    export XCLT_VERSION
     # Work around problems on recent OS X crashing with an error message
     # "... may have been in progress in another thread when fork() was called"
     # when objective-C functions are called after fork(). See Issue #25921.
@@ -373,7 +380,11 @@ if [ -n "$PYTHONHOME" ]; then
 fi
 
 if [ -n "$SAGE_LOCAL" ]; then
-    LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
+    if [ "$UNAME" = "Darwin" ] && [ "$XCLT_VERSION" -ge 15 ]; then
+        LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-ld_classic,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
+    else
+        LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
+    fi
     if [ "$UNAME" = "Linux" ]; then
         LDFLAGS="-Wl,-rpath-link,$SAGE_LOCAL/lib $LDFLAGS"
     fi

@dimpase
Copy link
Member

dimpase commented Sep 30, 2023

ld_classic is not there forever, I suppose. So using it only postpones a proper fix.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 1, 2023
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->

Do not run sage-env more than once.

<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->

In the previous version of sage-env, in the lines
```
SAGE_ENV_VERSION="6:$SAGE_LOCAL:$SAGE_VENV:$SAGE_SRC"
if [ "$SAGE_ENV_SOURCED" = "$SAGE_ENV_VERSION" ]; then
    # Already sourced, nothing to do.
    return 0
fi
export SAGE_ENV_SOURCED="$SAGE_ENV_VERSION"
```
the test would fail the first time, as it should, but when the rest of
the file was executed, SAGE_SRC would get changed. That meant that the
test would fail the next time and so the file would get executed again.
We move the last line to the end of the file, and also change it to
explicitly use `SAGE_LOCAL`, `SAGE_VENV`, and `SAGE_SRC` so that it uses
the up-to-date versions.

This should fix part of the problem in sagemath#36337: it should prevent
duplicate `-rpath` entries which were arising because sage-env was
getting executed twice.

<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36364
Reported by: John H. Palmieri
Reviewer(s): Dima Pasechnik, John H. Palmieri, Matthias Köppe
@jhpalmieri
Copy link
Member Author

I don't know where the "duplicate libraries" are coming from. We could

  • suppress the warning message
  • add the -ld_classic flag
  • something else?

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 3, 2023

Likely they are coming in from pkg-config via the linker directives at the top of cython files and sage.env.cython_aliases

@jhpalmieri
Copy link
Member Author

cython_aliases has this entry:

 'SINGULAR_LIBRARIES': ['Singular',
  'polys',
  'flint',
  'mpfr',
  'gmp',
  'factory',
  'flint',
  'mpfr',
  'gmp',
  'ntl',
  'gmp',
  'omalloc',
  'singular_resources'],

Removing the duplicates might be a bad idea — does order matter? — but in this case it fixes the doctest error in cython.py. There is no hint of pari in cython_aliases, so I don't know about graphs/connectivity.pyx.

@dimpase
Copy link
Member

dimpase commented Oct 3, 2023

pari might come with cysignals

vbraun pushed a commit that referenced this pull request Oct 8, 2023
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->

Do not run sage-env more than once.

<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->

In the previous version of sage-env, in the lines
```
SAGE_ENV_VERSION="6:$SAGE_LOCAL:$SAGE_VENV:$SAGE_SRC"
if [ "$SAGE_ENV_SOURCED" = "$SAGE_ENV_VERSION" ]; then
    # Already sourced, nothing to do.
    return 0
fi
export SAGE_ENV_SOURCED="$SAGE_ENV_VERSION"
```
the test would fail the first time, as it should, but when the rest of
the file was executed, SAGE_SRC would get changed. That meant that the
test would fail the next time and so the file would get executed again.
We move the last line to the end of the file, and also change it to
explicitly use `SAGE_LOCAL`, `SAGE_VENV`, and `SAGE_SRC` so that it uses
the up-to-date versions.

This should fix part of the problem in #36337: it should prevent
duplicate `-rpath` entries which were arising because sage-env was
getting executed twice.

<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #36364
Reported by: John H. Palmieri
Reviewer(s): Dima Pasechnik, John H. Palmieri, Matthias Köppe
ld: warning: duplicate -rpath '/path/to/SAGE_ROOT/local/lib' ignored
ld: warning: ignoring duplicate libraries: '-lflint', '-lgmp', '-lmpfr'
@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 26, 2023

rebased

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 26, 2023

I'm also getting ld: warning: duplicate LC_RPATH are deprecated

@github-actions
Copy link

Documentation preview for this PR (built with commit 8f5ee78; changes) is ready! 🎉

@jhpalmieri
Copy link
Member Author

I might want to remove "ld: warning: duplicate -rpath .* ignored" since I am not seeing those anymore (after #36364). Also, what about adding the -ld_classic flag? If we are willing to do that on #36523, why not here as well?

@jhpalmieri
Copy link
Member Author

I'm also getting ld: warning: duplicate LC_RPATH are deprecated

I haven't seen these on any machine in logs/test.log, nor in the one machine I checked in any file in logs/pkgs.

vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 6, 2023
…s (OS X) and set LDFLAGS accordingly

    
Identify the version of command-line tools in use (OS X), and use the
version to set LDFLAGS.

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

In sage-env, save the version of command-line tools being used in
XCLT_VERSION. If it's too recent, we set LDFLAGS to solve some problems:
- Fixes sagemath#36337 (doctest failures)
- Fixes sagemath#36342 (scipy building,
replacing sagemath#36523).

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36599
Reported by: John H. Palmieri
Reviewer(s): Matthias Köppe
vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 7, 2023
…s (OS X) and set LDFLAGS accordingly

    
Identify the version of command-line tools in use (OS X), and use the
version to set LDFLAGS.

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

In sage-env, save the version of command-line tools being used in
XCLT_VERSION. If it's too recent, we set LDFLAGS to solve some problems:
- Fixes sagemath#36337 (doctest failures)
- Fixes sagemath#36342 (scipy building,
replacing sagemath#36523).

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36599
Reported by: John H. Palmieri
Reviewer(s): Matthias Köppe
@vbraun vbraun closed this in 8898473 Nov 10, 2023
@mkoeppe mkoeppe added this to the sage-10.2 milestone Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants