JakeSmarter / icedtea-web

IcedTea-Web for Windows
GNU General Public License v2.0
6 stars 3 forks source link

Comiling for Windows Plugin #16

Open patris70 opened 6 years ago

patris70 commented 6 years ago

Hi When i compiling makefile with make.exe, i got error 127 for this line in makefile.mingw: $(LD) $(LDFLAGS) -Map "$@.map" --out-implib "$(PLUGIN_LIB)" -o "$@" $(OBJ) $(DEF) $(LIBS) Can you please help me, how can i compiling without error?

Thanks

JakeSmarter commented 4 years ago

Make sure you have ld.exe on your PATH environment variable. Many MinGW installations do not put the executable into <mingw-dir>\bin but rather some other sub-directory. You can create a symbolic link in <mingw-dir>\bin to ld.exe's true location or add a path to ld.exe on the PATH environment variable.

I have added a separate link step in order to link to the latest MSVC runtime. Otherwise, GCC just amalgamates duplicate symbols from different libraries and aborts linking. I think since GCC 6.0 or so you can use the -nostdlib switch with gcc.exe/gcc directly which will preclude linking by default to msvcrt.lib but unfortunately will also preclude linking automatically to the appropriate static DLL and EXE stubs. So, you get into another set of problems. GCC for Windows simply lacks some MSVC runtime library selection specific code path.

patris70 commented 4 years ago

Hi, thank for info. Can you please tell me which gcc version is better and what must be exactly setting on my windows for compiling (i mean variables or etc.) and which command must be usig for compiling just plugin?

regards

JakeSmarter commented 4 years ago

You do not need any specific GCC version, so basically any GCC version since 4.9 (if I recall correctly I used GCC 4.9.2 during development back then) and later should work fine. You do not need to set any additional environment variables than those which are already provided by the OS. Generally speaking, most tool chains and build environments assume that your PATH environment variable resolves to any tool's executable location (usually setup during installation).

For makefile variables required for building the Windows plug-in, please see the header of the Makefile. You will particularly need to setup paths to your JDK, XULRunner, MinGW, and to GCC (which technically is just a module of MinGW). Note that you can also set makefile variables on the command line if you do not want to modify the Makefile itself.

Should you still get into trouble and building this somewhat obsolete plug-in is very important to you, then I may be inclined to revisit the dormant Makefile and try to simplify its path setting. As I have tried to explain above, one reason why setting some makefile variables to specific paths is necessary is because of the link step which requires GCC version specific DLL stubs located in GCC version specific paths which cannot be easily resolved by make. Every instance of GCC knows the path locations of its stubs but make does not, and you cannot query GCC for these paths either. You can do some trickery with GCC to get them anyway but it would be ugly and error prone to implement. You can also do some guessing as to where the DLL stubs are located on the build host but this approach remains guess work too. Hence, I have left it to be set manually.

patris70 commented 4 years ago

Thanks, i try it đź‘Ť

patris70 commented 4 years ago

Hi, i used MinGW32 with gcc 8.2.0 and command for compiling: mingw32-make -f Makefile.mingw all

But error:

In file included from Dll.c:16: IcedTeaShellExt.h:50:54: Fehler: unknown type name ╗PCTSTR½; did you mean ╗LPCT TR½? PCTSTR, ^~~~~~ LPCTSTR IcedTeaShellExt.h:70:54: Fehler: unknown type name ╗PCTSTR½; did you mean ╗LPCT TR½? PCTSTR, ^~~~~~ LPCTSTR IcedTeaShellExt.h:75:5: Warnung: kein Semikolon am Ende von ╗struct½ oder ╗unio ½ } *lpVtbl; ^ Dll.c:338:9: Fehler: In Konflikt stehende Typen f³r ╗DllInstall½ HRESULT DllInstall(BOOL install, PCWSTR cmdLine) { ^~~~~~~~~~ In file included from Dll.c:3: c:\dev-plugin\mingw\include\shlwapi.h:447:16: Anmerkung: Vorherige Deklaration on ╗DllInstall½ war hier HRESULT WINAPI DllInstall(BOOL,LPCWSTR); ^~~~~~~~~~ Dll.c: In Funktion ╗RegisterCOMClass½: Dll.c:621:40: Warnung: implicit declaration of function ╗_sctprintf½; did you m an ╗_stprintf½? [-Wimplicit-function-declaration] (TCHAR*)CoTaskMemAlloc((len = _sctprintf(TEXT("CLSID\\%s"), ^~~~~~~~~~ _stprintf Dll.c: In Funktion ╗ClassFactory_AddRef½: Dll.c:2943:38: Fehler: ╗MAXULONG½ undeclared (first use in this function); did ou mean ╗MAXLONG½? iClassFactoryRefCount == MAXULONG ? ^~~~~~~~ MAXLONG Dll.c:2943:38: Anmerkung: jeder nicht deklarierte Bezeichner wird nur einmal f³ jede Funktion, in der er vorkommt, gemeldet Dll.c: In Funktion ╗ClassFactory_CreateInstance½: Dll.c:3015:12: Fehler: ╗IExtractIconVtbl½ undeclared (first use in this functio ); did you mean ╗IExtractIconWVtbl½? (IExtractIconVtbl*)CoTaskMemAlloc( ^~~~~~~~~~~~~~~~ IExtractIconWVtbl Dll.c:3015:29: Fehler: expected expression before ╗)½ token (IExtractIconVtbl*)CoTaskMemAlloc( ^ Dll.c:3047:47: Fehler: ╗struct <anonym>½ hat kein Element namens ╗Extract½ (*(*(IcedTea_WebIconHandler*)*v).lpVtbl).Extract = ^ Dll.c:3048:7: Fehler: ╗ExtractIcon_Extract½ undeclared (first use in this funct on); did you mean ╗IExtractIconA_Extract½? ExtractIcon_Extract; ^~~~~~~~~~~~~~~~~~~ IExtractIconA_Extract Makefile.mingw:288: recipe for target 'Dll.o' failed mingw32-make: *** [Dll.o] Error 1

Error

JakeSmarter commented 4 years ago

Looks like your MinGW include path is not correct. See the MINGW_PATH makefile variable. Did you also install the Win32 API headers and libraries? I have not built this stuff in years, so I am not sure if the the latest public domain Win32 API headers still work with this code.

Btw, I think what you are rather looking for might be AdoptOpenJDK/IcedTea-Web.