# Trying to compile libopenmetaverse getting [: x: unexpected operator



## redir (Apr 9, 2010)

I am trying to install openSIM on freeBSD 7.0 and I am running into a problem. I have the program compiled but when I run it I get an error that is described here: http://opensimulator.org/mantis/view.php?id=1913.

Here is the error: 


```
14:28:06 - Failed generating terrain map: System.DllNotFoundException: libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686
  at (wrapper managed-to-native) OpenMetaverse.Imaging.OpenJPEG:DotNetAllocDecoded (OpenMetaverse.Imaging.OpenJPEG/MarshalledImage&)
  at OpenMetaverse.Imaging.OpenJPEG.Encode (OpenMetaverse.Imaging.ManagedImage image, Boolean lossless) [0x00000]
  at OpenMetaverse.Imaging.OpenJPEG.EncodeFromImage (System.Drawing.Bitmap bitmap, Boolean lossless) [0x00000]
  at OpenSim.Region.CoreModules.World.WorldMap.MapImageModule.WriteJpeg2000Image (System.String gradientmap) [0x00000]
```

The dll file libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686 is definitely there in the same /bin directory so I am not sure why it throws a file not found exception. So I am thinking that maybe I need to recompile libopenmetaverse. I download the latest version and when I run the prebuild script I get the following:


```
toblocal# sh -vx runprebuild.sh
#!/bin/bash

mono bin/Prebuild.exe /target nant
+ mono bin/Prebuild.exe /target nant
Prebuild v2.0.3
Copyright (c) 2004-2008
Matthew Holmes (matthew@#.com),
Dan Moorehead (dan05a@#.com),
David Hudson (jendave@#.com),
Rob Loach (http://www.robloach.net),
C.J. Adams-Collier (cjac@#.org),
See 'prebuild /usage' for help

[!] Could not resolve Solution path: HttpServer
[!] Could not resolve Solution path: OpenMetaverse.Rendering.GPL
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
Creating NAnt build files
...Creating project: Dashboard
...Creating project: WinGridProxy
...Creating project: groupmanager
...Creating project: Heightmap
...Creating project: GridAccountant
...Creating project: OpenMetaverse.Utilities
...Creating project: AvatarPreview
...Creating project: mapgenerator
...Creating project: Baker
...Creating project: GridImageUpload
...Creating project: TestClient
...Creating project: OpenMetaverseTypes
...Creating project: OpenMetaverse.GUI
...Creating project: IRCGateway
...Creating project: OpenMetaverse.Rendering.Meshmerizer
...Creating project: PacketDump
...Creating project: GridProxy
...Creating project: OpenMetaverse
...Creating project: OpenMetaverse.Tests
...Creating project: PrimWorkshop
...Creating project: VisualParamGenerator
...Creating project: OpenMetaverse.StructuredData
...Creating project: OpenMetaverse.Http
...Creating project: GridProxyApp
...Creating project: VoiceTest
...Creating project: OpenMetaverse.Rendering.Simple
...Creating project: importprimscript

mono bin/Prebuild.exe /target monodev
+ mono bin/Prebuild.exe /target monodev
Prebuild v2.0.3
Copyright (c) 2004-2008
Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com),
David Hudson (jendave@yahoo.com),
Rob Loach (http://www.robloach.net),
C.J. Adams-Collier (cjac@colliertech.org),
See 'prebuild /usage' for help

[!] Could not resolve Solution path: HttpServer
[!] Could not resolve Solution path: OpenMetaverse.Rendering.GPL
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
Creating MonoDevelop combine and project files
...Creating project: Dashboard
...Creating project: WinGridProxy
...Creating project: groupmanager
...Creating project: Heightmap
...Creating project: GridAccountant
...Creating project: OpenMetaverse.Utilities
...Creating project: AvatarPreview
...Creating project: mapgenerator
...Creating project: Baker
...Creating project: GridImageUpload
...Creating project: TestClient
...Creating project: OpenMetaverseTypes
...Creating project: OpenMetaverse.GUI
...Creating project: IRCGateway
...Creating project: OpenMetaverse.Rendering.Meshmerizer
...Creating project: PacketDump
...Creating project: GridProxy
...Creating project: OpenMetaverse
...Creating project: OpenMetaverse.Tests
...Creating project: PrimWorkshop
...Creating project: VisualParamGenerator
...Creating project: OpenMetaverse.StructuredData
...Creating project: OpenMetaverse.Http
...Creating project: GridProxyApp
...Creating project: VoiceTest
...Creating project: OpenMetaverse.Rendering.Simple
...Creating project: importprimscript

mono bin/Prebuild.exe /target vs2005
+ mono bin/Prebuild.exe /target vs2005
Prebuild v2.0.3
Copyright (c) 2004-2008
Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com),
David Hudson (jendave@yahoo.com),
Rob Loach (http://www.robloach.net),
C.J. Adams-Collier (cjac@colliertech.org),
See 'prebuild /usage' for help

[!] Could not resolve Solution path: HttpServer
[!] Could not resolve Solution path: OpenMetaverse.Rendering.GPL
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
[!] Match returned no files: ./*.settings
[!] Match returned no files: ./*.ico
Creating Visual C# 2005 solution and project files
...Creating project: Dashboard
...Creating project: WinGridProxy
...Creating project: groupmanager
...Creating project: Heightmap
...Creating project: GridAccountant
...Creating project: OpenMetaverse.Utilities
...Creating project: AvatarPreview
...Creating project: mapgenerator
...Creating project: Baker
...Creating project: GridImageUpload
...Creating project: TestClient
...Creating project: OpenMetaverseTypes
...Creating project: OpenMetaverse.GUI
...Creating project: IRCGateway
...Creating project: OpenMetaverse.Rendering.Meshmerizer
...Creating project: PacketDump
...Creating project: GridProxy
...Creating project: OpenMetaverse
...Creating project: OpenMetaverse.Tests
...Creating project: PrimWorkshop
...Creating project: VisualParamGenerator
...Creating project: OpenMetaverse.StructuredData
...Creating project: OpenMetaverse.Http
...Creating project: GridProxyApp
...Creating project: VoiceTest
...Creating project: OpenMetaverse.Rendering.Simple
...Creating project: importprimscript


if [ x$1 == xnant ]; then
    nant -buildfile:OpenMetaverse.build
    RES=$?
    echo Build Exit Code: $RES
    if [ x$2 == xruntests ]; then
        nunit-console2 bin/OpenMetaverse.Tests.dll /exclude=Network /labels /xml=testresults.xml
    fi

    exit $RES
fi
+ [ x == xnant ]
[: x: unexpected operator

if [ x$1 == xprimrender ]; then
    nant -buildfile:OpenMetaverse.Rendering.GPL.build
    exit $?
fi
+ [ x == xprimrender ]
[: x: unexpected operator

if [ x$1 == xopenjpeg ]; then
   ARCH=`arch`
   cd openjpeg-dotnet
   if [ $ARCH == x86_64 ]; then
      # since we're a 64bit host, compile a 32bit vesion of openjpeg
      make ARCH=-i686 ARCHFLAGS=-m32 install
   fi
      # compile for default detected platform
      make install
fi
+ [ x == xopenjpeg ]
[: x: unexpected operator
toblocal#
```

