# Request for a new port



## dns (Mar 8, 2012)

Source url is http://tinyurl.com/7w85gdy here: http://www.gat3way.eu/hashkill/index.php?page=download
Soon http://tinyurl.com/7swvl7k new version: http://www.gat3way.eu/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=171&cntnt01returnid=15


----------



## SirDice (Mar 8, 2012)

Yeah, like I'm going to click on links I can't see where they lead to.

FreeBSD Porter's Handbook


----------



## phoenix (Mar 8, 2012)

Never understood the use of URL shortening services when posting URLs online.  Just post the entire, original URL.  It's not like we have a size limit here.

For print magazines, okay, short URLs make sense, since you don't have to type as much.  But online?  Just post the entire URL for everyone to see.


----------



## DutchDaemon (Mar 9, 2012)

Fixed.


----------



## Dereckson (Mar 9, 2012)

Hello,

*I. Configure to be patched*

The ./configure is linux-centric and will fail locating automake 1.9's config.guess and config.sub files, so you need to patch it to correctly locate config.sub or config.guess (or if you don't want to create the port, you can recreate the symbolic links).

`$ rm config.guess config.sub`
`# ln -s /usr/local/share/automake-1.4/config.guess config.guess`
`# ln -s /usr/local/share/automake-1.4/config.sub config.sub`

Then, it will fail again locating OpenSSL:


```
configure: error: Package requirements (openssl >= 0.9.8) were not met:

No package 'openssl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
```

I deleted the relevant ./configure OpenSSL test entries to test if the build is then possible, it's not elegant but it works.

*II. Build*

II.1 / Quickly (more precisely, trying to compile the second source file), it will complain about alloca.h missing:

```
md5md5.c:24:20: error: alloca.h: No such file or directory
```

The Mumble (a group-VOIP software, popular among gamers) FAQ contains an entry about that:

"When building 1.1.8 or earlier, build fails because of a missing alloca.h header. On FreeBSD, alloca() is declared in stdlib.h, so it's safe to comment the line out (in src/murmur/murmur_pch.h). This has been fixed in git for quite some time, and is apparently fixed in the port of 1.1.8." -- http://mumble.sourceforge.net/BuildingFreeBSD#alloca.h_missing

`$ grep -r alloca.h * | grep -vc svn`

```
99
```

In your port, a mass replace #include <alloca.h> by an empty string would work, but a more clean solution would be to submit a patch upstream, to make the software compile directly on FreeBSD (the configure script detects the OS and set a OS=FreeBSD for example, that will allow to tune with #ifdef/#ifndef the alloca.h include - if you're not yet familiar with C preprocessor directives, you'll more information about that at  http://www.phanderson.com/C/preprocess.html and http://en.wikipedia.org/wiki/C_prep...d.org/cgi/cvsweb.cgi/src/lib/libcrypt/crypt.h

Then, it will complain again about this crypt.h file. To solve that, comment the extern void _crypt_to64(char *s, u_long v, int n); line:

```
/* extern void _crypt_to64(char *s, u_long v, int n); */
```

II.3 / After those header issues, there is a more problematic problem: the build process wants to create a directory, it's not a best practice: this is the installer job, not the build one. And of course, it should be $PREFIX/share/hashkill, and not /usr/share/hashkill (by default /usr/local/share/hashkill). But well... Let's go on with a *mkdir /usr/share/hashkill* to see what happens next.

```
Making all in kernels
mkdir -p /usr/share/hashkill/kernels
mkdir: /usr/share/hashkill: Permission denied
*** Error code 1
```

II.4 / Next one is a Linux-centric one: 

```
threads.c:36:25: error: sys/sysinfo.h: No such file or directory
```

This will require to find why sysinfo is needed, and to replace the relevant function by FreeBSD specific codes.

You'll find more an example at the following URL:
http://www.freerainbowtables.com/phpBB3/viewtopic.php?f=5&t=663

To achieve compilation, I'm deleting the relevant function code (it means the software will compile but not run, as it's the entry point and threading code).

II.5 / (by the way, at each iteration, the Makefile recompiles all the files, you could improve it to compile not already compiled files.)

II.6 / Then, a problem for SSE2:

```
md5_sse2.c: In function 'MD5_SSE':
md5_sse2.c:39: error: '__m128i' undeclared (first use in this function)
md5_sse2.c:39: error: (Each undeclared identifier is reported only once
md5_sse2.c:39: error: for each function it appears in.)
```

According http://msdn.microsoft.com/en-us/library/26232t5c.aspx, it's a emmintrin.h. A quick look on /usr/include/emmintrin.h tell us it's standard a GCC part, so let's add it in the md5_sse2.c file:

```
#include <emmintrin.h>
```

That doesn't seem to fix the problem. Okay, let's drop SSE2 support for this file (and some others) to see the next issues:

```
#undef HAVE_SSE2
```

II.7 / Next, /usr/bin/ld: cannot find -ldl
This issue is an easy one to fix (cf. http://forums.freebsd.org/showthread.php?t=5799):

Edit src/Makefile around like 185 to remove -ldl from AM_CFLAGS.

II.8 / Next, we've another bunch of libcrypt, you should maybe check on a linux machine what libcrypt version is exactly required.

You'll note on the Archlinux packages dependencies are very low: http://aur.archlinux.org/packages.php?ID=39959

I'm stopping here, as it seems one of the first priority would to understand (i) what libcrypt headers contain on linux (ii) how to deal with SSE2 instructions.

III. Installation
Not tested.

IV. Cleaning

Don't forget to `# rm /usr/include/crypt.h /usr/include/alloca.h`

If you don't need it, `# rm -R /usr/share/hashkill`


----------

