我的代码(https://github.com/fangq/mmc,https://github.com/fangq/mcxcl)已经在Linux&Mac、Windows上的cygwin gcc或msys2 gcc,但没有使用MinGW编译器(适用于cygwin64、msys2、mingw64或TDM-gcc的x86-64-mingw64-*
编译器,或matlab mingw64支持(mingw64 gcc 4.9.6((,因为它抱怨错过了一组头文件(sys/ioctl.h
、ieee754.h
等(,所以我在源代码中包含了这些头文件的副本,并添加了-I./mingw64/include
以使大多数头文件编译
https://github.com/fangq/mmc/tree/master/src/mingw64/include
然而,当在matlab R2016/2018上使用此脚本编译matlab mex文件时,我收到了以下错误
Error using mex
mcx_utils.o: In function `mcx_progressbar':
D:/Users/fangq/Gitroot/Project/mmc/src/mcx_utils.c:1054: undefined reference to `ioctl'
collect2.exe: error: ld returned 1 exit status
我想知道为什么在matlab内部和外部编译是不同的。有没有可以链接的库来修复undefined reference to "ioctl"
错误?
以下是在msys2:上使用gcc编译时的日志
fangq@zen:~/space/git/Project/mmc/src$ make mex
Building built/xorshift128p_rand.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/xorshift128p_rand.o xorshift128p_rand.c
Building built/simpmesh.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/simpmesh.o simpmesh.c
Building built/tettracing.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/tettracing.o tettracing.c
Building built/mcx_utils.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/mcx_utils.o mcx_utils.c
Building built/tictoc.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/tictoc.o tictoc.c
Building built/mmc.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/mmc.o mmc.c
Building built/cjson/cJSON.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/cjson/cJSON.o cjson/cJSON.c
Building built/mmc_host.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/mmc_host.o mmc_host.c
Building built/highordermesh.o
g++ -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/highordermesh.o highordermesh.cpp
Building built/mmc_cl_utils.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/mmc_cl_utils.o mmc_cl_utils.c
Building built/mmc_cl_host.o
cc -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -I../src -I"./mingw64/include" -o built/mmc_cl_host.o mmc_cl_host.c
Building bin/mmc
cmd //c mex.bat -v -f mexopts_msys2_gcc.xml COMPFLAGS='$COMPFLAGS -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT' LDFLAGS='$LDFLAGS -static -fopenmp "c:WindowsSystem32OpenCL.dll" -fopenmp' -outdir ../mmclab mmclab.cpp -I../src -I"./mingw64/include" -output bin/mmc built/xorshift128p_rand.o built/simpmesh.o built/tettracing.o built/mcx_utils.o built/tictoc.o built/mmc.o built/cjson/cJSON.o built/mmc_host.o built/highordermesh.o built/mmc_cl_utils.o built/mmc_cl_host.o
Verbose mode is on.
... Looking for compiler 'MinGW64 Compiler (C++)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:/msys64/usr/').
... Looking for file 'C:msys64usrbing++.exe' ...Yes.
... Looking for folder 'C:msys64usr' ...Yes.
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:/msys64/usr/').
... Executing command 'C:msys64usrbing++ -dumpmachine' ...Yes ('x86_64-pc-msys').
Found installed compiler 'MinGW64 Compiler (C++)'.
Set PATH = C:msys64usrbin;C:Program FilesMATLABR2018aexternincludewin64;C:Program FilesMATLABR2018aexterninclude;C:Program FilesMATLABR2018asimulinkinclude;C:Program FilesMATLABR2018alibwin64;.;C:msys64optlocalbin;C:msys64usrlocalcudabin;.;C:msys64pubbin;C:msys64pubpgilinux86-6418.4bin;C:msys64mingw64bin;C:msys64usrlocalbin;C:msys64usrbin;C:msys64usrbin;C:WindowsSystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:msys64usrbinsite_perl;C:msys64usrbinvendor_perl;C:msys64usrbincore_perl;C:msys64usrlocalbin;C:msys64homeusersfangqspaceDownloadMCXStudio;C;C:Program FilesMATLABR2018abin;C:msys64usrlibgccx86_64-pc-msys9.3.0
Set INCLUDE = C:msys64usrinclude;C:msys64usrx86_64-pc-msysincludec++;C:msys64usrx86_64-pc-msysinclude;C:msys64usrx86_64-pc-msysincludec++x86_64-pc-msys;C:msys64usrx86_64-pc-msysincludec++backward;
Set LIB = C:msys64usrlib;;
Set MW_TARGET_ARCH = win64;
Set LIBPATH = C:Program FilesMATLABR2018aexternlibwin64;
Options file details
-------------------------------------------------------------------
Compiler location: C:msys64usr
Options file: C:msys64homefangqspacegitProjectmmcsrcmexopts_msys2_gcc.xml
CMDLINE2 : C:msys64usrbing++ -m64 -Wl,--no-undefined -static -fopenmp "c:WindowsSystem32OpenCL.dll" -fopenmp -shared -static -s -Wl,"C:Program FilesMATLABR2018a/extern/lib/win64/mingw64/exportsmexfileversion.def" C:msys64tmpmex_1481040925092289_7396mmclab.obj C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj "built/xorshift128p_rand.o" "built/simpmesh.o" "built/tettracing.o" "built/mcx_utils.o" "built/tictoc.o" "built/mmc.o" "built/cjson/cJSON.o" "built/mmc_host.o" "built/highordermesh.o" "built/mmc_cl_utils.o" "built/mmc_cl_host.o" -L"C:Program FilesMATLABR2018aexternlibwin64mingw64" -llibmx -llibmex -llibmat -o C:msys64homefangqspacegitProjectmmcmmclabmmc.mexw64
CXX : C:msys64usrbing++
COMPILER : C:msys64usrbing++
DEFINES : -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE
MATLABMEX : -DMATLAB_MEX_FILE
CFLAGS : -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer
CXXFLAGS : -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer
INCLUDE : -I"..src" -I".mingw64include" -I"C:msys64usrusrinclude" -I"C:Program FilesMATLABR2018a/extern/include" -I"C:Program FilesMATLABR2018a/simulink/include"
CXXOPTIMFLAGS : -O -DNDEBUG
CXXDEBUGFLAGS : -g
LDXX : C:msys64usrbing++
LINKER : C:msys64usrbing++
LDFLAGS : -m64 -Wl,--no-undefined -static -fopenmp "c:WindowsSystem32OpenCL.dll" -fopenmp
LDTYPE : -shared -static
LINKEXPORT : -Wl,"C:Program FilesMATLABR2018a/extern/lib/win64/mingw64/mexFunction.def"
LINKEXPORTVER : -Wl,"C:Program FilesMATLABR2018a/extern/lib/win64/mingw64/exportsmexfileversion.def"
LIBLOC : C:Program FilesMATLABR2018aexternlibwin64mingw64
LINKLIBS : -L"C:Program FilesMATLABR2018aexternlibwin64mingw64" -llibmx -llibmex -llibmat
LDOPTIMFLAGS : -s
LDDEBUGFLAGS : -g
OBJEXT : .obj
LDEXT : .mexw64
SETENV : set COMPILER=C:msys64usrbingcc
set CXXCOMPILER=C:msys64usrbing++
set COMPFLAGS=-c -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -DMATLAB_MEX_FILE
set CXXCOMPFLAGS=-c -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -DMATLAB_MEX_FILE
set OPTIMFLAGS=-O -DNDEBUG
set DEBUGFLAGS=-g
set LINKER=C:msys64usrbingcc
set CXXLINKER=C:msys64usrbing++
set LINKFLAGS=-m64 -Wl,--no-undefined -static -fopenmp "c:WindowsSystem32OpenCL.dll" -fopenmp -shared -static -L"C:Program FilesMATLABR2018aexternlibwin64mingw64" -llibmx -llibmex -llibmat -Wl,"C:Program FilesMATLABR2018a/extern/lib/win64/mingw64/mexFunction.def"
set LINKDEBUGFLAGS=-g
set NAME_OUTPUT= -o "%OUTDIR%%MEX_NAME%%MEX_EXT%"
MINGWROOT : C:msys64usr
MINGWTARGET : x86_64-pc-msys
MATLABROOT : C:Program FilesMATLABR2018a
ARCH : win64
SRC : "C:msys64homefangqspacegitProjectmmcsrcmmclab.cpp";"C:Program FilesMATLABR2018aexternversioncpp_mexapi_version.cpp"
OBJ : C:msys64tmpmex_1481040925092289_7396mmclab.obj;C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj
OBJS : C:msys64tmpmex_1481040925092289_7396mmclab.obj C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj "built/xorshift128p_rand.o" "built/simpmesh.o" "built/tettracing.o" "built/mcx_utils.o" "built/tictoc.o" "built/mmc.o" "built/cjson/cJSON.o" "built/mmc_host.o" "built/highordermesh.o" "built/mmc_cl_utils.o" "built/mmc_cl_host.o"
SRCROOT : C:msys64homefangqspacegitProjectmmcsrcmmclab
DEF : C:msys64tmpmex_1481040925092289_7396mmc.def
EXP : "C:msys64homefangqspacegitProjectmmcmmclabmmc.exp"
LIB : "C:msys64homefangqspacegitProjectmmcmmclabmmc.lib"
EXE : C:msys64homefangqspacegitProjectmmcmmclabmmc.mexw64
ILK : "C:msys64homefangqspacegitProjectmmcmmclabmmc.ilk"
MANIFEST : "C:msys64homefangqspacegitProjectmmcmmclabmmc.mexw64.manifest"
TEMPNAME : C:msys64homefangqspacegitProjectmmcmmclabmmc
EXEDIR : C:msys64homefangqspacegitProjectmmcmmclab
EXENAME : mmc
COMPFLAGS : -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT
OPTIM : -O -DNDEBUG
LINKOPTIM : -s
CMDLINE1_0 : C:msys64usrbing++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"..src" -I".mingw64include" -I"C:msys64usrusrinclude" -I"C:Program FilesMATLABR2018a/extern/include" -I"C:Program FilesMATLABR2018a/simulink/include" -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer -O -DNDEBUG "C:msys64homefangqspacegitProjectmmcsrcmmclab.cpp" -o C:msys64tmpmex_1481040925092289_7396mmclab.obj
CMDLINE1_1 : C:msys64usrbing++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"..src" -I".mingw64include" -I"C:msys64usrusrinclude" -I"C:Program FilesMATLABR2018a/extern/include" -I"C:Program FilesMATLABR2018a/simulink/include" -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer -O -DNDEBUG "C:Program FilesMATLABR2018aexternversioncpp_mexapi_version.cpp" -o C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj
-------------------------------------------------------------------
Building with 'MinGW64 Compiler (C++)'.
Warning: You are using an unsupported version of MinGW Compiler. To install the supported version of MinGW compiler, visit https://www.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html.
For a list of currently supported compilers see: https://www.mathworks.com/support/compilers.
C:msys64usrbing++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"..src" -I".mingw64include" -I"C:msys64usrusrinclude" -I"C:Program FilesMATLABR2018a/extern/include" -I"C:Program FilesMATLABR2018a/simulink/include" -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer -O -DNDEBUG "C:msys64homefangqspacegitProjectmmcsrcmmclab.cpp" -o C:msys64tmpmex_1481040925092289_7396mmclab.obj
C:msys64usrbing++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"..src" -I".mingw64include" -I"C:msys64usrusrinclude" -I"C:Program FilesMATLABR2018a/extern/include" -I"C:Program FilesMATLABR2018a/simulink/include" -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer -O -DNDEBUG "C:Program FilesMATLABR2018aexternversioncpp_mexapi_version.cpp" -o C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj
C:msys64usrbing++ -m64 -Wl,--no-undefined -static -fopenmp "c:WindowsSystem32OpenCL.dll" -fopenmp -shared -static -s -Wl,"C:Program FilesMATLABR2018a/extern/lib/win64/mingw64/exportsmexfileversion.def" C:msys64tmpmex_1481040925092289_7396mmclab.obj C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj "built/xorshift128p_rand.o" "built/simpmesh.o" "built/tettracing.o" "built/mcx_utils.o" "built/tictoc.o" "built/mmc.o" "built/cjson/cJSON.o" "built/mmc_host.o" "built/highordermesh.o" "built/mmc_cl_utils.o" "built/mmc_cl_host.o" -L"C:Program FilesMATLABR2018aexternlibwin64mingw64" -llibmx -llibmex -llibmat -o C:msys64homefangqspacegitProjectmmcmmclabmmc.mexw64
Recompile embedded version with '-DMATLAB_MEXCMD_RELEASE=R2017b'
C:msys64usrbing++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"..src" -I".mingw64include" -I"C:msys64usrusrinclude" -I"C:Program FilesMATLABR2018a/extern/include" -I"C:Program FilesMATLABR2018a/simulink/include" -c -Wall -g -DMCX_EMBED_CL -fno-strict-aliasing -m64 -DMMC_USE_SSE -DHAVE_SSE2 -msse -msse2 -msse3 -mssse3 -msse4.1 -O3 -fopenmp -DMCX_CONTAINER -DUSE_OS_TIMER -DUSE_OPENCL -DMMC_XORSHIFT -fexceptions -fno-omit-frame-pointer -O -DNDEBUG "C:Program FilesMATLABR2018aexternversioncpp_mexapi_version.cpp" -o C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj -DMATLAB_MEXCMD_RELEASE=R2017b
C:msys64usrbing++ -m64 -Wl,--no-undefined -static -fopenmp "c:WindowsSystem32OpenCL.dll" -fopenmp -shared -static -s -Wl,"C:Program FilesMATLABR2018a/extern/lib/win64/mingw64/exportsmexfileversion.def" C:msys64tmpmex_1481040925092289_7396mmclab.obj C:msys64tmpmex_1481040925092289_7396cpp_mexapi_version.obj "built/xorshift128p_rand.o" "built/simpmesh.o" "built/tettracing.o" "built/mcx_utils.o" "built/tictoc.o" "built/mmc.o" "built/cjson/cJSON.o" "built/mmc_host.o" "built/highordermesh.o" "built/mmc_cl_utils.o" "built/mmc_cl_host.o" -L"C:Program FilesMATLABR2018aexternlibwin64mingw64" -llibmx -llibmex -llibmat -o C:msys64homefangqspacegitProjectmmcmmclabmmc.mexw64
MEX completed successfully.
fangq@zen:~/space/git/Project/mmc/src$ which gcc
/usr/bin/gcc
fangq@zen:~/space/git/Project/mmc/src$ which g++
/usr/bin/g++
fangq@zen:~/space/git/Project/mmc/src$ which cc
/usr/bin/cc
fangq@zen:~/space/git/Project/mmc/src$ gcc --version
gcc (GCC) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
包含ioctl.h
的原因是什么?
从其他地方复制该标头是个坏主意。充其量,它会定义库不存在的函数,从而导致链接器错误。
通常,你需要使用Windows替代品来处理你在其他平台上做的任何IOCTL事情。
我试图用MSYS2在Windows上编译MMC,删除了这个包含,构建成功:
patch -ulbf src/mcx_utils.c << EOF
@@ -35,3 +35,5 @@
#include <time.h>
+#ifndef _WIN32
#include <sys/ioctl.h>
+#endif
#include "mcx_utils.h"
EOF
sed -i.bak -e "s/^EXTRALIBs*+*=.*$/& -Wl,--as-needed -lwinmm/" commons/Makefile_common.mk
~/buildstatus.sh build &&
make -Csrc CC=gcc PLATFORM=MINGW32 &&
echo Success