Can you please explain to me what these errors mean and suggest any fixes? I feel like I'm just three minutes away from fixing this problem but I've been on it all day and am about to give up.

Maybe I need to recompile this program in the appropriate directory?

Thanks in advance.


----------



## redir (Apr 16, 2010)

bump


----------



## crsd (Apr 18, 2010)

Try changing == to =.


----------



## redir (Apr 23, 2010)

That didn't work crsd any other suggestions? Anyone?


----------



## DutchDaemon (Apr 23, 2010)

Have you fixed this by now?

```
#!/bin/bash
```


----------



## redir (Apr 23, 2010)

Yes DutchDaemon I have fixed this problem. I think perhaps that this library is only for Linux and not *BSD. Interestingly you have to compile it with gmake rather then make.

So now ofcourse I am onto the next issue which is trying to compile openjpeg-dotnet and I believe it's a similiar problem though both Make and gmake won't compile. I found the issue reported here: http://jira.openmv.org/browse/LIBOMV-383 but I am not advanced enough to understand it. If some one could make that human readable to me it may help.

Also I tried following the instructions here: http://opensimulator.org/wiki/Troub...ndException:_..2Flibopenjpeg-libsl-2.1.2.0.so and still run into problems again I am guessing it's *nix only. 

This is what I see for make:


```
toblocal# make
"Makefile", line 17: Missing dependency operator
"Makefile", line 20: Missing dependency operator
"Makefile", line 24: Need an operator
"Makefile", line 25: Missing dependency operator
"Makefile", line 29: Need an operator
"Makefile", line 30: Missing dependency operator
"Makefile", line 34: Need an operator
"Makefile", line 35: Missing dependency operator
"Makefile", line 38: Need an operator
"Makefile", line 39: Need an operator
make: fatal errors encountered -- cannot continue
```

And gmake:


```
toblocal# gmake
gcc -O3 -fPIC  -Ilibopenjpeg -c libopenjpeg/bio.c -o libopenjpeg/bio.o
In file included from libopenjpeg/opj_malloc.h:81,
                 from libopenjpeg/opj_includes.h:97,
                 from libopenjpeg/bio.c:32:
/usr/include/malloc.h:3:2: error: #error "<malloc.h> has been replaced by <stdlib.h>"
gmake: *** [libopenjpeg/bio.o] Error 1
```

This is the final hurdle to run the program OpenSim though so if I can fix this I should be good to go.

Perhaps I should start a new thread for this since the original thread has been solved?

Cheers


----------



## DutchDaemon (Apr 23, 2010)

No, you might as well continue here, because the main problem is still the same: getting something programmed for Linux to run under FreeBSD without it being in the ports tree. But that's too long a topic title.


----------

