Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault with MinGW #408

Closed
zippy84 opened this issue Mar 20, 2016 · 3 comments
Closed

Segfault with MinGW #408

zippy84 opened this issue Mar 20, 2016 · 3 comments
Labels

Comments

@zippy84
Copy link

zippy84 commented Mar 20, 2016

I have compiled libvips in MinGW. When I try to run my program libvips crashes with a segfault. Gdb returns this backtrace:

#0  buffer_thread_free (buffer_thread=0x0) at buffer.c:176
#1  0x64b44982 in ?? ()
   from C:\Users\RR\Desktop\win_libs\xxx\libwinpthread-1.dll
#2  0x64b44d34 in ?? ()
   from C:\Users\RR\Desktop\win_libs\xxx\libwinpthread-1.dll
#3  0x75961287 in msvcrt!_itow_s () from C:\Windows\syswow64\msvcrt.dll
#4  0x75961328 in msvcrt!_endthreadex () from C:\Windows\syswow64\msvcrt.dll
#5  0x758033ca in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\syswow64\kernel32.dll
#6  0x77509ed2 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\SysWOW64\ntdll.dll
#7  0x77509ea5 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\SysWOW64\ntdll.dll
#8  0x00000000 in ?? ()

GCC is setup with:

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-5.3.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/i686-w64-mingw32/include --libexecdir=/mingw32/lib --with-gxx-include-dir=/mingw32/include/c++/5.3.0 --enable-bootstrap --with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
gcc version 5.3.0 (Rev1, Built by MSYS2 project)

libvips itself is configured with: https://gist.github.com/zippy84/5b9068ec3608557dde42

Is this a known issue?

@jcupitt
Copy link
Member

jcupitt commented Mar 21, 2016

It should work. Try a tiny test program and see if you can compile, link and run that. For example:

http://www.vips.ecs.soton.ac.uk/index.php?title=Hello_World

I would use the pre-built Windows binary, unless you have a very good reason to build vips yourself.

When I cross-compile from linux, I build programs with something like:

i686-w64-mingw32-gcc \
    -mms-bitfields -march=i686 \
    -I/home/john/GIT/build-win32/7.32/inst/include \
    -I/home/john/GIT/build-win32/7.32/inst/include/glib-2.0 \
    -I/home/john/GIT/build-win32/7.32/inst/lib/glib-2.0/include \
    myprog.c \
    -L/home/john/GIT/build-win32/7.32/inst/lib \
    -lvips -lz -ljpeg -lstdc++ -lxml2 -lfftw3 -lm -lMagickWand -llcms2 \
    -lopenslide -lcfitsio -lpangoft2-1.0 -ltiff -lpng14 -lexif \
    -lMagickCore -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 \
    -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl \
    -o myprog.exe

I don't know if that helps. pkg-config may help you set all these flags automatically, I don't know if msys supports it.

@jcupitt
Copy link
Member

jcupitt commented Mar 21, 2016

The pre-built vips binary should work with Visual Studio, that might be simpler. This is how vips works in node.js on Windows.

Though the C++ API will not work with MSVC sadly, you would have to rebuild that part.

@zippy84
Copy link
Author

zippy84 commented Mar 23, 2016

I have compiled GLib-2.4.6.2 for myself. This solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants