msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.31k stars 1.23k forks source link

missing gcc configure "--enable-plugin" package for windows #5053

Closed labba closed 7 months ago

labba commented 5 years ago

hi i'm using windows Mingw and couldn't find a copmlete build of Mingw with latest gcc that was gcc configure with "--enable-plugin" can you please build and upload a new build with gcc configured with "----enable-plugin" ? it should generate a new folder that is now missing in the latest build the new folder should be generate in "mingw32\lib\gcc\i686-w64-mingw32\8.3.1" as a "plugin" folder with some libs and includes so it would be possible to compile plugins also in windows build.. it was published here that this is now supported : https://www.phoronix.com/scan.php?page=news_item&px=GCC-Plugins-Windows-MinGW

revelator commented 5 years ago

plugin support is not possible by default with gcc on windows.

There was some work some years back when clang was in a much worse shape on windows, to get the plugin for clang building on windows so that we could use it.

Sadly while it did work to some extent, it was a pita to build (required the use of dlfcn-win32 for dlopen support), also instead of seperate plugins for clang functions, we had to yank them all into the same dll which had to be placed correctly in the gcc tree by hand.

So main reason its not a thing you will be likely to see in gcc on windows is that it relies on loading from shared objects (this is by no means an easy feat on windows).

So if you realy want it the best way to get it would be to patch gcc yourself, and if its working correctly you could ask alexey if he would consider adding it to the package.

adonais commented 5 years ago

hi i'm using windows Mingw and couldn't find a copmlete build of Mingw with latest gcc that was gcc configure with "--enable-plugin" can you please build and upload a new build with gcc configured with "----enable-plugin" ? it should generate a new folder that is now missing in the latest build the new folder should be generate in "mingw32\lib\gcc\i686-w64-mingw32\8.3.1" as a "plugin" folder with some libs and includes so it would be possible to compile plugins also in windows build.. it was published here that this is now supported : https://www.phoronix.com/scan.php?page=news_item&px=GCC-Plugins-Windows-MinGW

I built gcc-8.3.1 with "--enable-plugin" on windows and its working correctly. you can download mingw8.3.1 from https://sourceforge.net/projects/libportable/files/Tools/mingw8.3.1-clang-win64_32.7z now and try it out for yourself.

oscarfv commented 5 years ago

If you want gcc-plugin enabled, patch the PKGBUILD, make sure it works and submit a pull request. Then the maintainer will consider it.

BTW, two weeks ago someone did that for mingw-w64-gcc-git.

revelator commented 5 years ago

Neat :)

labba commented 5 years ago

hi i'm using windows Mingw and couldn't find a copmlete build of Mingw with latest gcc that was gcc configure with "--enable-plugin" can you please build and upload a new build with gcc configured with "----enable-plugin" ? it should generate a new folder that is now missing in the latest build the new folder should be generate in "mingw32\lib\gcc\i686-w64-mingw32\8.3.1" as a "plugin" folder with some libs and includes so it would be possible to compile plugins also in windows build.. it was published here that this is now supported : https://www.phoronix.com/scan.php?page=news_item&px=GCC-Plugins-Windows-MinGW

I built gcc-8.3.1 with "--enable-plugin" on windows and its working correctly. you can download mingw8.3.1 from https://sourceforge.net/projects/libportable/files/Tools/mingw8.3.1-clang-win64_32.7z now and try it out for yourself.

how did you compile it ? i have tried many times and couldn't compile it ..

what is the setup you have and dependencies / commands you done to compile this ?

Thanks!

labba commented 4 years ago

i can't find the binary for download anymore.. can it be re-uploaded ?

nanpengyor commented 7 months ago

Hi, Just in case this thread is still relevant, I built gcc-13.2.0-5 with plugin support on MinGW just yesterday and it's working perfectly. It's been tested with the ODB C++ ORM Compiler which I also built (ODB 2.5.0-b.25). I will submit the patch next week. It's quite very simple, just check the ../configure section in the PKGBUILD file of the mingw64-gcc package after cloning the repository and add --enable-plugin option, then build following the instructions on the MSYS2 Documentation. You can then check if your GCC support plugging with $ gcc --print-file-name=plugin, it will output a directory path where the cc1.exe.a plugging file is located if it support plugging, if not, the output will be "plugin"

nanpengyor commented 7 months ago

The patch to the gcc build was submitted years ago, in 2017 , patch link by Boris Kolpackov and is already in the mainstream gcc code

revelator commented 7 months ago

i remember atleast some later versions of gcc where it did not work (export ordinal to large) but if it works in the latest build thats something :).

MehdiChinoune commented 7 months ago

I tried building with plugin support enabled, It succeeds on 64-bit envs and fails on mingw32.

nanpengyor commented 7 months ago

I tried building with plugin support enabled, It succeeds on 64-bit envs and fails on mingw32.

Please can you post the error message with the build configuration you used

MehdiChinoune commented 7 months ago

Please can you post the error message with the build configuration you used

build configuration is from PKGBUILD+--enable-plugin error messages:

  g++ -std=c++11 -no-pie   -O2 -D__USE_MINGW_ACCESS -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -static-libstdc++ -Wl,--no-seh -Wl,--large-address-aware -Wl,--large-address-aware -Wl,--stack,12582912 -Wl,--undefined=HOST_EXTRA_OBJS_SYMBOL -o cc1plus.exe \
        cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/contracts.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o i386-c.o winnt-c.o winnt-cxx.o msformat-c.o cc1plus-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcody/libcody.a  \
    libcommon.a ../libcpp/libcpp.a  /mingw32/lib/libiconv.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -L/mingw32/lib -lisl -L/mingw32/lib -L/mingw32/lib -L/mingw32/lib -lmpc -lmpfr -lgmp -Wl,--export-all-symbols -Wl,--out-implib=cc1plus.exe.a  -lz -lzstd 
  D:/M/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot export HOST_EXTRA_OBJS_SYMBOL: symbol not found
  D:/M/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot export HOST_EXTRA_OBJS_SYMBOL: symbol not found
  D:/M/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot export HOST_EXTRA_OBJS_SYMBOL: symbol not found
  collect2.exe: error: ld returned 1 exit status
  make[3]: *** [../../gcc-13.2.0/gcc/lto/Make-lang.in:96: lto1.exe] Error 1
  make[3]: *** Waiting for unfinished jobs....
  D:/M/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot export HOST_EXTRA_OBJS_SYMBOL: symbol not found
  collect2.exe: error: ld returned 1 exit status
  make[3]: *** [../../gcc-13.2.0/gcc/c/Make-lang.in:87: cc1.exe] Error 1
  collect2.exe: error: ld returned 1 exit status
  make[3]: *** [../../gcc-13.2.0/gcc/cp/Make-lang.in:145: cc1plus.exe] Error 1
  collect2.exe: error: ld returned 1 exit status
  make[3]: *** [../../gcc-13.2.0/gcc/ada/gcc-interface/Make-lang.in:758: gnat1.exe] Error 1
  rm gcc.pod
  make[2]: *** [Makefile:4981: all-stage1-gcc] Error 2
  make[1]: *** [Makefile:25599: stage1-bubble] Error 2
  make: *** [Makefile:26538: profiledbootstrap] Error 2