# FreeBSD, FreeSWITCH, zrtp



## royj (Jan 21, 2013)

Hi all
There is an error when compile FreeSWITCH from git on FreeBSD with configure --enable-zrtp


```
freeswitch-src/libs/libzrtp/include/zrtp_config.h:54:6: error: #error "Libzrtp can't detect software platform: use manual setup in zrtp_config_user.h"
```

It is possible, if you manually #define ZRTP_PLATFORM ZP_BSD in zrtp_config_user.h
The question is would anybody clarify where is in the code defining OS?


----------



## cpm@ (Jan 21, 2013)

Check you have added both lines in freeswitch-src/libs/libzrtp/include/zrtp_config_user.h:54:5:

```
/** \brief Constant to define ZRTP BSD platform */
#define ZP_BSD						107
```

Try build again.


----------



## royj (Jan 22, 2013)

They are there. It is interesting, where is defining on which platform building is? We need to define ZRTP_PLATFORM automatically.


----------



## royj (Jan 22, 2013)

I stopped here:
freeswitch-src/libs/libzrtp/include/zrtp_config.h:


```
/*
 * ZRTP PLATFORM DETECTION                                                     
 * If platworm is not specified manually in zrtp_config_user.h - try to detect it aytomatically
 */
#if !defined(ZRTP_PLATFORM)
#       if defined(ANDROID_NDK)
#               define ZRTP_PLATFORM ZP_ANDROID
#       elif defined(linux) || defined(__linux)
#               include <linux/version.h>
#               define ZRTP_PLATFORM ZP_LINUX
#       elif defined(__MACOSX__) || defined (__APPLE__) || defined (__MACH__)
#               define ZRTP_PLATFORM ZP_DARWIN
#       elif defined(_WIN32_WCE) || defined(UNDER_CE)
#               include <windef.h>
#               define ZRTP_PLATFORM ZP_WINCE
#       elif defined(__SYMBIAN32__)
#               define ZRTP_PLATFORM ZP_SYMBIAN
#       elif defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WIN32) || defined(__TOS_WIN__)
#               if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
#                       define ZRTP_PLATFORM ZP_WIN32_KERNEL
#               elif defined(_WIN64)
#                       define ZRTP_PLATFORM ZP_WIN32
#               else
#                       define ZRTP_PLATFORM ZP_WIN32
#               endif
#       endif
#endif
```

and can not find where (or how) is defining for example 'linux' that to add FreeBSD


----------



## cpm@ (Jan 22, 2013)

Is defined as well in zrtp_config.h

```
#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || defined(ZRTP_AUTOMAKE)
#       include "zrtp_config_unix.h"
```

Check revisions here.

Added in config.h to build support.

```
#ifndef __ZRTP_H__
#define __ZRTP_H__
 
[B]#include "zrtp_config_unix.h"[/B]

#include "zrtp_config.h"
#include "zrtp_base.h"
#include "zrtp_error.h"
```


----------



## royj (Jan 22, 2013)

OK. Possible I was incorrect because english is not my native language.

The question is
Where is in the code learning on which OS we are building.

Need to automatically assign an appropriate value for ZRTP_PLATFORM namely ZP_BSD 

To cpu82
Those what you suggested adding is already there. It is all from git, master branch. I realize that I may be inaccurate explain but your replies is some strange


----------



## cpm@ (Jan 23, 2013)

royj said:
			
		

> To cpu82
> Those what you suggested adding is already there. It is all from git, master branch. I realize that I may be inaccurate explain but your replies is some strange



Don't think so... Check out http://zfoneproject.com/docs/sdk/man/html/howto.html (*deprecated*).


----------



## cpm@ (Mar 2, 2013)

As quoted from http://zfoneproject.com/docs/sdk/man/html/group__zrtp__config.html:


> In order to specify platform manually, developer should define ZRTP_PLATFORM value. If ZRTP_PLATFORM is not defined - libzrtp will try to detect it automatically (see zrtp_config.h).



Please, read http://wiki.freeswitch.org/wiki/Installation_Guide#FreeBSD, explains as well how to installing from GIT.


----------



## royj (Mar 16, 2013)

Once again convinced do not ask in forums, but read the manuals.

This is the answer:

http://www.freebsd.org/doc/en/books/porters-handbook/porting-versions.html

This is the solution:


```
# cat ./zrtp_relative_diff
diff -cr ./freeswitch-orig/libs/libzrtp/configure.in ./freeswitch/libs/libzrtp/configure.in
*** ./freeswitch-orig/libs/libzrtp/configure.in 2013-03-16 20:03:32.151100861 +0400
--- ./freeswitch/libs/libzrtp/configure.in      2013-03-16 20:04:25.931359263 +0400
***************
*** 24,30 ****
    ;;
    *freebsd2* | *freebsd* | *netbsd* | *openbsd* | *osf[12]*)
    echo "------- START libzrtp configuration for BSD platform ------------"
-   AC_DEFINE(PLATFORM,ZP_BSD,BSD platform)
    ;;
    hpux* | irix* | linuxaout* | linux* | osf* | solaris2* | sunos4*)
    echo "------- START libzrtp configuration for Linux platform ------------"
--- 24,29 ----
diff -cr ./freeswitch-orig/libs/libzrtp/include/zrtp_config.h ./freeswitch/libs/libzrtp/include/zrtp_config.h
*** ./freeswitch-orig/libs/libzrtp/include/zrtp_config.h        2013-03-16 20:03:32.132993151 +0400
--- ./freeswitch/libs/libzrtp/include/zrtp_config.h     2013-03-16 20:07:15.787017033 +0400
***************
*** 19,24 ****
--- 19,26 ----
  #if !defined(ZRTP_PLATFORM)
  #     if defined(ANDROID_NDK)
  #             define ZRTP_PLATFORM ZP_ANDROID
+ #     elif defined(__FreeBSD__)
+ #             define ZRTP_PLATFORM ZP_BSD
  #     elif defined(linux) || defined(__linux)
  #             include <linux/version.h>
  #             define ZRTP_PLATFORM ZP_LINUX
```


----------



## cpm@ (Mar 16, 2013)

royj said:
			
		

> Once again convinced do not ask in forums, but read the manuals.



I'm only agree with you about read the manuals. Please, read how to mark a topic as [SOLVED].


----------

