Convert matlab make from linux version to windows version - matlab

I have this linux makefile from public code and now I'm trying to use it on Windows
http://pastebin.com/gSqRFUvQ
This is what I have so far.
http://pastebin.com/iHugE5Z6
But I get an error on line 80.
echo "#include \"../src/gconv.cu\"" > "matlab/mex/gconv.cpp"
"/cygdrive/C/Program Files/Matlab2014b/bin/win64/mex" -lmwblas -largeArrayDims "matlab/mex/gconv.cpp" matlab/src/bits/im2col.obj matlab/src/bits/pooling.obj matlab/src/bits/normalize.obj -o "matlab/mex/gconv.mexw64" 2> >(sed 's/^\(.*\)(\([0-9][0-9]*\)): \([ew].*\)/\1:\2: \3/g' >&2)
Unknown MEX argument '-o'.
Makefile:79: recipe for target 'matlab/mex/gconv.mexw64' failed
make: *** [matlab/mex/gconv.mexw64] Error 127
Basically the argument -o doesn't exist. I'm sure what the author wanted by that parameter. But I think it should be -output since it will produce .mew64 file. If I change that into "-output", it gets error in the middle.
echo "#include \"../src/gconv.cu\"" > "matlab/mex/gconv.cpp"
"/cygdrive/C/Program Files/Matlab2014b/bin/win64/mex" -lmwblas -largeArrayDims "matlab/mex/gconv.cpp" matlab/src/bits/im2col.obj matlab/src/bits/pooling.obj matlab/src/bits/normalize.obj -output "matlab/mex/gconv.mexw64" 2> >(sed 's/^\(.*\)(\([0-9][0-9]*\)): \([ew].*\)/\1:\2: \3/g' >&2)
Building with 'Microsoft Visual C++ 2012'.
gconv.cpp
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\src\bits/mexutils.h(132) : error C3861: 'snprintf': identifier not found
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\src\bits/mexutils.h(147) : error C3861: 'snprintf': identifier not found
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(228) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(381) : warning C4267: 'argument' : conversion from 'size_t' to 'const int', possible loss of data
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(459) : warning C4267: 'argument' : conversion from 'size_t' to 'const int', possible loss of data
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(481) : warning C4267: 'argument' : conversion from 'size_t' to 'const int', possible loss of data
Makefile:79: recipe for target 'matlab/mex/gconv.mexw64' failed
make: *** [matlab/mex/gconv.mexw64] Error 127
Is it not possible to use this on windows? Could anyone shed some light?

You should be now able to use the same networks in newer MatConvNet versions as a Windows support was added (even though there are still some glitches in some configurations...).
Also the bugs which you are reporting here were fixed as well (at that time the code was not fixed for the MSC compiler).

Related

Error in ./configure step in installation of libpqxx

this is a bit of a long shot but:
I'm following this guide: https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
But when running ./configure I get the following error:
(previous checking lines omitted for brevity)
checking for main in -lpq... yes
checking for PQexec in -lpq... yes
checking for correct C++ linkage of basic libpq functions...
sed: character class syntax is [[:space:]], not [:space:]
configure: error:
Linking a call to libpq failed in C++, even though it succeeded in C. If your
C and C++ compilers are very different beasts, this may mean that we do not have
the right options for linking with it after all.
Read the config.log file for more detailed information. Look for the last error
message, which may be several pages up from the end of the file.
And the configure.log file looks like this:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpqxx configure 4.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
(some lines omitted)
configure:3039: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:3050: $? = 1
configure:3039: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
(some lines omitted)
configure:7629: gcc -E conftest.c
conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
(some lines omitted)
configure:8319: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
(some lines omitted)
configure:16424: g++ -o conftest -g -O2 -L/usr/lib/x86_64-linux-gnu conftest.cpp >&5
/tmp/ccfFBf4K.o: In function `main':
/home/peter/libpqxx-4.0/conftest.cpp:44: undefined reference to `PQexec'
collect2: error: ld returned 1 exit status
(some liens omitted)
I don't believe I have any packages missing. I have the newest version of g++, psql and libpqxx installed.
I have updated and upgraded all packages on my system.
I have crawled the web for solutions to this error, but I have no clue what is wrong.
Do you have an idea where I can go from here?
There hasn't been a tarball release of libpqxx at the old spot in a long time, so the tutorial you used with its wget command to download the tarball is very outdated.
The issue you encountered looks related to this issue and appears to have been fixed in this commit:
commit 85e9336740475be25ed19924cca0961f7d844c4b
Author: Jeroen Vermeulen <jtvjtv#gmail.com>
Date: Thu Jun 1 11:39:08 2017 +0700
Fix #13: not linking to libpq.
This was that annoying interaction between autoconf, m4, GNU sed syntax,
and the shell which broke the "remove redundant -lpq options" code in
the configure script.
Solution: forget about GNU sed's "[[:space:]]" syntax, and just look for
a literal space. There aren't going to be any tabs, newlines,
non-breaking spaces, etc. there in even a moderately sane world.

