public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* shared Libary problems
@ 2011-11-15 21:31 Jim Harsh
  2011-11-15 21:52 ` René Berber
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jim Harsh @ 2011-11-15 21:31 UTC (permalink / raw)
  To: cygwin

I have a Smalltalk application that looks for a shared Library which
contains C and FORTRAN routines. This shared library has been called
BIEsharedLib.so regardless of the platform we run on, Windows, Linux or
originally Unix. On the Windows boxes we have used the Intel compilers
successfully for many years and in fact the latest versions of the Intel
compilers works so our Makefiles should be close. I wanted to give Cygwin a
try to see how it compares to the Intel compilers on my windows box.
(Windows 7). The code appears to compile OK but when doing the final
link/loading to build the shared Library I get the following.


 COLLECT_GCC_OPTIONS='-v' '-shared' '-W1,--out-implib,BIEsharedLib.dll.a'
'-o' '/cygdrive/c/BIE_work/ver747Dev/BIEsharedLib.so' '-shared-libgcc'
'-mtune=generic' '-march=i686'
 /usr/lib/gcc/i686-pc-cygwin/4.5.3/collect2.exe --wrap _Znwj --wrap _Znaj
--wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwjRKSt9nothrow_t --wrap
_ZnajRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap _ZdaPvRKSt9nothrow_t
--shared -Bdynamic --enable-auto-image-base -e __cygwin_dll_entry@12
--dll-search-prefix=cyg -o /cygdrive/c/BIE_work/ver747Dev/BIEsharedLib.so
/usr/lib/gcc/i686-pc-cygwin/4.5.3/crtbegin.o
-L/usr/lib/gcc/i686-pc-cygwin/4.5.3
-L/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../..
/cygdrive/c/BIE_work/ver747Dev/MAKE/TopCombinedDir/cpint.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/TopCombinedDir/xWinLib.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/FORTRAN/GREGS_F_STUFF/libGregs
F.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/FORTRAN/TriangulateP25/libP25F
.o /cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/PW_PRAD/libPRAD.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Cinterface/libcinter.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/GREGS_C_STUFF/libGregsC.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/BOBS_CONE_BEAM/librjm.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/3DSTUFF/lib3D.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/fftw/libfftw.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/rfftw/librfftw.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/libfftw_threads.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/librfftw_threads.
o /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/Tiff_WX/libtiff.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libmylib.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libladies.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libplot_10.o
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r6_86/lib/hm426.lib
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r6_86/lib/hd426.lib
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r3/jpeg/lib/libjpeg.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r3/zlib/lib/libz.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/fftw/libfftw.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/rfftw/librfftw.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/libfftw_threads.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/librfftw_threads.
a /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/Tiff_WX/libtiff.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libladies.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libmylib.a
/cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libplot_10.a -lX11 -lpthread
-lgfortran -lstdc++ -lgcc -lc -lm -lgfortran -lgcc_s -lgcc -lcygwin -luser32
-lkernel32 -ladvapi32 -lshell32 -lgcc_s -lgcc
/usr/lib/gcc/i686-pc-cygwin/4.5.3/crtend.o
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
Warning: .drectve `/DEFAULTLIB:"oldnames" /DEFAULTLIB:"uuid.lib"
/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" 3'
unrecognized
make: *** [/cygdrive/c/BIE_work/ver747Dev/BIEsharedLib.so] Error 1


Also I get an ld.exe.stackdump file containing

Exception: STATUS_ACCESS_VIOLATION at eip=610F54C1
eax=01750000 ebx=DF0DF046 ecx=6120E554 edx=611D8368 esi=018CB778
edi=01DE3858
ebp=00000078 esp=010ECA50 program=C:\cygwin\bin\ld.exe, pid 4924, thread
main
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame     Function  Args
      1 [main] ld 4924 exception::handle: Error while dumping state
(probably corrupted stack)


I searched the archive and that's where I got the idea to use the" -W1,
--out-implib,BIEsharedLib.dll.a" switch to get a .so vs a .dll file.

I use the following symbols during the build which seem to work fine under
Linux 

CC = gcc 
FORT = gfortran 
LD = gfortran


Using the Intel compilers on Windows I have the flowing define

CC = icl  /nologo /O2 /G7  -D__STDC__ -DWINDOZE 
FC = ifort  /nologo /O2 /G7 /W0
LD = link


If I change the LD symbol to "ld" for the cygwin attempt I get:

make: *** [/cygdrive/c/BIE_work/ver747Dev/BIEsharedLib.so] Error 1

The rest of the compile/link looks OK, at least all the routines appear to
be found in the libraries listed.


Any suggestions?

Thanks,
Jim



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared Libary problems
  2011-11-15 21:31 shared Libary problems Jim Harsh
@ 2011-11-15 21:52 ` René Berber
  2011-11-15 21:59 ` Charles Wilson
  2011-11-15 22:31 ` Tim Prince
  2 siblings, 0 replies; 4+ messages in thread
From: René Berber @ 2011-11-15 21:52 UTC (permalink / raw)
  To: cygwin

On 11/15/2011 3:31 PM, Jim Harsh wrote:

[snip]
> I searched the archive and that's where I got the idea to use the" -W1,
> --out-implib,BIEsharedLib.dll.a" switch to get a .so vs a .dll file.

The option is a lowercase L not a 1, i.e. -Wl,-out-implib,...
(you can use one dash for double dashed options).
-- 
René Berber



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared Libary problems
  2011-11-15 21:31 shared Libary problems Jim Harsh
  2011-11-15 21:52 ` René Berber
