[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #61571] mkoctfile: Unresolved symbols when pas
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #61571] mkoctfile: Unresolved symbols when passing `-l` flags that depend on "base" libraries |
Date: |
Fri, 26 Nov 2021 18:03:30 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34 |
URL:
<https://savannah.gnu.org/bugs/?61571>
Summary: mkoctfile: Unresolved symbols when passing `-l`
flags that depend on "base" libraries
Project: GNU Octave
Submitted by: mmuetzel
Submitted on: Sat 27 Nov 2021 12:03:28 AM CET
Category: Configuration and Build System
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Build Failure
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: 7.0.90
Discussion Lock: Any
Operating System: Any
_______________________________________________________
Details:
When passing `-l` flags in the command line to `mkoctfile`, they are added
*after* `LDFLAGS` in the command line passed to the linker.
But libraries that resolve symbols must appear *after* other libraries that
use these symbols.
Currently packages are setting `LFLAGS` instead of `LDFLAGS`. Presumably
because we are adding the former *after* manual `-l` flags in the command line
to the linker.
`LFLAGS` was removed in Octave 8. I tried to fix compiling the ltfat package
by setting `LDFLAGS` instead. But that didn't work:
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-mkoctfile
--verbose -strip -I../src/modules/libltfat/include -DNDEBUG -L../lib -lltfat
comp_atrousfilterbank_td.cc
x86_64-w64-mingw32-g++ -c
-I/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/include
-I/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/include/octave-8.0.0/octave/..
-I/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/include/octave-8.0.0/octave
-I/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/include
-pthread -fopenmp -g -O2 -std=gnu++11 -Wall -DLTFAT_LARGEARRAYS
-DLTFAT_BUILD_STATIC -DMINGW=1 -I../src/modules/libltfat/include -DNDEBUG
comp_atrousfilterbank_td.cc -o /tmp/oct-MgVRx0.o
x86_64-w64-mingw32-g++
-I/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/include/octave-8.0.0/octave/..
-I/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/include/octave-8.0.0/octave
-I/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/include
-pthread -fopenmp -g -O2 -std=gnu++11 -Wall -DLTFAT_LARGEARRAYS
-DLTFAT_BUILD_STATIC -DMINGW=1 -o comp_atrousfilterbank_td.oct
/tmp/oct-MgVRx0.o -shared -Wl,--export-all-symbols -Wl,--enable-auto-import
-Wl,--enable-runtime-pseudo-reloc
-L/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/lib
-L"/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/lib"
-L"/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/qt5/lib"
-L/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/lib/gcc/x86_64-w64-mingw32/11.2.0
-L/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib
-L/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib
-lm -lgfortran -lmingw32 -lmoldname -lmingwex -lmsvcrt -lkernel32 -lquadmath
-lkernel32 -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lkernel32
-lkernel32 -llapack -lblas -lxerbla
-L/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/lib
-lfftw3
-L/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/lib
-lfftw3f -L../lib -lltfat
-L/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/lib/octave/8.0.0
-loctinterp -loctave
-Wl,-rpath-link,"/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/lib"
-L"/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/lib"
-L"/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/x86_64-w64-mingw32/qt5/lib"
-Wl,--export-all-symbols
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-ld:
../lib/libltfat.a(dmemalloc.o):memalloc.c:(.text+0xb9): undefined reference to
`fftw_malloc'
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-ld:
../lib/libltfat.a(dmemalloc.o):memalloc.c:(.text+0xc9): undefined reference to
`fftw_free'
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-ld:
../lib/libltfat.a(dmemalloc.o):memalloc.c:(.text+0x161): undefined reference
to `fftw_malloc'
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-ld:
../lib/libltfat.a(dmemalloc.o):memalloc.c:(.text+0x1b1): undefined reference
to `fftw_malloc'
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-ld:
../lib/libltfat.a(dmemalloc.o):memalloc.c:(.text+0x41): undefined reference to
`fftw_malloc'
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-ld:
../lib/libltfat.a(dmemalloc.o):memalloc.c:(.text+0x1d1): undefined reference
to `fftw_free'
/home/osboxes/Documents/Repositories/Octave/mxe-octave/usr/bin/x86_64-w64-mingw32-ld:
../lib/libltfat.a(dmemalloc.o):memalloc.c:(.text+0x201): undefined reference
to `fftw_free'
collect2: error: ld returned 1 exit status
Note that `-lltfat` appears after `-lfftw3` in the linker command. It must be
the other way round for it to work.
We should probably exchange the order in which we add linker flags (already
for Octave 7):
diff -r 15ae4d97a632 src/mkoctfile.in.cc
--- a/src/mkoctfile.in.cc Fri Nov 26 22:08:49 2021 +0100
+++ b/src/mkoctfile.in.cc Fri Nov 26 23:57:30 2021 +0100
@@ -1320,7 +1320,7 @@
= (vars["CXXLD"] + ' ' + vars["CPPFLAGS"] + ' '
+ vars["ALL_CXXFLAGS"] + ' ' + vars["RDYNAMIC_FLAG"] + ' '
+ pass_on_options + ' ' + output_option + ' ' + objfiles + '
'
- + libfiles + ' ' + vars["ALL_LDFLAGS"] + ' ' + ldflags + ' '
+ + libfiles + ' ' + ldflags + ' ' + vars["ALL_LDFLAGS"] + ' '
+ vars["LFLAGS"] + ' ' + octave_libs + ' '
+ vars["OCTAVE_LINK_OPTS"] + ' ' + vars["OCTAVE_LINK_DEPS"]);
@@ -1349,8 +1349,8 @@
std::string cmd
= (vars["CXXLD"] + ' ' + vars["ALL_CXXFLAGS"] + ' '
+ pass_on_options + " -o " + octfile + ' ' + objfiles + ' '
- + libfiles + ' ' + vars["DL_LDFLAGS"] + ' ' + vars["LDFLAGS"] + '
'
- + ldflags + ' ' + vars["LFLAGS"] + ' ' + octave_libs + ' '
+ + libfiles + ' ' + ldflags + ' ' + vars["DL_LDFLAGS"] + ' '
+ + vars["LDFLAGS"] + ' ' + vars["LFLAGS"] + ' ' + octave_libs + '
'
+ vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]);
#if defined (OCTAVE_USE_WINDOWS_API) || defined(CROSS)
Since `LDFLAGS` can still not be used correctly in current versions of Octave,
we should probably revert 79369ad5cee6 (for Octave 8) and delay removing
`LFLAGS` for at least one or two more major versions.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61571>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #61571] mkoctfile: Unresolved symbols when passing `-l` flags that depend on "base" libraries,
Markus Mützel <=