Makefile command line arguments confused with MinGW directory paths

I'm trying to run a make all command but I get a very confusing error, it seems as if the arguments from 'cl' are mistaken as directory paths in MinGW. The output I'm getting:
cl /EHsc /MD /nologo /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -nologo /O2 -DN
DEBUG -DUSE_CBC -DUSE_CLP /D__WIN32__ /Iinclude\\src\\windows /DGFLAGS_DLL_DECL=
/DGFLAGS_DLL_DECLARE_FLAG= /DGFLAGS_DLL_DEFINE_FLAG= /Iinclude /I. -DUSE_GLOP -
DUSE_BOP -c examples\\cpp\\costas_array.cc /Foobjs\\costas_array.obj
That's the cl command, not the warnings and errors (note that cl /EHsc actually gets mistaken for 'C:/MinGW/MSYS/1.0/EHsc', etc...):
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/EHsc', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/EHsc' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/MD', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/MD' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/nologo', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/nologo' ignored
... etc ... Until there's the fatal error at the end
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/I.', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/I.' ignored
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/Foobjs/costas_a
rray.obj' ignored
costas_array.cc
examples\cpp\costas_array.cc(27): fatal error C1083: Cannot open include file: '
ortools/base/callback.h': No such file or directory
make: *** [objs\\costas_array.obj] Error 2
Any help about why is this happening would be highly appreciated, I am not very experienced in this matter.
It's the MSYS shell doing these translations for you in an attempt of being helpful.
With the tools typically used in this shell, it's no problem because arguments/options start with a - or -- (the Unix and/or GNU convention). It starts getting into your way as soon as you need command-line tools following the Microsoft convention for options and flags, using /.
Unfortunately, for the original MSYS, I'm not aware of a way to disable this translation. But there is one for MSYS2, see the question I asked about it: You just need to set an environment variable, e.g.
export MSYS2_ARG_CONV_EXCL=\*
So, my suggestion would be you upgrade your tools to MSYS2 and use this.

Why can't MATLAB deploytool output exe file?

deploytool works well until creating exe file using mbuild then get this error:
Executing command: mbuild -O -v -output "U1" -I"e:\Mat2009\work\ntst1\U1\src" "e:\Mat2009\work\ntst1\U1\src\U1_main.c" "e:\Mat2009\work\ntst1\U1\src\U1_delay_load.c" "e:\Mat2009\work\ntst1\U1\src\U1_mcc_component_data.c" -link exe -env MCR_DELAYLOAD=/delayload:mclmcrrt710.dll -env
MCR_DELAYLIB=delayimp.lib -outdir "e:\Mat2009\work\ntst1\U1\src"
Error: An error occurred while shelling out to mbuild (error code = -1).
Unable to build executable.
??? Error using ==> mcc
Error executing mcc, return status = 1 (0x1).
How can I resolve this error?
This error looks similar to an error I encountered once (after upgrading to 2012b), I cannot recall the source but I found two potential solutions:
Make sure there are no spaces in the path to the compiler
Try building a few times and cross your fingers
Given the time frame I had I chose to go for option two and after 5-10 attempts it suprisingly worked.
have found that COMSPEC env. var had a wrong value, so I deleted the wrong path, restarted MATLAB then it worked well.

