MXE Octave - How to pass flag to linker?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MXE Octave - How to pass flag to linker?

mmuetzel
Hello,

I am trying to test whether linking Octave in "Unicode mode" [1] might help to fix bug #47571.
For this I'd like to add the -municode linker flag to the linker when it links the Octave executable. But not when the configure tests are linked. How would I proceed to do this?

Thank you
Markus

[1] https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MXE Octave - How to pass flag to linker?

tmacchant




----- Original Message -----

> From: mmuetzel 
> To: octave-maintainers
> Cc:
> Date: 2017/4/5, Wed 23:01
> Subject: MXE Octave - How to pass flag to linker?
>
> Hello,
>
> I am trying to test whether linking Octave in "Unicode mode" [1] might
> help
> to fix bug #47571.
> For this I'd like to add the -municode linker flag to the linker when it
> links the Octave executable. But not when the configure tests are linked.
> How would I proceed to do this?
>
> Thank you
> Markus
>
> [1] https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/
>

Perhaps you should adjust src/default-octave.mk (dev. branch) or src/stable-octave.mk (stable branch).

Tatsuro

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MXE Octave - How to pass flag to linker?

mmuetzel
Tatsuro, thank you for your help.

So I might have been on the right track. I tried to add the switch here:
diff -r ce6c155a45ba src/default-octave.mk
--- a/src/default-octave.mk Wed Mar 29 07:54:36 2017 -0400
+++ b/src/default-octave.mk Tue Apr 04 22:15:01 2017 +0200
@@ -115,7 +115,9 @@
 else
   $(PKG)_PREFIX := '$(HOST_PREFIX)'
   $(PKG)_EXTRA_CONFIGURE_OPTIONS := \
-    LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR) -L$($(PKG)_QTDIR)/lib'
+    LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR) -L$($(PKG)_QTDIR)/lib -municode' \
+    CFLAGS='-DUNICODE -D_UNICODE' \
+    CXXFLAGS='-DUNICODE -D_UNICODE'
 endif

However with that switches, configure failed to link its test files. Probably because with that switches the expected entry point is "wmain()" instead of "main()". See also [2] for what I tried (and failed). I am clearly no expert in reading make files.

Where would I need to add those switches so they only apply when the Octave executables are linked?

[2] https://savannah.gnu.org/bugs/?47571
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MXE Octave - How to pass flag to linker?

tmacchant




----- Original Message -----

> From: mmuetzel 
> To: octave-maintainers
> Date: 2017/4/6, Thu 17:27
> Subject: Re: MXE Octave - How to pass flag to linker?
>
>T atsuro, thank you for your help.
>
> So I might have been on the right track. I tried to add the switch here:
> diff -r ce6c155a45ba src/default-octave.mk
> --- a/src/default-octave.mk    Wed Mar 29 07:54:36 2017 -0400
> +++ b/src/default-octave.mk    Tue Apr 04 22:15:01 2017 +0200
> @@ -115,7 +115,9 @@
> else
>    $(PKG)_PREFIX := '$(HOST_PREFIX)'
>    $(PKG)_EXTRA_CONFIGURE_OPTIONS := \
> -    LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR)
> -L$($(PKG)_QTDIR)/lib'
> +    LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR)
> -L$($(PKG)_QTDIR)/lib -municode' \
> +    CFLAGS='-DUNICODE -D_UNICODE' \
> +    CXXFLAGS='-DUNICODE -D_UNICODE'
> endif
>
> However with that switches, configure failed to link its test files.
> Probably because with that switches the expected entry point is
> "wmain()"
> instead of "main()". See also [2] for what I tried (and failed). I am
> clearly no expert in reading make files.
>
> Where would I need to add those switches so they only apply when the Octave
> executables are linked?
>
> [2] https://savannah.gnu.org/bugs/?47571
>


Perhaps you should add linker flag to add "-Wl,"

 -L$($(PKG)_QTDIR)/lib -Wl,-municode' \


Tatsuro

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MXE Octave - How to pass flag to linker?

mmuetzel
Now the error message changed to the following:

configure:6571: checking whether the C compiler works
configure:6593: x86_64-w64-mingw32-gcc -DUNICODE -D_UNICODE -I/path_to_mxe_octave/usr/x86_64-w64-mingw32/include -Wl,-rpath-link,/path_to_mxe_octave/usr/x86_64-w64-mingw32/lib,-municode -L/path_to_mxe_octave/usr/x86_64-w64-mingw32/lib -L/path_to_mxe_octave/usr/x86_64-w64-mingw32/qt5/lib conftest.c  >&5
/path_to_mxe_octave/usr/bin/x86_64-w64-mingw32-ld: unrecognised emulation mode: unicode
Supported emulations: i386pep i386pe
collect2: error: ld returned 1 exit status
configure:6597: $? = 1
configure:6635: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Octave"
| #define PACKAGE_TARNAME "octave"
| #define PACKAGE_VERSION "4.3.0+"
| #define PACKAGE_STRING "GNU Octave 4.3.0+"
| #define PACKAGE_BUGREPORT "http://octave.org/bugs.html"
| #define PACKAGE_URL "http://www.gnu.org/software/octave/"
| #define PACKAGE "octave"
| #define VERSION "4.3.0+"
| #define OCTAVE_SOURCE 1
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:6640: error: in `/path_to_mxe_octave/tmp-default-octave/octave-4.3.0+/.build':
configure:6642: error: C compiler cannot create executables


We might have a case of "you are probably using an old version of gcc that does not support this feature." [1]

I will try with gcc 5 that I should have around somewhere and report back.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MXE Octave - How to pass flag to linker?

tmacchant
----- Original Message -----

> From: mmuetzel 
> To: octave-maintainers
> Cc:
> Date: 2017/4/6, Thu 22:36
> Subject: Re: MXE Octave - How to pass flag to linker?
>
> Now the error message changed to the following:
>
> configure:6571: checking whether the C compiler works
> configure:6593: x86_64-w64-mingw32-gcc -DUNICODE -D_UNICODE
> -I/path_to_mxe_octave/usr/x86_64-w64-mingw32/include
> -Wl,-rpath-link,/path_to_mxe_octave/usr/x86_64-w64-mingw32/lib,-municode
> -L/path_to_mxe_octave/usr/x86_64-w64-mingw32/lib
> -L/path_to_mxe_octave/usr/x86_64-w64-mingw32/qt5/lib conftest.c  >&5
> /path_to_mxe_octave/usr/bin/x86_64-w64-mingw32-ld: unrecognised emulation
> mode: unicode
> Supported emulations: i386pep i386pe
> collect2: error: ld returned 1 exit status
> configure:6597: $? = 1
> configure:6635: result: no
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "GNU Octave"
> | #define PACKAGE_TARNAME "octave"
> | #define PACKAGE_VERSION "4.3.0+"
> | #define PACKAGE_STRING "GNU Octave 4.3.0+"
> | #define PACKAGE_BUGREPORT "http://octave.org/bugs.html"
> | #define PACKAGE_URL "http://www.gnu.org/software/octave/"
> | #define PACKAGE "octave"
> | #define VERSION "4.3.0+"
> | #define OCTAVE_SOURCE 1
> | /* end confdefs.h.  */
> |
> | int
> | main ()
> | {
> |
> |   ;
> |   return 0;
> | }
> configure:6640: error: in
> `/path_to_mxe_octave/tmp-default-octave/octave-4.3.0+/.build':
> configure:6642: error: C compiler cannot create executables
>
>
> We might have a case of "you are probably using an old version of gcc that
> does not support this feature." [1]
>
> I will try with gcc 5 that I should have around somewhere and report back.
>


After some investigation, I found  what I wrote for -Wl is wrong.

Sorry for the noise.

As you wrote in the bug tracker, John D. will help you.

Tatsuro

Loading...