bugGNU Octave - Bugs: bug #60437, Building MEX file fails (Windows)

 
 

bug #60437: Building MEX file fails (Windows)

Submitter:  None
Submitted:  Thu 22 Apr 2021 01:09:50 PM UTC
   
 
Category:  Documentation Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  Daniel Kollmann Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 6.2.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 24 Apr 2021 04:34:10 PM UTC, comment #13: 

Thanks for the feedback.

Closing report.

Markus Mützel <mmuetzel>
Group administrator
Fri 23 Apr 2021 02:13:00 PM UTC, comment #12: 

Okay, thank you Markus and John.

This fixes the issue for me.

Daniel

Daniel Kollmann <holoeye_dk>
Fri 23 Apr 2021 02:02:08 PM UTC, comment #11: 
Markus Mützel <mmuetzel>
Group administrator
Fri 23 Apr 2021 01:46:30 PM UTC, comment #10: 

You shouldn't call these executables directly unless you make sure to have set the necessary environment variables manually.
Like you already showed, you could use "octave.bat" which takes care of preparing the necessary environment.

Alternatively, you could probably use the msys2 shell that you can start with "cmdshell.bat" in Octave's root installation folder.

We could probably do a better job in documenting that. Maybe on the Wiki?
https://wiki.octave.org/Octave_for_Microsoft_Windows

Markus Mützel <mmuetzel>
Group administrator
Fri 23 Apr 2021 01:45:00 PM UTC, comment #9: 

Yeah the issue will be dont call octave-cli.exe directly, but use the .bat file as it sets required env vars needed for octave.

The same issue is probally for calling mkoctfile directly, unless it was called from the  cmdshell.bat, which sets the env vars needed.

John Donoghue <lostbard>
Group Member
Fri 23 Apr 2021 01:35:18 PM UTC, comment #8: 

Calling from the source folder:

C:\Users\dk\Desktop>"C:\Users\dk\AppData\Local\Programs\GNU Octave\Octave-6.2.0\mingw64\bin\octave-cli.exe" --eval "mex empty.cpp"

g++: error: Octave\Octave-6.2.0\mingw64\/include: No such file or directory
warning: mkoctfile: building exited with failure status
error: mex: building exited with failure status


Using mkoctfile:


C:\Users\dk\AppData\Local\Programs\GNU Octave\Octave-6.2.0\mingw64\bin>mkoctfile.exe C:\Users\dk\Desktop.empty.cpp

g++: error: Octave\Octave-6.2.0\mingw64\/include: No such file or directory
g++: error: C:\Users\dk\Desktop.empty.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.


Using octave.bat:

C:\Users\dk\Desktop>"C:\Users\dk\AppData\Local\Programs\GNU Octave\Octave-6.2.0\mingw64\bin\octave.bat" --no-gui --eval "mex empty.cpp"

This works as expected.

Daniel Kollmann <holoeye_dk>
Fri 23 Apr 2021 01:21:40 PM UTC, comment #7: 

How are you building the mex file, command line, or from within octave ?

What options are you providing to the mkoctfile call ?

John Donoghue <lostbard>
Group Member
Fri 23 Apr 2021 01:19:32 PM UTC, comment #6: 

Hm...
So it looks like that partition does have short file names.

Which command do you use to build the .mex file?

Markus Mützel <mmuetzel>
Group administrator
Fri 23 Apr 2021 01:15:28 PM UTC, comment #5: 

Hello Markus,

ah sorry, my bad.

Daniel



Here you go:

>> system(sprintf('dir /X %s', OCTAVE_HOME))

 Datenträger in Laufwerk C: ist Local Disk
 Volumeseriennummer: 3AA0-7639

 Verzeichnis von C:\Users\dk\AppData\Local\Programs\GNUOCT~1\OCTAVE~1.0\mingw64

23.04.2021  15:08    <DIR>                       .
23.04.2021  15:08    <DIR>                       ..
23.04.2021  15:10    <DIR>                       bin
23.04.2021  15:07    <DIR>                       com
04.04.2017  00:37               905 COPYIN~1.GL2 COPYING.GL2PS
04.04.2017  00:37            25.364 COPYIN~1.LGP COPYING.LGPL
23.04.2021  15:05    <DIR>                       doc
23.04.2021  15:08    <DIR>                       etc
07.04.2020  20:13           228.073              gl2ps.pdf
22.02.2020  13:41            19.578 GL2PST~2.C   gl2psTest.c
22.02.2020  13:41             5.697 GL2PST~1.C   gl2psTestSimple.c
23.04.2021  15:05    <DIR>                       include
23.04.2021  15:07    <DIR>                       info
23.04.2021  15:08    <DIR>                       lib
23.04.2021  15:05    <DIR>                       libexec
23.04.2021  15:05    <DIR>                       man
23.04.2021  15:05    <DIR>                       qt5
04.04.2017  00:37               509              README.txt
23.04.2021  15:06    <DIR>                       sbin
23.04.2021  15:07    <DIR>                       share
23.04.2021  15:08    <DIR>                       var
23.04.2021  15:06    <DIR>          X86_64~1     x86_64-w64-mingw32
               6 Datei(en),        280.126 Bytes
              16 Verzeichnis(se), 14.111.264.768 Bytes frei
ans = 0

Daniel Kollmann <holoeye_dk>
Fri 23 Apr 2021 01:11:27 PM UTC, comment #4: 

Or alternatively in the terminal:

dir /X C:\Users\USR\AppData\Local\Programs


If your user name isn't actually "USR", please replace it with the actual name in that command.

Markus Mützel <mmuetzel>
Group administrator
Fri 23 Apr 2021 01:03:16 PM UTC, comment #3: 

"OCTAVE_HOME" is an Octave function.

What does the following return for you in Octave?

system(sprintf('dir /X %s', OCTAVE_HOME))


Markus Mützel <mmuetzel>
Group administrator
Fri 23 Apr 2021 12:58:58 PM UTC, comment #2: 

Hello Markus,

thank you for looking at this.

I installed Octave using the official installer "octave-6.2.0-w64-installer.exe". The software installed in "C:\Users\USR\AppData\Local\Programs\GNU Octave\Octave6.2.0", which is the default path and contains a space.

The environment variable "OCTAVE_HOME" was not set.

Thanks again,
Daniel

Daniel Kollmann <holoeye_dk>
Thu 22 Apr 2021 05:38:31 PM UTC, comment #1: 

That is probably because Octave is installed in a path with spaces on a partition that doesn't use short file names.

Where did you install Octave?
What does the following return for you in Octave?

system(sprintf('dir /X %s', OCTAVE_HOME))


Markus Mützel <mmuetzel>
Group administrator
Thu 22 Apr 2021 01:09:50 PM UTC, original submission:  

When trying to build a MEX file, it fails with the following error:

g++: error: Octave\Octave-6.2.0\mingw64\/include: No such file or directory
warning: mkoctfile: building exited with failure status
error: mex: building exited with failure status

It seems that mkoctfile.exe does not correctly handle the backslashes in the path of the executable when generating the include path.

When I run the same with Octave 5.2.0, it works as expected.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #51311:  install_default_path.png added by holoeye_dk (31KiB - image/png - The default path as shown in the installer.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by holoeye_dk (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-24 mmuetzel Open/ClosedOpen Closed
    2021-04-24 mmuetzel StatusConfirmed Fixed
    2021-04-23 mmuetzel CategoryOctave Function Documentation
        Item GroupUnexpected Error or Warning Documentation
        StatusNeed Info Confirmed
    2021-04-23 holoeye_dk Attached File- Added install_default_path.png, #51311
    2021-04-22 mmuetzel StatusNone Need Info
    2021-04-22 rik5 Carbon-CopyRemoved 72865 -
    2021-04-22 rik5 SummaryBuilding MEX file fails Building MEX file fails (Windows)

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code