Perl Cross Compilation: MAKE

I've been trying to Cross Compile Perl-5.14.2 for NetBSD target from Linux machine.
Configure script successfully invoked with following options,
./Configure -des -Dusecrosscompile
-Dtargetarch=netbsd
-Dosvers=3.0.0
-Dtargethost=10.184.22.48
-Dtargetuser=username
-Dusrinc=.../sb1-mips/usr/include
-Dlibpth=.../xc-sb1-mips/netbsd/Lib/lib
-Dcc=.../mips64-netbsdelf-gcc
Once after Configured, make wasn't successful.
It breaks at different places right from creating miniperlmain.o file.
For example following error occurred while generating gv.o file:
gv.c: In function `Perl_try_amagic_un':
gv.c:2018: error: void value not ignored as it ought to be
gv.c:2029: error: void value not ignored as it ought to be
gv.c:2029: warning: cast from pointer to integer of different size
gv.c: In function `Perl_try_amagic_bin':
gv.c:2061: error: void value not ignored as it ought to be
gv.c:2063: error: void value not ignored as it ought to be
make: *** [gv.o] Error 1
Now to get rid of these errors I've passed two flags namely -DPERL_IMPLICIT_CONTEXT and -DPERL_GCC_BRACE_GROUPS_FORBIDDEN to C Compiler CCFLAGS which solved the problem.
Since it is a custom build, want to know about all of the CCFLAGS that have to be passed in order to achieve a successful build?
What does each flag mean?
Is their any documentation available?
Use vagrant. It has some OpenBSD and FreeBSD images. Hopefuly those will be compatible with NetBSD.
You can get a build environment very fast with that. Then you can transfer and build your code happily :)

Perl IPTables Module Installation Error

I've been trying to install the IPTables module for perl http://metacpan.org/pod/IPTables::IPv4 and I've been running into errors during installation.
I've tried installing using the CPAN in shell as well as downloading the tarball form the link above. Both installation give me errors. I am not sure how to get the dump from CPAN but what I can get is a dump of my shell when I run the MAKE file from the tarball:
[root#localhost IPTables-IPv4-0.98]# make
make -C libiptc/ all
make[1]: Entering directory `/home/student/Downloads/IPTables-IPv4-0.98/libiptc'
gcc -o libip6tc.o -c libip6tc.c -I../include -I/usr/src/linux/include -DIPTABLES_VERSION=\"1.2.8\" -O2 -Wall
In file included from libip6tc.c:111:0:
libiptc.c: In function ‘ip6tc_init’:
libiptc.c:312:10: warning: pointer targets in passing argument 5 of ‘getsockopt’ differ in signedness
/usr/include/sys/socket.h:190:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘int *’
libiptc.c: In function ‘target_name’:
libiptc.c:727:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
libip6tc.c: In function ‘ipv6_prefix_length’:
libip6tc.c:121:7: error: ‘const struct in6_addr’ has no member named ‘in6_u’
libip6tc.c:125:7: error: ‘const struct in6_addr’ has no member named ‘in6_u’
libip6tc.c: In function ‘dump_entry’:
libip6tc.c:201:3: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[1]: *** [libip6tc.o] Error 1
make[1]: Leaving directory `/home/student/Downloads/IPTables-IPv4-0.98/libiptc'
make: *** [libiptc/libiptc.a] Error 2
[root#localhost IPTables-IPv4-0.98]#
I would like to know what do I need to do so that I can install the module. Are there some dependencies that I need to install?
Your help is greatly appreciated.
The cpanratings and CPAN testers reports for this module make me think that you're wasting your time here.