swig / cccl

Unix cc compiler to Microsoft's cl compiler wrapper
GNU General Public License v3.0
123 stars 36 forks source link

Option -link tries to link ink.lib #7

Closed Neumann-A closed 3 years ago

Neumann-A commented 4 years ago

Before this case: https://github.com/swig/cccl/blob/ac88ffd2bfe3bfced62d36359e70d19d1445c655/cccl#L129

must be a case which handles the -link option case.

Makefile:735: update target 'libXau.la' due to: AuDispose.lo AuFileName.lo AuGetAddr.lo AuGetBest.lo AuLock.lo AuRead.lo AuUnlock.lo AuWrite.lo
echo "  CCLD    " libXau.la;D:/vcpkg_common/downloads/tools/msys2/msys64/usr/bin/sh.exe ./libtool --silent --tag=CC   --mode=link cccl --cccl-verbose -ID:/xlinux/installed/x64-windows/debug/../include  -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast /DWIN32  -version-number 6:0:0 -no-undefined  -o libXau.la -rpath /D/xlinux/packages/xau_x64-windows/debug/lib AuDispose.lo AuFileName.lo AuGetAddr.lo AuGetBest.lo AuLock.lo AuRead.lo AuUnlock.lo AuWrite.lo  
  CCLD     libXau.la
cl "-nologo" "-Fe.libs/libXau-6.dll" ".libs/AuDispose.obj" ".libs/AuFileName.obj" ".libs/AuGetAddr.obj" ".libs/AuGetBest.obj" ".libs/AuLock.obj" ".libs/AuRead.obj" ".libs/AuUnlock.obj" ".libs/AuWrite.obj" "ink.lib" "-LD"
LINK : fatal error LNK1181: cannot open input file 'ink.lib'
wsfulton commented 4 years ago

Can you show the entire cccl command executed? I suspect it has -link in the list of command line options, which means link against the ink library, so cccl is doing the right thing. All you have shown is what is passed to libtool.

emptyVoid commented 4 years ago

I've stumbled upon the same issue.

Here's the output of make V=1:

/bin/sh ../libtool  --tag=CC   --mode=link cccl  /DIXML_HAVE_SCRIPTSUPPORT /DUPNP_USE_MSVCPP /DLIBUPNP_EXPORTS /FS --cccl-verbose  /DWIN32 /D_WINDOWS /W3  /MP  /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -g -Wall -Wextra -Wpedantic -version-info 11:0:0 -export-symbols-regex '^ixml.*' -no-undefined --cccl-verbose   -o libixml.la -rpath D:/Projects/GitHub/vcpkg/packages/pupnp_x64-windows/debug/lib src/attr.lo src/document.lo src/element.lo src/ixml.lo src/ixmldebug.lo src/ixmlparser.lo src/ixmlmembuf.lo src/namedNodeMap.lo src/node.lo src/nodeList.lo  pthreadVC3.lib iphlpapi.lib ws2_32.lib
libtool: link: dumpbin -symbols -headers  src/.libs/attr.obj src/.libs/document.obj src/.libs/element.obj src/.libs/ixml.obj src/.libs/ixmldebug.obj src/.libs/ixmlparser.obj src/.libs/ixmlmembuf.obj src/.libs/namedNodeMap.obj src/.libs/node.obj src/.libs/nodeList.obj   | gawk '     {last_section=section; section=$ 3};     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};     /^ *Symbol name *: /{split($ 0,sn,":"); si=substr(sn[2],2)};     /^ *Type *: code/{print "T",si,substr(si,length(prfx))};     /^ *Type *: data/{print "I",si,substr(si,length(prfx))};     $ 0!~/External *\|/{next};     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};     {if(hide[section]) next};     {f="D"}; $ 0~/\(\).*\|/{f="T"};     {split($ 0,a,/\||\r/); split(a[2],s)};     s[1]~/^[@?]/{print f,s[1],s[1]; next};     s[1]~prfx {split(s[1],t,"@"); print f,t[1],substr(t[1],length(prfx))}     ' prfx=^ | sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libixml.exp
libtool: link: /usr/bin/grep -E -e "^ixml.*" ".libs/libixml.exp" > ".libs/libixml.expT"
libtool: link: mv -f ".libs/libixml.expT" ".libs/libixml.exp"
libtool: link: cccl -o .libs/libixml-11.dll  src/.libs/attr.obj src/.libs/document.obj src/.libs/element.obj src/.libs/ixml.obj src/.libs/ixmldebug.obj src/.libs/ixmlparser.obj src/.libs/ixmlmembuf.obj src/.libs/namedNodeMap.obj src/.libs/node.obj src/.libs/nodeList.obj   -g   `func_echo_all "" | /usr/bin/sed 's/ -lc$//'` -link -dll
cl "-nologo" "-Fe.libs/libixml-11.dll" "src/.libs/attr.obj" "src/.libs/document.obj" "src/.libs/element.obj" "src/.libs/ixml.obj" "src/.libs/ixmldebug.obj" "src/.libs/ixmlparser.obj" "src/.libs/ixmlmembuf.obj" "src/.libs/namedNodeMap.obj" "src/.libs/node.obj" "src/.libs/nodeList.obj" "-Zi" "ink.lib" "-dll"
LINK : fatal error LNK1104: cannot open file 'ink.lib'

I believe the arguments -link -dll originate from here: https://github.com/autotools-mirror/libtool/blob/544fc0e2c2a03129a540aebef41ad32bfb5c06b8/m4/libtool.m4#L5627-L5642

wsfulton commented 3 years ago

libtool should be passing /link not -link as it is adding options for cl not cc. However, I suspect under msys the options only work when being passed as - not /, so I'll make a change for cccl to handle -link' the same as it does/link'. It does mean that it will not be possible to convert -link into linking with the ink.lib. Unfortunate tradeoff.

wsfulton commented 3 years ago

Closed by 9634702