Build under cygwin: SOLVED

Discussion related to AES Crypt, the file encryption software for Windows, Linux, Mac, and Java.
Post Reply
ahnkle
Posts: 1
Joined: Fri Nov 09, 2012 8:56 am

Build under cygwin: SOLVED

Post by ahnkle »

I am a user of cygwin (POSIX/linux tools running under windows). See here http://cygwin.com/ for more details.

I tried compiling the linux version of source aescrypt305_source.tar.gz, and it nearly worked by just extracting the source and running make.

I got an error

Code: Select all

gcc -Wall -D_FILE_OFFSET_BITS=64  -o aescrypt aescrypt.o aes.o sha256.o password.o
password.o:password.c:(.text+0x435): undefined reference to `_libiconv_open'
password.o:password.c:(.text+0x47b): undefined reference to `_libiconv'
password.o:password.c:(.text+0x4c3): undefined reference to `_libiconv_close'
password.o:password.c:(.text+0x4fd): undefined reference to `_libiconv_close'
password.o:password.c:(.text+0x50f): undefined reference to `_libiconv_close'
collect2: ld returned 1 exit status
Makefile:28: recipe for target `aescrypt' failed
make: *** [aescrypt] Error 1
The error can be worked around by entering the link line with the libiconv library mentioned specifically:

Code: Select all

gcc -Wall -D_FILE_OFFSET_BITS=64 \
    -o aescrypt aescrypt.o aes.o sha256.o password.o\
    -liconv
Regards,
ahnkle
damiank
Posts: 8
Joined: Wed Aug 01, 2012 4:58 pm

Re: Build under cygwin: SOLVED

Post by damiank »

There is a way better solution to compile under cygwin...

After un-zipping the archive for the source code, chdir into that directory and edit the Makefile:
nano Makefile

Now, at the top look for the line that says:
#Uncomment the line below to compile on Mac
#LIBS=-liconv

Go ahead and uncomment LIBS=-liconv

Then look for the like beginning with aescrypt: directly below this line it looks like this:
$(CC) $(CFLAGS) $(LIBS) -o $@ $^

Just add $(LIBS) to the very end so it looks like this:
$(CC) $(CFLAGS) $(LIBS) -o $@ $^ $(LIBS)

Do the exact same thing for the line starting with aescrypt_keygen and you're almost done.

"make install" is also broken, goto the section starting with install: and get rid of -o root -g root here:
install: aescrypt
install -o root -g root -m 755 aescrypt /usr/bin
install -o root -g root -m 755 aescrypt_keygen /usr/bin

Now you're all set, go ahead and do a make and make install.

Now, you have a working source tree. The reason this is the best way is because I had the same problem but didn't fix the Makefile. 3 mos later I had to put it on another machine, I copied the source, it's wouldn't build and I had to google how to fix it. This way, it'll always work saving you time and sanity.

Damian Kohlfeld
Post Reply