swami / libinstpatch

Instrument file software library.
Other
20 stars 6 forks source link

Syntax error compiling with MSYS2 + MINGW #61

Closed Roboron3042 closed 3 years ago

Roboron3042 commented 3 years ago

I'm trying to build libinstpatch using MSYS2 + MINGW. What I am doing is:

  1. cmake -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX -G 'MSYS Makefiles' ..
  2. make install

But then it fails at:

[  98%] Linking C shared library libinstpatch-2.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libinstpatch.def:4: syntax error
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:libinstpatch.def: file format not recognized; treating as linker script
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:libinstpatch.def:2: syntax error
collect2.exe: error: ld returned 1 exit status
make[2]: *** [libinstpatch/CMakeFiles/libinstpatch.dir/build.make:1586: libinstpatch/libinstpatch-2.dll] Error 1
make[1]: *** [CMakeFiles/Makefile2:289: libinstpatch/CMakeFiles/libinstpatch.dir/all] Error 2
make: *** [Makefile:172: all] Error 2

You can see the contents of the libinstpatch.def file here https://pastebin.pl/view/22bb1bb0

derselbst commented 3 years ago

I'm sorry. I really have no clue why mingw isn't recognizing libinstpatch.def as visibility definition file. And I don't know how to convince it to treat it like that either.

Roboron3042 commented 3 years ago

Some extra research gave me the root of the problem: http://cegui.org/forum/viewtopic.php?t=6629

Removing (or adding a name to) "LIBRARY" at the start of the .def file allowed me to compile libinstpatch.

derselbst commented 3 years ago

Ok, thanks for the pointer. I'll look into it, but this will take some time.