vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

link of vl_nnconv.mexmaci64 failed, undefined symbol "_main" #449

Closed yi-ji closed 6 years ago

yi-ji commented 8 years ago

Hi,

I am compiling matconvnet on Mac OSX 10, MATLAB_R2014b, using vl_compilenn in matlab command line. And I got this one error:

vl_compilenn: MEX LINK: -outdir /usr/local/matconvnet/matlab/mex -lmwblas LDFLAGS=$LDFLAGS -framework Cocoa -framework ImageIO -largeArrayDims /usr/local/matconvnet/matlab/mex/.build/vl_nnconv.o /usr/local/matconvnet/matlab/mex/.build/bits/data.o /usr/local/matconvnet/matlab/mex/.build/bits/datamex.o /usr/local/matconvnet/matlab/mex/.build/bits/nnconv.o /usr/local/matconvnet/matlab/mex/.build/bits/nnfullyconnected.o /usr/local/matconvnet/matlab/mex/.build/bits/nnsubsample.o /usr/local/matconvnet/matlab/mex/.build/bits/nnpooling.o /usr/local/matconvnet/matlab/mex/.build/bits/nnnormalize.o /usr/local/matconvnet/matlab/mex/.build/bits/nnbnorm.o /usr/local/matconvnet/matlab/mex/.build/bits/nnbias.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/im2row_cpu.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/subsample_cpu.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/copy_cpu.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/pooling_cpu.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/normalize_cpu.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/bnorm_cpu.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/tinythread.o /usr/local/matconvnet/matlab/mex/.build/bits/imread.o /usr/local/matconvnet/matlab/mex/.build/bits/impl/imread_quartz.o

Warning: No source files in argument list. Assuming C source
         code for linking purposes. To override this
         assumption use '-fortran' or '-cxx'.

Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

mex: link of ' "/usr/local/matconvnet/matlab/mex/vl_nnconv.mexmaci64"' failed.

I have searched but found no solutions to this problem. Should I change a compiler or something? Please help, thank you.

SanchitAggarwal commented 8 years ago

Hi I got a similar error. I am compiling on Mac OSX 10.9.5, Matlab R2013a. Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

mex: link of ' "/matconvnet-1.0-beta18/matlab/mex/vl_nnconv.mexmaci64"' failed.

I tried changing compiler as suggested here but no progress Any help? Thank you

malzantot commented 8 years ago

I am having the same issue. with Matlab R2013a, and Mac OSX 10.11.3.

`    Warning: No source files in argument list. Assuming C source
             code for linking purposes. To override this
             assumption use '-fortran' or '-cxx'.

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
    mex: link of ' matconvnet-1.0-beta16/matlab/mex/vl_nnconv.mexmaci64"' failed.`

@SanchitAggarwal did you find a solution ?

SanchitAggarwal commented 8 years ago

Hi I turned off the flag for opts.enableImreadJpeg = false;

snailexe commented 7 years ago

Hello guys,

  I created a dummy cpp file, which has a dummy main function (int main{return 0}) and it solved the problem.