如何在CMake引导程序中添加链接器选项?

时间:2018-11-25 22:48:56

标签: cmake linker-errors aix linker-flags

我正在AIX的发行版压缩包中构建CMake 3.12.4。 CMake无法在计算机上链接:

from flask import Flask, render_template
app = Flask(__name__)

@app.route('/')
def home():
    return render_template("home.html")

@app.route('/about/')
def about():
    return render_template("about.html")
if __name__=="__main__":
    app.run(debug=True)

该错误在ld: 0711-781 ERROR: TOC overflow的IBM技术说明中进行了详细说明。我想为cmake食谱添加ld: 0711-781 ERROR: TOC overflow. TOC size: 65632 Maximum size: 65536 链接器选项。

CMake的引导程序似乎不接受-bbigtoc的链接器选项,如下所示。

如何在引导过程中添加链接器标志?


以下是CMake引导程序接受的选项:

LDFLAGS

这是CMake链接错误:

$ ./bootstrap --help

Usage: ./bootstrap [<options>...] [-- <cmake-options>...]
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print this message
  --version               only print version information
  --verbose               display more information
  --parallel=n            bootstrap cmake in parallel, where n is
                          number of nodes [1]
  --enable-ccache         Enable ccache when building cmake
  --init=FILE             load FILE as script to populate cache
  --system-libs           use all system-installed third-party libraries
                          (for use only by package maintainers)
  --no-system-libs        use all cmake-provided third-party libraries
                          (default)
  --system-curl           use system-installed curl library
  --no-system-curl        use cmake-provided curl library (default)
  --system-expat          use system-installed expat library
  --no-system-expat       use cmake-provided expat library (default)
  --system-jsoncpp        use system-installed jsoncpp library
  --no-system-jsoncpp     use cmake-provided jsoncpp library (default)
  --system-zlib           use system-installed zlib library
  --no-system-zlib        use cmake-provided zlib library (default)
  --system-bzip2          use system-installed bzip2 library
  --no-system-bzip2       use cmake-provided bzip2 library (default)
  --system-liblzma        use system-installed liblzma library
  --no-system-liblzma     use cmake-provided liblzma library (default)
  --system-libarchive     use system-installed libarchive library
  --no-system-libarchive  use cmake-provided libarchive library (default)
  --system-librhash       use system-installed librhash library
  --no-system-librhash    use cmake-provided librhash library (default)
  --system-libuv          use system-installed libuv library
  --no-system-libuv       use cmake-provided libuv library (default)

  --qt-gui                build the Qt-based GUI (requires Qt >= 4.2)
  --no-qt-gui             do not build the Qt-based GUI (default)
  --qt-qmake=<qmake>      use <qmake> as the qmake executable to find Qt

  --sphinx-info           build Info manual with Sphinx
  --sphinx-man            build man pages with Sphinx
  --sphinx-html           build html help with Sphinx
  --sphinx-qthelp         build qch help with Sphinx
  --sphinx-build=<sb>     use <sb> as the sphinx-build executable
  --sphinx-flags=<flags>  pass <flags> to sphinx-build executable

Directory and file names:
  --prefix=PREFIX         install files in tree rooted at PREFIX
                          [/usr/local]
  --bindir=DIR            install binaries in PREFIX/DIR
                          [bin]
  --datadir=DIR           install data files in PREFIX/DIR
                          [share/cmake-3.12]
  --docdir=DIR            install documentation files in PREFIX/DIR
                          [doc/cmake-3.12]
  --mandir=DIR            install man pages files in PREFIX/DIR/manN
                          [man]
  --xdgdatadir=DIR        install XDG specific files in PREFIX/DIR
                          [share]

1 个答案:

答案 0 :(得分:1)

类似这样的东西:

export CFLAGS=...
export CXXFLAGS=...
export LDFLAGS='... -Wl,-bbigtoc'

./bootstrap ... --verbose

make VERBOSE=1 all

另外,您可能需要阅读以下内容:http://lzsiga.users.sourceforge.net/aix-linking.html#Q0025