Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-07 Thread Vincent Torri
On Thu, Mar 7, 2019 at 10:30 AM Matthias Apitz  wrote:
>
> Re/ crosscompiling: I'm used to do so on FreeBSD amd64 for x86 target,
> but never compiled something on FreeBSD/Linux for Windows.

use the mingw-w64 toolchain (sould be available in your freebsd distribution)

i686-w64-mingw32-gcc, etc... for 32 bits

x86_64-w64-mingw32-gcc, etc... for 64 bits

Vincent Torri

>The CPP files
> here in question were written years ago with some Microsoft Visual
> Studio (at least some artefacts around the CPP files say so). I think,
> it's enough and easy to write some makefiles in addition and if I could
> integrate this in our Jenkins CI on Linux this would be the finest solution.
>
> matthias
>
> --
> Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
> Public GnuPG key: http://www.unixarea.de/key.pub
> October, 7 -- The GDR was different: Peace instead of Bundeswehr and wars, 
> Druschba
> instead of Nazis, to live instead of to survive.
>
>
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-07 Thread Matthias Apitz
El día Thursday, March 07, 2019 a las 09:36:28AM +0100, Vincent Torri escribió:

> > Below is the (very short) list of missing pieces which I can't see on my
> > Windows file system.
> >
> > Any ideas?
> > -  -    
> >   --
> > [ ? ]  LIBGCC_S_SEH-1.DLL Error opening file. 
> > Das System kann die angege
> > [ ? ]  LIBSTDC++-6.DLLError opening file. 
> > Das System kann die angege
> 
> those 2 files are in your gcc installation directory. They must be
> copied in the directory of your DLL
> 
> > [D? ]  API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL Error opening file. 
> > Das System kann die angege
> > [D? ]  API-MS-WIN-CORE-WINRT-L1-1-0.DLL   Error opening file. 
> > Das System kann die angege
> > [D? ]  API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL  Error opening file. 
> > Das System kann die angege
> > [D? ]  API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLLError opening file. 
> > Das System kann die angege
> > [D? ]  DCOMP.DLL  Error opening file. 
> > Das System kann die angege
> > [D? ]  IESHIMS.DLLError opening file. 
> > Das System kann die angege
> 
> these above should be part of Windows.
> 
> normally you only need to copy the 2 above gcc dll where your dll is located.

I've copied the following DLLs into the place where my DLL SiPrinter.dll is:

-rwxr-xr-x+ 1 apitzm  Domain Users  354545  7. Mrz 08:27 SiPrinter.dll
-rwxr-xr-x+ 1 apitzm  Domain Users   78848  7. Mrz 09:53 
libgcc_s_seh-1.dll
-rwxr-xr-x+ 1 apitzm  Domain Users 1407488  7. Mrz 09:54 libstdc++-6.dll
-rwxr-xr-x+ 1 apitzm  Domain Users   53779  7. Mrz 09:58 
libwinpthread-1.dll

And this made the Java DLL loader happy. Thanks

Re/ crosscompiling: I'm used to do so on FreeBSD amd64 for x86 target,
but never compiled something on FreeBSD/Linux for Windows. The CPP files
here in question were written years ago with some Microsoft Visual
Studio (at least some artefacts around the CPP files say so). I think,
it's enough and easy to write some makefiles in addition and if I could
integrate this in our Jenkins CI on Linux this would be the finest solution.

matthias

-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
October, 7 -- The GDR was different: Peace instead of Bundeswehr and wars, 
Druschba
instead of Nazis, to live instead of to survive.


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-07 Thread Пётр Байкалов
Personally I use
PATH="/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH" ldd DEADBEEF.exe

which is not exactly what you would like but still better than simply
launching ldd.

чт, 7 мар. 2019 г. в 11:27, Matthias Apitz :

