linking static libs on Windows

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

linking static libs on Windows

Programming Newbie
Sorry for what is probably a simple question, but I'm stumped.

I am running Octave 3.2.4 on Windows 7, installed using the precompiled version Octave-3.2.4_i686-pc-mingw32_gcc-4.4.0_setup.exe

I am trying a very simple test, in which I have created an oct file that calls a function in a static library file (.lib).  FWIW, I compiled the .lib using MSVC 2008 Express.

I'm compiling with the following:
mkoctfile -l add_vecs_fcn.lib add_vecs.cc

I get the following error when I compile (or, rather, when octave tries to link):
c:/octave/3.2.4_gcc-4.4.0/mingw32/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -l-LC:\Octave\3.2.4_gcc-4.4.0\lib\octave-3.2.4

Here's the version that includes verbose:
octave-3.2.4.exe:38> mkoctfile add_vecs.cc -l add_vecs_fcn.lib -v mingw32-g++-4.4.0-dw2 -c -I/usr/local/octmgw32_gcc-4.4.0-dw2/include  -IC:\Octave\3.2.4_gcc-4.4.0\include\octave-3.2.4 -IC:\Octave\3.2.4_gcc-4.4.0\include\octave-3.2.4\octave IC:\Octave\3.2.4_gcc-4.4.0\include -mieee-fp  -D_GLIBCXX_DLL -march=i686 -mtune=generic -O3 -Wall    add_vecs.cc -o add_vecs.o
mingw32-g++-4.4.0-dw2 -shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -shared-libgcc -Wl,--allow-multiple-definition -o add_vecs.oct  add_vecs.o  add_vecs_fcn.lib  -l -LC:\Octave\3.2.4_gcc-4.4.0\lib\octave-3.2.4 -LC:\Octave\3.2.4_gcc-4.4.0\lib -loctinterp -loctave  -lcruft -shared-libgcc -Wl,--allow-multiple-definition -llapack -lblas -lfftw3 -lfftw3f -
lreadline  -lncurses -liberty -lhdf5 -lz -lm  -lgdi32 -lws2_32 -luser32 -lkernel32 -lgfortran -lstdc++_s
c:/octave/3.2.4_gcc-4.4.0/mingw32/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -l-LC:\Octave\3.2.4_gcc-4.4.0\lib\octave-3.2.4
collect2: ld returned 1 exit status

Any ideas?

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: linking static libs on Windows

Programming Newbie
I've continued to work away at this, and the problem boils down to getting a .dll compiled under MSVC able to link with the mingw compiler. 

I've tried the instructions at
http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs
and the ones at
http://www.emmestech.com/moron_guides/moron1.html
without any luck. 

Any help appreciated....


On Wed, May 18, 2011 at 4:24 PM, Programming Newbie <[hidden email]> wrote:
Sorry for what is probably a simple question, but I'm stumped.

I am running Octave 3.2.4 on Windows 7, installed using the precompiled version Octave-3.2.4_i686-pc-mingw32_gcc-4.4.0_setup.exe

I am trying a very simple test, in which I have created an oct file that calls a function in a static library file (.lib).  FWIW, I compiled the .lib using MSVC 2008 Express.

I'm compiling with the following:
mkoctfile -l add_vecs_fcn.lib add_vecs.cc

I get the following error when I compile (or, rather, when octave tries to link):
c:/octave/3.2.4_gcc-4.4.0/mingw32/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -l-LC:\Octave\3.2.4_gcc-4.4.0\lib\octave-3.2.4

Here's the version that includes verbose:
octave-3.2.4.exe:38> mkoctfile add_vecs.cc -l add_vecs_fcn.lib -v mingw32-g++-4.4.0-dw2 -c -I/usr/local/octmgw32_gcc-4.4.0-dw2/include  -IC:\Octave\3.2.4_gcc-4.4.0\include\octave-3.2.4 -IC:\Octave\3.2.4_gcc-4.4.0\include\octave-3.2.4\octave IC:\Octave\3.2.4_gcc-4.4.0\include -mieee-fp  -D_GLIBCXX_DLL -march=i686 -mtune=generic -O3 -Wall    add_vecs.cc -o add_vecs.o
mingw32-g++-4.4.0-dw2 -shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -shared-libgcc -Wl,--allow-multiple-definition -o add_vecs.oct  add_vecs.o  add_vecs_fcn.lib  -l -LC:\Octave\3.2.4_gcc-4.4.0\lib\octave-3.2.4 -LC:\Octave\3.2.4_gcc-4.4.0\lib -loctinterp -loctave  -lcruft -shared-libgcc -Wl,--allow-multiple-definition -llapack -lblas -lfftw3 -lfftw3f -lreadline  -lncurses -liberty -lhdf5 -lz -lm  -lgdi32 -lws2_32 -luser32 -lkernel32 -lgfortran -lstdc++_s
c:/octave/3.2.4_gcc-4.4.0/mingw32/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -l-LC:\Octave\3.2.4_gcc-4.4.0\lib\octave-3.2.4
collect2: ld returned 1 exit status

Any ideas?

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave<span onmouseout="cancel = false; window.setTimeout(WRCHideContent, 1000);" onmouseover="WRCShowContent({&#39;rating&#39;:{&#39;value&#39;:100,&#39;weight&#39;:13},&#39;flags&#39;:{},&#39;ttl&#39;:3600,&#39;expireTime&#39;:&#39;20110519113630&#39;}, this.className);" class="wrc11" style="padding-right: 16px; width: 16px; height: 16px;">



_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave