You are not logged in.

#1 2009-08-09 08:35:43

gnu_D
Member
From: Macedonia
Registered: 2007-10-21
Posts: 46

Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

Hi,

I need to compile a program for win with whatever open cross compiler, I tried mingw32-g++, with the following command>

i486-mingw32-g++ main.cpp main.h `/usr/i486-mingw32/bin/wx-config --libs` `/usr/i486-mingw32/bin/wx-config --cxxflags` -o test.exe

but now my program depends on the dll lib mingwm10.dll which kind a sucks cause my goal is to have one executable file.

Is there any other compiler or a command switch to make a static binary ?

Last edited by gnu_D (2009-08-10 11:07:59)


:: Python powered FOREVER ::

Offline

#2 2009-08-09 09:37:40

gnu_D
Member
From: Macedonia
Registered: 2007-10-21
Posts: 46

Re: Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

This is odd, I sent the compiled program to a friend, he says he can open it.
So this means I only need the dll for wine only, if that's true than I'm fine with it.
I shall make further tests.


:: Python powered FOREVER ::

Offline

#3 2009-08-09 10:32:48

gnu_D
Member
From: Macedonia
Registered: 2007-10-21
Posts: 46

Re: Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

It turns out that the guy got mingw on his computer, which means he has mingwm10.dll as a shared library sad.


:: Python powered FOREVER ::

Offline

#4 2009-08-10 01:09:22

winch
Member
Registered: 2008-04-13
Posts: 43

Re: Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

It looks like a google search for "mingwm10.dll dependency" leads to some info.

Offline

#5 2009-08-10 11:07:20

gnu_D
Member
From: Macedonia
Registered: 2007-10-21
Posts: 46

Re: Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

Ok, I did searched that, and I come up with this.

Which means I need to remove the -mthread option, there is only one problem, if I compile like this>

i486-mingw32-g++ `/usr/i486-mingw32/bin/wx-config --libs` `/usr/i486-mingw32/bin/wx-config --cxxflags` -o test.exe

then I have to expand the command like this>

i486-mingw32-g++ main.cpp main.h -Wl,--subsystem,windows -mwindows /usr/i486-mingw32/lib/libwx_mswu_richtext-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_aui-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_xrc-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_qa-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_html-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_adv-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_core-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_baseu_xml-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_baseu_net-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_baseu-2.8-i486-mingw32.a -lwxregexu-2.8-i486-mingw32 -lwxexpat-2.8-i486-mingw32 -lwxtiff-2.8-i486-mingw32 -lwxjpeg-2.8-i486-mingw32 -lwxpng-2.8-i486-mingw32 -lwxzlib-2.8-i486-mingw32 -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -I/usr/i486-mingw32/lib/wx/include/i486-mingw32-msw-unicode-release-static-2.8 -I/usr/i486-mingw32/include/wx-2.8 -D__WXMSW__-fno-rtti -o

If someone can scrap me a Makefile which will do that will be lovely.


:: Python powered FOREVER ::

Offline

#6 2009-08-10 12:44:16

Hohoho
Member
Registered: 2007-06-23
Posts: 222

Re: Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

Perhaps you could use something like this

`/usr/i486-mingw32/bin/wx-config --libs | sed -e 's/-mthread//'`

to get rid of -mthread?

Offline

#7 2009-08-10 12:46:51

gnu_D
Member
From: Macedonia
Registered: 2007-10-21
Posts: 46

Re: Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

Hohoho wrote:

Perhaps you could use something like this

`/usr/i486-mingw32/bin/wx-config --libs | sed -e 's/-mthread//'`

to get rid of -mthread?

No, I know this, I'm a BASH guy, I meant in a Makefile how to plant this wx-config thing.


:: Python powered FOREVER ::

Offline

#8 2009-08-11 11:46:03

gnu_D
Member
From: Macedonia
Registered: 2007-10-21
Posts: 46

Re: Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

Hohoho wrote:

Perhaps you could use something like this

`/usr/i486-mingw32/bin/wx-config --libs | sed -e 's/-mthread//'`

to get rid of -mthread?

Ok, I'll use that code, I didn't found a better alternative, ok so here is the Makefile>

BIN=bin/
SRC=src/

CXX=g++
WCXX=i486-mingw32-g++

CFLAGS=`wx-config --cxxflags`
LDLIBS =`wx-config --libs`
WCFLAGS=`/usr/i486-mingw32/bin/wx-config --cxxflags | sed 's/-mthreads//g'`
WLDLIBS =`/usr/i486-mingw32/bin/wx-config --libs | sed 's/-mthreads//g'`

EXECUTABLE=$(BIN)deliveryboy
WEXECUTABLE=$(BIN)deliveryboy-win32.exe

SOURCES=$(SRC)main.cpp $(SRC)main.h

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
    $(CXX) $(CFLAGS) $(OBJECTS) -o $(EXECUTABLE)

linux:
    $(CXX) $(SOURCES) $(LDLIBS) $(CFLAGS) -o $(EXECUTABLE)

win32:
    $(WCXX) $(SOURCES) $(WLDLIBS) $(WCFLAGS) -o $(WEXECUTABLE)

clean:
    rm -rf $(EXECUTABLE)
    rm -rf $(EXECDEB)

cleanw:
    rm -rf $(WEXECUTABLE)
    rm -rf $(WEXECDEB)

Maybe the code it's not clean, but sure helped me a lot.

I hope someone will have use of it too, if it's not working post a patch, cause I didn't test it, just pasted the original and I modified it a bit.


:: Python powered FOREVER ::

Offline

Board footer

Powered by FluxBB