> El día Wednesday, March 06, 2019 a las 11:20:05AM -0800, David Grayson
> escribió:
>
> > Your experience matches mine: the Cygwin ldd utility does not work
> properly
> > with MinGW DLLs and prints a bunch of question marks.  There is an ntldd
> > utility you can use instead.  If it's not on your path already, I'm not
> > sure the best way to obtain it.  I just use MSYS2, because it's
> basically a
> > fork of Cygwin that makes it easy to install MinGW compilers and all the
> > other open source utilities you would need to build software on Linux,
> > including ntldd.
> >
> > --David
>
> David, thanks for your reply. Does this mean I could move to a Linux system
> with Mingw-w64 to produce the DLL for Windows there? This would be the
> first
> option as I do know less as nothing about Windows, but 30++ years about
> UNIX :-)
>
> This also would allow to produce the DLL together with the Java software
> on our Jenkins server hosted on Linux...
>
> Re/ my problem "Can't find dependent libraries." from the Java DLL loader,
> I found
> a thread in stackoverflow
>
> https://stackoverflow.com/questions/6092200/how-to-fix-an-unsatisfiedlinkerror-cant-find-dependent-libraries-in-a-jni-pro/6092576#6092576
> with a hint to a tool which analyses the DLL for missing dependencie (etc.)
> Below is the (very short) list of missing pieces which I can't see on my
> Windows file system.
>
> Any ideas?
>
> Thanks
>
> matthias
>
> $ cut -c1-100 short.txt
> | Module List
> |*
> *
> *
> * Legend: D  Delay Load Module   ?  Missing Module   6  64-bit
> Module  *
> * *  Dynamic Module  !  Invalid Module
>  *
> *E  Import/Export Mismatch or Load
> Failure *
> *
> *
>
> 
>
>Module File Time Stamp
>  Link Time Stamp   File Size
> -  -  
>   --
> [ ? ]  LIBGCC_S_SEH-1.DLL Error opening file.
> Das System kann die angege
> [ ? ]  LIBSTDC++-6.DLLError opening file.
> Das System kann die angege
> [D? ]  API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL Error opening file.
> Das System kann die angege
> [D? ]  API-MS-WIN-CORE-WINRT-L1-1-0.DLL   Error opening file.
> Das System kann die angege
> [D? ]  API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL  Error opening file.
> Das System kann die angege
> [D? ]  API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLLError opening file.
> Das System kann die angege
> [D? ]  DCOMP.DLL  Error opening file.
> Das System kann die angege
> [D? ]  IESHIMS.DLLError opening file.
> Das System kann die angege
> [  6]  API-MS-WIN-CORE-THREADPOOL-L1-1-0.DLL  09.01.2019 04:06
> 09.01.2019 04:07   4.608
> [D 6]  DWMAPI.DLL 09.07.2015 18:58
> 09.07.2015 18:53  82.944
> [DE6]  ESENT.DLL  11.03.2011 07:33
> 11.03.2011 07:22   2.565.632
> ...
>
>
> --
> Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/
> +49-176-38902045
> Public GnuPG key: http://www.unixarea.de/key.pub
> October, 7 -- The GDR was different: Peace instead of Bundeswehr and wars,
> Druschba
> instead of Nazis, to live instead of to survive.
>
>
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>


-- 
Байкалов Пётр

___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-07 Thread LRN
On 07.03.2019 11:26, Matthias Apitz wrote:
> El día Wednesday, March 06, 2019 a las 11:20:05AM -0800, David Grayson 
> escribió:
> 
>> Your experience matches mine: the Cygwin ldd utility does not work properly
>> with MinGW DLLs and prints a bunch of question marks.  There is an ntldd
>> utility you can use instead.  If it's not on your path already, I'm not
>> sure the best way to obtain it.  I just use MSYS2, because it's basically a
>> fork of Cygwin that makes it easy to install MinGW compilers and all the
>> other open source utilities you would need to build software on Linux,
>> including ntldd.
> 
> David, thanks for your reply. Does this mean I could move to a Linux system
> with Mingw-w64 to produce the DLL for Windows there? This would be the first
> option as I do know less as nothing about Windows, but 30++ years about
> UNIX :-)
> 