@ 2011-11-15 21:59 ` Charles Wilson
  2011-11-15 22:31 ` Tim Prince
  2 siblings, 0 replies; 4+ messages in thread
From: Charles Wilson @ 2011-11-15 21:59 UTC (permalink / raw)
  To: cygwin

On 11/15/2011 4:31 PM, Jim Harsh wrote:

>  COLLECT_GCC_OPTIONS='-v' '-shared' '-W1,--out-implib,BIEsharedLib.dll.a'
> '-o' '/cygdrive/c/BIE_work/ver747Dev/BIEsharedLib.so' '-shared-libgcc'
> '-mtune=generic' '-march=i686'
>  /usr/lib/gcc/i686-pc-cygwin/4.5.3/collect2.exe --wrap _Znwj --wrap _Znaj
> --wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwjRKSt9nothrow_t --wrap
> _ZnajRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap _ZdaPvRKSt9nothrow_t
> --shared -Bdynamic --enable-auto-image-base -e __cygwin_dll_entry@12
> --dll-search-prefix=cyg -o /cygdrive/c/BIE_work/ver747Dev/BIEsharedLib.so
> /usr/lib/gcc/i686-pc-cygwin/4.5.3/crtbegin.o
> -L/usr/lib/gcc/i686-pc-cygwin/4.5.3
> -L/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../..
> /cygdrive/c/BIE_work/ver747Dev/MAKE/TopCombinedDir/cpint.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/TopCombinedDir/xWinLib.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/FORTRAN/GREGS_F_STUFF/libGregs
> F.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/FORTRAN/TriangulateP25/libP25F
> .o /cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/PW_PRAD/libPRAD.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Cinterface/libcinter.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/GREGS_C_STUFF/libGregsC.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/BOBS_CONE_BEAM/librjm.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/C+Fortran/C/3DSTUFF/lib3D.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/fftw/libfftw.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/rfftw/librfftw.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/libfftw_threads.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/librfftw_threads.
> o /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/Tiff_WX/libtiff.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libmylib.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libladies.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libplot_10.o
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r6_86/lib/hm426.lib
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r6_86/lib/hd426.lib
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r3/jpeg/lib/libjpeg.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/hdf42r3/zlib/lib/libz.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/fftw/libfftw.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/rfftw/librfftw.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/libfftw_threads.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/FFTW/threads/librfftw_threads.
> a /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/Tiff_WX/libtiff.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libladies.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libmylib.a
> /cygdrive/c/BIE_work/ver747Dev/MAKE/Libraries/libplot_10.a -lX11 -lpthread
> -lgfortran -lstdc++ -lgcc -lc -lm -lgfortran -lgcc_s -lgcc -lcygwin -luser32
> -lkernel32 -ladvapi32 -lshell32 -lgcc_s -lgcc
> /usr/lib/gcc/i686-pc-cygwin/4.5.3/crtend.o
> collect2: ld terminated with signal 11 [Segmentation fault], core dumped
> Warning: .drectve `/DEFAULTLIB:"oldnames" /DEFAULTLIB:"uuid.lib"
> /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" 3'
> unrecognized
> make: *** [/cygdrive/c/BIE_work/ver747Dev/BIEsharedLib.so] Error 1
> 

You need to rebuild *ALL* of your libraries using cygwin (or use the
ones already distributed /with/ cygwin, e.g. jpeg, zlib, tiff, fftw)

It looks like you're trying to link cygwin code with libraries that were
built using a (native) windows-ish compiler, because those .drectve
statements are MSVC-specific (but may also be supported by intel).

--
Chuck

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared Libary problems
  2011-11-15 21:31 shared Libary problems Jim Harsh
  2011-11-15 21:52 ` René Berber
  2011-11-15 21:59 ` Charles Wilson
@ 2011-11-15 22:31 ` Tim Prince
  2 siblings, 0 replies; 4+ messages in thread
From: Tim Prince @ 2011-11-15 22:31 UTC (permalink / raw)
  To: cygwin

On 11/15/2011 4:31 PM, Jim Harsh wrote:

If you're depending on a specific C++ mangling to match what you've put 
in your build, bear in mind that no g++ will match any Visual Studio 
compatible C++ compiler.  Normal procedure is to use extern "C" on the 
C++ side and iso_c_interop on the Fortran side so as to remove mangling 
on both sides.  You may have better chances with the linux build 
procedure under cygwin, hoping that cygwin g++ may match linux g++.
If you normally embed options such as -O2 in your alias for the compiler 
name when using Intel compilers, you could do the same with gnu compilers.


-- 
Tim Prince

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-15 22:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-15 21:31 shared Libary problems Jim Harsh
2011-11-15 21:52 ` René Berber
2011-11-15 21:59 ` Charles Wilson
2011-11-15 22:31 ` Tim Prince

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).