本文介绍了更新了软件包,现在用-O0编译的Mex文件是“无效的mex文件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组(以前工作和编译了几个月)的MEX文件.我用pacman -Syu更新了3个月大的软件包(在GCC/G ++之前可以正常工作),现在是我的结果:

对于

  • 它们包含simulink/include,但我们不包含. (添加并不能解决问题)
  • 他们使用-O.这是否意味着-O1? -O2? -O3?不清楚.
  • 他们有-s,我们没有(尝试添加,没有解决任何问题)
  • 他们有-llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas,我们没有. (尝试添加它们,但未解决任何问题)
  • 他们没有-lmex -lmx(删除没有解决该问题)
  • 我们有-Wl,-Bsymbolic他们没有(删除它没有解决任何问题)
  • 晦涩的编译器问题不是我的专长.任何人对这里可能出现的问题有任何建议吗?

    解决方案

    切换到 TDM-GCC 解决了使用-O0编译时mex文件无效的问题.显然没什么(尽管我注意到其他差异).

    我的错误(我认为)是我将G ++换成TDM-G ++,但也没有换成GCC,并且仓库中有几个C文件.

    对于使用MEX进行编译,该问题也在链接的问题中得到了解决,因此也是一种选择.

    问题似乎在于随着时间的推移更新了GCC.无论如何,使用-o0仍会创建无效的mex文件.使用-o1-2很好,使用-o3可以省略代码的重要部分,除非添加了伪打印语句.我发现最好的平衡是将其设置为使用TDM-GCC/G ++编译DEBUG,并将GCC的最新版本用于所有其他方面.

    I had a (previously working and compiling for months) set of MEX files. I updated my 3-month-old packages (which worked fine before with GCC/G++) with a pacman -Syu, and now here are my results:

    For

  • They include simulink/include, we do not. (adding didn't fix it)
  • They use -O. Does that mean -O1? -O2? -O3? Unclear.
  • They had -s, we did not (Tried adding it, didn't fix anything)
  • They had -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas, we did not. (Tried adding them, did not fix anything)
  • They did NOT have -lmex -lmx (removing didn't fix it)
  • We have -Wl,-Bsymbolic they do not (removing it didn't fix anything)
  • Obscure compiler issue is not my specialty. Anyone have any suggestions as to what might be the issue here?

    解决方案

    Switching to TDM-GCC fixed the issue with mex files being invalid when compiled with -O0. Nothing else (despite the other differences I noticed) apparently mattered.

    My mistake (I think) is that I swapped out G++ for TDM-G++, but did not also do so for GCC, and there are several C files in the repo.

    As for compiling with MEX, that issue is also solved in the linked question, so it's an option as well.

    EDIT: The issue seems to lie with GCC being updated over time. In any case, with -o0 it still creates an invalid mex file. With -o1-2 it's fine, with -o3 it omits important parts of the code unless a dummy print statement is added. I've found that the best balance is to set it to compile DEBUG with TDM-GCC/G++, and use GCC's latest for all else.

    这篇关于更新了软件包,现在用-O0编译的Mex文件是“无效的mex文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-22 04:01