I'm trying to compile an external Matlab function C code to use the function with my Matlab (2013a). When I type "make" I get an error "mex: command not found". How can I successfully compile the function? I'm using OS X 10.9.
To be more specific, I'm trying to install the function SVMStruct (from http://www.robots.ox.ac.uk/~vedaldi/code/svm-struct-matlab.html#ssvm.download) but lack of mex command on my mac prevents from doing so. Here is the complete error message
mex -largeArrayDims - CFLAGS='$CFLAGS -Wall' LDFLAGS='$LDFLAGS ' -outdir "build//" -c > "svm_struct_api.c"
/bin/sh: mex: command not found
make: *** [build//svm_struct_api.o] Error 127
Related
I am trying to compile the gjh solver - written in C - into an executable file in windows. It is available on netlib
I downloaded the c file and am using gcc compiler via WinGW on windows' command prompt. Trying to compile the gjh.c file directly gave me an error that says:
gjh.c:33:21: fatal error: getstub.h: No such file or directory
#include "getstub.h"
compilation terminated.
I assumed that compiling gjh.c requires the dependency getstub.h.
getstub.h is not the only dependency required, there are other dependencies, namely: arith.h, asl.h, funcadd.h, and stdio1.h. All of these files are available on the same link where I found getstub.h. However, arith.h0 and stdio1.h0 are available instead of arith.h and stdio1.h.
Are these files the same? I tried to rename the .h0 files to .h and tried to compile gjh.c, but I got this error:
collect2.exe: error: ld returned 1 exit status
Are the two files the same? If not, is there any way for me to compile the gjh solver successfully into an .exe?
If that's the only problem in compiling, try using the -I switch in gcc:
gcc -I/my/path/to/include/files -o gjh gjh.c
the -I switch hints to gcc where to find your #include files.
I am not sure about the stdio1.h. I think your approach to rename is OK but that reference to external functions such as Sprintf. You need to link with a library defining that. If you know where it comes from, use the -L and -l switch in gcc for that:
gcc -I/my/path/to/include/files -L/my/path/to/library -lnameoflibrary \
-o gjh gjh.c
I have tried to build my code dynamically and it worked as expected, however when I try to statically build with the option --ghc-options '-optl-static -fPIC' I got the follow error
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
any idea?
edit : I added the c tag since I though the gcc is somehow related to c and I guess the error related to c library
I'm trying to compile mDNS for ARMv6 to use in embedded applications on Axis cameras. I do this on Ubuntu 4.8.0-27. I'm not an expert on makefiles, but I tried to replace mDNSPosix' makefile gcc commands with Axis bundled arm-axis-linux-gnueabi-gcc, and run the makefile to compile this: https://opensource.apple.com/source/mDNSResponder/mDNSResponder-625.41.2/mDNSPosix/
It went okey until a certain line in the makefile that gave me this error:
strip: Unable to recognise the format of the input file `build/prod/mdnsd'
Makefile:251: recipe for target 'build/prod/mdnsd' failed
make: *** [build/prod/mdnsd] Error 1
The modified makefile: http://pastebin.com/wbhGC5s1
Any hints how to proceed with this error and change the makefile to work?
Thanks
I am trying to compile a hello world program using MinGW on Windows 10. I am compiling from the command prompt with just:
gcc hlw.c
However, I get the following error:
d:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
Obviously, my program does not use threads; it should just print one line to the output. What is going wrong?
I am a beginner in both linux and openwrt. Sorry if this is a stupid question.
I am following this tutorial : https://downloads.openwrt.org/docs/eclipse.pdf
Chip : MT7620
Toolchain Prefix : mipsel-openwrt-linux-
Toolchain Path : /ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14
Code:
#include <stdio.h>
void main()
{
printf("Hello World");
}
Error:
**** Build of configuration Debug for project hello ****
make all
Building target: hello
Invoking: Cross GCC Linker
mipsel-openwrt-linux-gcc -L/ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib -o"hello" ./main.o
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mipsel-openwrt-linux-musl/5.3.0/../../../../mipsel-openwrt-linux-musl/lib/crt1.o: In function `_start_c':
/ligo/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/musl-1.1.14/crt/crt1.c:17: undefined reference to `main'
/ligo/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/musl-1.1.14/crt/crt1.c:17: undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [hello] Error 1
add the following 2 lines at the end of bashrc
export PATH=$PATH:~/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin
export STAGING_DIR=~/openwrt/staging_dir
source ~/.bashrc
To open/create the bashrc you can execute
sudo gedit ~/.bashrc
Well I feel stupid when I have to figure this problem which happens too often.
I get the above error when I forget to save the file that contains main() it gives this error since the file is empty until you save it.
These instructions tell how to automatically save all the modified files when you kick off a build Save before build Keep this set and you won't see this again.
If you don't have the path to the toolchain set in eclipse, it never even finds a compiler, assembler or linker so it can not produce the error given. The warnings about STAGING_DIR are harmless in this case.