You must have heard of cross-compilation in all these 30++ years.
Cross-compilation is less convenient than using MSYS (since you have to have
buildsystem support, and be careful not to grab non-cross tools), but if you
are the developer of the program(s) you are compiling, and know your way around
autotools (or whatver buildsystem you're using) then it's perfectly doable.

Though that's not what David meant. He meant using MSYS (MSYS2, specifically),
which is, basically, Cygwin with serial numbers filed
off a few small changes that allow developers to trivially mix
native (GCC and binutils, specifically) and non-native (bash and perl,
specifically, for autotools) programs on Windows for the purpose of compiling
native Windows stuff.

If you use Cygwin to build native Windows software, you're cross-compiling. So
unless you need to do testing or do something else that involves running the
stuff you compile right after you get it, there's no advantage in
cross-compiling in Cygwin, as opposed to cross-compiling from Debian or
somesuch (and even then, you can achieve that on Linux too, by using Wine, it's
just more work than running Cygwin on Windows).



signature.asc
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-07 Thread Vincent Torri
On Thu, Mar 7, 2019 at 9:27 AM Matthias Apitz  wrote:
>
> El día Wednesday, March 06, 2019 a las 11:20:05AM -0800, David Grayson 
> escribió:
>
> > Your experience matches mine: the Cygwin ldd utility does not work properly
> > with MinGW DLLs and prints a bunch of question marks.  There is an ntldd
> > utility you can use instead.  If it's not on your path already, I'm not
> > sure the best way to obtain it.  I just use MSYS2, because it's basically a
> > fork of Cygwin that makes it easy to install MinGW compilers and all the
> > other open source utilities you would need to build software on Linux,
> > including ntldd.
> >
> > --David
>
> David, thanks for your reply. Does this mean I could move to a Linux system
> with Mingw-w64 to produce the DLL for Windows there? This would be the first
> option as I do know less as nothing about Windows, but 30++ years about
> UNIX :-)
>
> This also would allow to produce the DLL together with the Java software
> on our Jenkins server hosted on Linux...
>
> Re/ my problem "Can't find dependent libraries." from the Java DLL loader, I 
> found
> a thread in stackoverflow
> https://stackoverflow.com/questions/6092200/how-to-fix-an-unsatisfiedlinkerror-cant-find-dependent-libraries-in-a-jni-pro/6092576#6092576
> with a hint to a tool which analyses the DLL for missing dependencie (etc.)

dependency walker is a very nice tool too.

> Below is the (very short) list of missing pieces which I can't see on my
> Windows file system.
>
> Any ideas?
> -  -    
>   --
> [ ? ]  LIBGCC_S_SEH-1.DLL Error opening file. Das 
> System kann die angege
> [ ? ]  LIBSTDC++-6.DLLError opening file. Das 
> System kann die angege

those 2 files are in your gcc installation directory. They must be
copied in the directory of your DLL

> [D? ]  API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL Error opening file. Das 
> System kann die angege
> [D? ]  API-MS-WIN-CORE-WINRT-L1-1-0.DLL   Error opening file. Das 
> System kann die angege
> [D? ]  API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL  Error opening file. Das 
> System kann die angege
> [D? ]  API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLLError opening file. Das 
> System kann die angege
> [D? ]  DCOMP.DLL  Error opening file. Das 
> System kann die angege
> [D? ]  IESHIMS.DLLError opening file. Das 
> System kann die angege

these above should be part of Windows.

normally you only need to copy the 2 above gcc dll where your dll is located.

Vincent Torri

> [  6]  API-MS-WIN-CORE-THREADPOOL-L1-1-0.DLL  09.01.2019 04:06  
> 09.01.2019 04:07   4.608
> [D 6]  DWMAPI.DLL 09.07.2015 18:58  
> 09.07.2015 18:53  82.944
> [DE6]  ESENT.DLL  11.03.2011 07:33  
> 11.03.2011 07:22   2.565.632


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-07 Thread Matthias Apitz
El día Wednesday, March 06, 2019 a las 11:20:05AM -0800, David Grayson escribió:

> Your experience matches mine: the Cygwin ldd utility does not work properly
> with MinGW DLLs and prints a bunch of question marks.  There is an ntldd
> utility you can use instead.  If it's not on your path already, I'm not
> sure the best way to obtain it.  I just use MSYS2, because it's basically a
> fork of Cygwin that makes it easy to install MinGW compilers and all the
> other open source utilities you would need to build software on Linux,
> including ntldd.
> 
> --David

David, thanks for your reply. Does this mean I could move to a Linux system
with Mingw-w64 to produce the DLL for Windows there? This would be the first
option as I do know less as nothing about Windows, but 30++ years about
UNIX :-)

This also would allow to produce the DLL together with the Java software
on our Jenkins server hosted on Linux...

Re/ my problem "Can't find dependent libraries." from the Java DLL loader, I 
found
a thread in stackoverflow 
https://stackoverflow.com/questions/6092200/how-to-fix-an-unsatisfiedlinkerror-cant-find-dependent-libraries-in-a-jni-pro/6092576#6092576
with a hint to a tool which analyses the DLL for missing dependencie (etc.)
Below is the (very short) list of missing pieces which I can't see on my
Windows file system.

Any ideas?

Thanks

matthias

$ cut -c1-100 short.txt
| Module List |*
*  *
* Legend: D  Delay Load Module   ?  Missing Module   6  64-bit Module  *
* *  Dynamic Module  !  Invalid Module *
*E  Import/Export Mismatch or Load Failure *
*  *


   Module File Time Stamp   Link 
Time Stamp   File Size
-  -    
  --
[ ? ]  LIBGCC_S_SEH-1.DLL Error opening file. Das 
System kann die angege
[ ? ]  LIBSTDC++-6.DLLError opening file. Das 
System kann die angege
[D? ]  API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL Error opening file. Das 
System kann die angege
[D? ]  API-MS-WIN-CORE-WINRT-L1-1-0.DLL   Error opening file. Das 
System kann die angege
[D? ]  API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL  Error opening file. Das 
System kann die angege
[D? ]  API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLLError opening file. Das 
System kann die angege
[D? ]  DCOMP.DLL  Error opening file. Das 
System kann die angege
[D? ]  IESHIMS.DLLError opening file. Das 
System kann die angege
[  6]  API-MS-WIN-CORE-THREADPOOL-L1-1-0.DLL  09.01.2019 04:06  
09.01.2019 04:07   4.608
[D 6]  DWMAPI.DLL 09.07.2015 18:58  
09.07.2015 18:53  82.944
[DE6]  ESENT.DLL  11.03.2011 07:33  
11.03.2011 07:22   2.565.632
...


-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
October, 7 -- The GDR was different: Peace instead of Bundeswehr and wars, 
Druschba
instead of Nazis, to live instead of to survive.


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-06 Thread David Grayson
Your experience matches mine: the Cygwin ldd utility does not work properly
with MinGW DLLs and prints a bunch of question marks.  There is an ntldd
utility you can use instead.  If it's not on your path already, I'm not
sure the best way to obtain it.  I just use MSYS2, because it's basically a
fork of Cygwin that makes it easy to install MinGW compilers and all the
other open source utilities you would need to build software on Linux,
including ntldd.

--David

On Wed, Mar 6, 2019 at 4:44 AM Matthias Apitz  wrote:

>
>
> Hello,
>
> We have some bigger Java applications running as fat clients on
> Windows PC. These clients are using some Windows services, for example for
> printing, through some DLL written in C++ many years ago and then only
> compiled as 32-bit DLL. Moving forward to OpenJDK 1.8 with a 64-bit JRE
> we now struggle with compiling these DLL to a 64-bit version and I proposed
> here in my company to give mingw-w64 a try. I installed the recent version
> of mingw-w64 into Cygwin and can produce the 64-bit DLL this way (more or
> less without going through all details):
>
> LANG=C export LANG
> CC=/usr/bin/x86_64-w64-mingw32-gcc.exe
> DLL=SiPrinter_x64.dll
>
> for i in *.cpp; do
> ${CC}  -I/home/apitzm/jdk1.8.0_202/include
> -I/home/apitzm/jdk1.8.0_202/include/win32 -c ${i}
> done
>
> ${CC} -shared -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -o ${DLL} *.o
> -lwinspool -lstdc++ -lgdi32 -lcomdlg32
>
> The resulting SiPrinter_x64.dll causes in Java a class loader exception
> because
> there is someting missing:
>
> $ ldd SiPrinter_x64.dll
> ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7789)
> kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll
> (0x)
> KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll
> (0x7fefd66)
> ??? => ??? (0x6964)
> ^^^   
>
> and the loader exception is:
>
> java.lang.UnsatisfiedLinkError:
> C:\Users\apitzm\vb\SunRise\SRv70\Ausleih-Client\bin\SiPrinter.dll: Can't
> find dependent libraries
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
> at java.lang.Runtime.loadLibrary0(Runtime.java:870)
> at java.lang.System.loadLibrary(System.java:1122)
> at sisis.util.Printer.(Printer.java:67)
> at sisis.lib.drucker.GDIDrucker.(GDIDrucker.java:132)
> at sisis.app.btc.BTCApp.initDrucker(BTCApp.java:3419)
> at sisis.app.btc.BTCApp.(BTCApp.java:2840)
> at sisis.app.btc.BTCApp.main(BTCApp.java:1865)
> Exception: System.loadLibrary()
>
> What is missing in the DLL, also seen as a problem by the ldd-command?
>
> Thanks
>
> matthias
> --
> Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/
> +49-176-38902045
> Public GnuPG key: http://www.unixarea.de/key.pub
>
>
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-06 Thread Matthias Apitz


Hello,

We have some bigger Java applications running as fat clients on
Windows PC. These clients are using some Windows services, for example for
printing, through some DLL written in C++ many years ago and then only
compiled as 32-bit DLL. Moving forward to OpenJDK 1.8 with a 64-bit JRE
we now struggle with compiling these DLL to a 64-bit version and I proposed
here in my company to give mingw-w64 a try. I installed the recent version
of mingw-w64 into Cygwin and can produce the 64-bit DLL this way (more or
less without going through all details):

LANG=C export LANG
CC=/usr/bin/x86_64-w64-mingw32-gcc.exe
DLL=SiPrinter_x64.dll

for i in *.cpp; do
${CC}  -I/home/apitzm/jdk1.8.0_202/include 
-I/home/apitzm/jdk1.8.0_202/include/win32 -c ${i}
done

${CC} -shared -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -o ${DLL} *.o 
-lwinspool -lstdc++ -lgdi32 -lcomdlg32

The resulting SiPrinter_x64.dll causes in Java a class loader exception because
there is someting missing:

$ ldd SiPrinter_x64.dll
ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7789)
kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x)
KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll 
(0x7fefd66)
??? => ??? (0x6964)
^^^   

and the loader exception is:

java.lang.UnsatisfiedLinkError: 
C:\Users\apitzm\vb\SunRise\SRv70\Ausleih-Client\bin\SiPrinter.dll: Can't find 
dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at sisis.util.Printer.(Printer.java:67)
at sisis.lib.drucker.GDIDrucker.(GDIDrucker.java:132)
at sisis.app.btc.BTCApp.initDrucker(BTCApp.java:3419)
at sisis.app.btc.BTCApp.(BTCApp.java:2840)
at sisis.app.btc.BTCApp.main(BTCApp.java:1865)
Exception: System.loadLibrary()

What is missing in the DLL, also seen as a problem by the ldd-command?

Thanks

matthias
-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public