Author Topic: Help using crinkler under gcc!  (Read 3130 times)

0 Members and 1 Guest are viewing this topic.

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2452
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
Help using crinkler under gcc!
« on: April 21, 2007 »
I started experimenting with 4k coding. Actually, I was thinking about coding one for the Pixelshow demoparty but the competition rules deny using a dropper. Originally, I've been based on auld's 1kb framework but now the executable is more than 10kb if I don't use the dropper and apacker (which only packs the com file). I needed a good exe packer for 4ks and I found crinkler.

Of course, it is not a cruncher that compresses my exe directly but I had to figure out how to use it as a linker. Ok, I have my object file and I write something like:
crinkler.exe /OUT:oglsmall.exe /SUBSYSTEM:WINDOWS /COMPMODE:FAST oglsmall.o

But I get the error: fatal error: LNK   0: could not find symbol '__imp__LoadLibraryA@4'

Ok,. maybe the libs that are used should be linked too or something but I either copy the object file and cruncher inside the lib directory of gcc and try again to get the same result or specfying the libs in the command line of crinkler (e.g. ...MPMODE:FAST libkernel32.dll ... etc.. oglsmall.o) doesn't work (produces another error message). Help!
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Help using crinkler under gcc!
« Reply #1 on: April 21, 2007 »
Optimus,

I dont know if this helps but here is a GCC crinkler compatible makefile I used for Inferno4k for Titan.

Code: [Select]
# Project: oglsmall
# crinkler version...

CC   = gcc.exe
CL   = crinkler.exe
CLFLAGS = /OUT:oglsmall.exe /PRIORITY:NORMAL /COMPMODE:SLOW /HASHSIZE:100 /HASHTRIES:40 /TRANSFORM:CALLS  /SUBSYSTEM:WINDOWS /RANGE:opengl32 /RANGE:glu32
OBJ  = main.o grodfis.o
LINKOBJ  = main.o grodfis.o
CLLIBS = kernel32.lib user32.lib gdi32.lib opengl32.lib glu32.lib winmm.lib msvcrt.lib
CLLIBPATH = /LIBPATH:"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib"
LIBS =  -lmingw32 -lopengl32 -lglu32 -lgdi32 -lkernel32 -luser32 -lm -lwinmm -mwindows -mno-cygwin -nostdlib -lmsvcrt
BIN  = oglsmall.exe
CFLAGS = -Os
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before oglsmall.exe all-after


clean: clean-custom
${RM} $(OBJ) $(BIN)

# crinkler ...
$(BIN): $(OBJ)
$(CL)  $(CLLIBPATH) $(CLFLAGS) $(CLLIBS) main.o grodfis.o
   
# normal linking
#$(BIN): $(OBJ)
# $(CC) $(LINKOBJ) -s -o "oglsmall.exe" $(LIBS)

main.o: main.c grodfis.o Makefile.win
$(CC) -c $(CFLAGS) main.c -o main.o

grodfis.o: grodfis.c grodfis.h
$(CC) -c $(CFLAGS) grodfis.c -o grodfis.o

I think the key point is to use libs, not dlls.

I used an older version of crinkler so...haventtested with newer versions.

Chris
Challenge Trophies Won:

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2452
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
Re: Help using crinkler under gcc!
« Reply #2 on: April 30, 2007 »
And now I finally got it to work, I run the final EXE, wait a lot in windows like nothing happened by the click, and then get a crash message :P

What? Would it be that I used the lib files I found in some masm32 package? Now I have to download a big M$ sdk to just get those libs :P
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Help using crinkler under gcc!
« Reply #3 on: April 30, 2007 »
I would have thought the ones with masm would be OK, or you could use the mingw ones which is a far smaller download than the whole Platform SDK...but let's face it, one day you will need the Platform SDK...

Jim
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Help using crinkler under gcc!
« Reply #4 on: April 30, 2007 »
And now I finally got it to work, I run the final EXE, wait a lot in windows like nothing happened by the click, and then get a crash message :P

What? Would it be that I used the lib files I found in some masm32 package? Now I have to download a big M$ sdk to just get those libs :P

Time to ask blueberry...hes really helpful, nice guy.

Chris
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2723
  • Karma: 485
    • View Profile
    • http://www.rbraz.com/
Re: Help using crinkler under gcc!
« Reply #5 on: April 30, 2007 »
Crinckler was designed for use with Visual C++ , yes you will need VC++ Platform SDK, you can download and install VC++ 2005 Express and install PSDK x86 part only (isn't that big to download), not sure if you can install only the PSDK without VC++ Express  :-\


Challenge Trophies Won: