Showing posts with label MinGW. Show all posts
Showing posts with label MinGW. Show all posts

2009-09-14

Removing MinGW dll dependencies

libgcc_s_dw2-1.dll

Passing -static-libgcc will remove this dependency for all languages other than C.
Note: C++ exceptions depends on this option.

mingwm10.dll

Remove -mthreads option from your makefile.
Note: Multithreading and C++ exceptions depends on this option.

2009-09-09

2009-04-30

Mingw on Linux

I'm using MinGW for years, but never tried to use it on Linux machine as a crosscompiler. Today I've had first experience. First thing I've noticed is how actually easy to install such environment - there is a totally automated build script available from MinGW site.
Pros:
  • One environment
  • Speed. Native environment vs MSys is much, much faster.
Cons:
  • Building non-Linux things on Linux means transferring them from one machine to another.

2009-04-12

Gettext compilation on MSys

Trying to build gettext library on MSys I've got some errors related to pthread. Included readme states you need to have Cygwin for that. For those, who prefer MSys over Cygwin here goes a quick fix:
./configure
Add -lpthread to LIBS section in gettext-runtime/src/Makefile and gettext-tools/src/Makefile.
Remove tests target from gettext-runtime/Makefile and gettext-tools/Makefile.
make; make install
Be happy.

2009-04-07

Libiconv compilation sed on msys error

Trying to build libiconv library under msys environment, I've got sed related errors:
sed: -e expression #2, char 32: Extra characters after command
Fortunately, I've found a solution in the internet:
diff -ur tmp/libiconv-1.12/windows/windres-options src/libiconv-1.12/windows/windres-options
--- tmp/libiconv-1.12/windows/windres-options 2007-05-27 19:42:10 +0100
+++ src/libiconv-1.12/windows/windres-options 2008-05-28 13:41:03 +0100
@@ -14,20 +14,29 @@
fi
version="$1" # something like 2.0 or 2.17 or 2.17.3 or 2.17.3-pre3

-sed_extract_major='/^[0-9]/{s/^([0-9]*).*/1/p;q}
+sed_extract_major='
+/^[0-9]/{
+  s/^([0-9]*).*/1/p
+  q
+}
a
0
-q
'
-sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]([0-9]*).*/1/p;q}
+sed_extract_minor='
+/^[0-9][0-9]*[.][0-9]/{
+  s/^[0-9]*[.]([0-9]*).*/1/p
+  q
+}
a
0
-q
'
-sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]([0-9]*).*/1/p;q}
+sed_extract_subminor='
+/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{
+  s/^[0-9]*[.][0-9]*[.]([0-9]*).*/1/p
+  q
+}
a
0
-q
'

{
Credit goes to Keith Marshall.

2009-04-01

Add application icon on Eclipse with MinGW

source\resource.rc:
RESOURCE_ICON_APP ICON DISCARDABLE "../files/app.ico"
Project > Properties > C/C++ Build > Settings > Tool Settings > MinGW C++ Linker > Miscellaneous > Other objects:
Release\source\resource.o
Project > Properties > C/C++ Build > Settings > Build Steps > Pre-build steps > Command:
windres -i ..sourceresource.rc -o sourceresource.o

Create MinGW library from dll

For this, you need pexports tool from mingw-utils.
pexports library.dll > library.def
dlltool -D library.dll -d library.def -l library.dll.a
Note, that if dll was built by different environment than gcc, this probably will not work because of the naming conventions. If this the case, read here.