This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Creating DLLs doesn't work normally..


> Hi all,
>
> A number of the projects which I am actively developing I have been
> trying to port to Cygwin. It has mostly gone without errors except when
> making shared libraries. For example:
>
> g++ -lm -lc -Wall -pedantic -ffast-math -g -ggdb -I../../src -I../.. -MD
> -MP -MF  '.depend' -DPLUGIN_BUILD -shared
> -Wl,-soname,static.so -o static.so static.cpp

Well for starters any libraries you link in (-l...) should go right at the
end of the g++ command line. And on Cygwin the '-soname' linker flag doesn't
do anything. Also you don't need to link to -lc on Cygwin, as it's Cygwin
(eg. libc == cygwin1.dll).

>  In file included from static.cpp:10: ../../src/think.h:18:15: warning:
anonymous variadic macros were introduced in C99
>  /cygdrive/c/DOCUME~1/joshk/LOCALS~1/Temp/cc0Qd530.o(.text+0x7c): In
function `module_init':
>  /home/joshk/think++/plugins/osc/static.cpp:38: undefined reference to
`thPlugin::SetDesc(char const*)'
>  /cygdrive/c/DOCUME~1/joshk/LOCALS~1/Temp/cc0Qd530.o(.text+0x143): In
function `module_callback':
>  /home/joshk/think++/plugins/osc/static.cpp:56: undefined reference to
`thNode::SetArg(char const*, float*, int)'
>  collect2: ld returned 1 exit status
>  make[3]: *** [static.so] Error 1
>
> However, on Linux the build executes without a hitch. I tried making .so
> .dll to no effect. This happens with ircd-hybrid too, so I'm wondering
> if I am missing something else. I have pored the archives already and
> I've not found a solution... Tried taking out -lm because it is already
> part of libcygwin. I'm at a total loss.

If you remove the '-soname' linker flag, change `-o soname.so' to `-o
soname.dll' and move '-lm' to the end, you should be alright.

Elfyn


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]