Plugin Installation?

Questions and answers about the how and why of making maps.
Post Reply
Bacon
Private First Class
Private First Class
Posts: 20
Joined: Mon May 04, 2009 3:30 pm

Plugin Installation?

Post by Bacon »

How do you install plugins to a Mac OS X? I've looked and looked on the forums but can't seem to find a tutorial which shows how to install plugins on the mac.
candy on me head n.n
User avatar
SkillDude
Private First Class
Private First Class
Posts: 336
Joined: Sun Apr 01, 2007 4:50 pm
Location: United States

Re: Plugin Installation?

Post by SkillDude »

Plugins are not installed per say. They have to be compiled on the system and then loaded. Plugin source files are .cpp and plugin compiled files are .so. Once you have a plugin compiled, you will be able to load it with the -loadplugin bzfs parameter.

However, into the specifics... First bzfs has to be enabled to allow plugins. The default configuration in 2.4.0 allows plugins by default, so unless you purposely disabled it that should not be a problem.

As for compiling the plugin, there are two ways you can do it. You can try compiling it manually by running your gcc compiler (I assume that's the compiler you would have on Mac) with -I (Include) and the location to bzfsAPI.h (And any other headers to include). The other method, though a little more complex will include all the headers for you and compile it automatically. You can do the second method by first running the newplug.sh script in the plugins directory. This will generate the necessary make files and plugin source files for you to get started. Then it tells you to modify the Makefile.am file in the plugin directory and configure.ac in the main bzflag directory. You have to find the list of directories of plugins and add your directory in for both files. Once that is done, you can rerun configure.sh and it will make that plugin on the next make run. Or halt and produce errors if it couldn't compile your plugin.

Hopefully you were able to understand those instructions. If you need even more details, reply or private message me. I ran through this information really quickly to just give you the basics. Also, the Wiki is always a good resource to look up information about this. (Though I do not see any specific plugin compiling articles so that may be why you are asking.)
Bacon
Private First Class
Private First Class
Posts: 20
Joined: Mon May 04, 2009 3:30 pm

Re: Plugin Installation?

Post by Bacon »

Thanks for the compiling tut, didn't know how to do that but now I do! but that didn't help :/ I didn't understand the wiki page thats why I had posted here. So i just load a plug-in by putting -loadplugin <path to where it is> and thats the end of it? The plug-in doesn't need to be put in a specific directory? Does the -loadplugin need to be put in a conf. file or just the map file itself?
candy on me head n.n
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Plugin Installation?

Post by allejo »

Nope. The plugin can be located anywhere. And the -loadplugin can go either in the configuration file or in the map file in the options block.
Bacon
Private First Class
Private First Class
Posts: 20
Joined: Mon May 04, 2009 3:30 pm

Re: Plugin Installation?

Post by Bacon »

Okay so putting it in the map file do I have to put it under options?
candy on me head n.n
Bacon
Private First Class
Private First Class
Posts: 20
Joined: Mon May 04, 2009 3:30 pm

Re: Plugin Installation?

Post by Bacon »

I tried by putting it in my conf. file but I kept getting this warning...

Code: Select all

Plugin: /Applications/BZFlag-2.4.0.app/Contents/PlugIns/airspawn.so not found, error dlopen(/Applications/BZFlag-2.4.0.app/Contents/PlugIns/airspawn.so, 9): no suitable image found.  Did find:
	/Applications/BZFlag-2.4.0.app/Contents/PlugIns/airspawn.so: can't map
WARNING: unable to load the plugin; /Applications/BZFlag-2.4.0.app/Contents/PlugIns/airspawn.so
Plugin: /Applications/BZFlag-2.4.0.app/Contents/PlugIns/fairCTF.so not found, error dlopen(/Applications/BZFlag-2.4.0.app/Contents/PlugIns/fairCTF.so, 9): no suitable image found.  Did find:
	/Applications/BZFlag-2.4.0.app/Contents/PlugIns/fairCTF.so: mach-o, but wrong architecture
WARNING: unable to load the plugin; /Applications/BZFlag-2.4.0.app/Contents/PlugIns/fairCTF.so
Plugin: /Applications/BZFlag-2.4.0.app/Contents/PlugIns/Hitpoints.so not found, error dlopen(/Applications/BZFlag-2.4.0.app/Contents/PlugIns/Hitpoints.so, 9): no suitable image found.  Did find:
	/Applications/BZFlag-2.4.0.app/Contents/PlugIns/Hitpoints.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00
WARNING: unable to load the plugin; /Applications/BZFlag-2.4.0.app/Contents/PlugIns/Hitpoints.so
candy on me head n.n
User avatar
SkillDude
Private First Class
Private First Class
Posts: 336
Joined: Sun Apr 01, 2007 4:50 pm
Location: United States

Re: Plugin Installation?

Post by SkillDude »

Did you compile this plugin yourself? If you didn't even compile it, a .so you found will more than likely not work as it was built elsewhere. Could it be a misspelling also? I don't think 'plugins' directories are generally spelled with a capital I or P. (At least the source one isn't. In fact, looks like you're not even dealing with the source directory trees from the looks of that file structure.)

If you did compile it yourself, can you tell us your OS and your procedure to compiling? That will help us track down the errors better. Also maybe a configure output / build output may be nice also. (In a separate attached file) If you used the gcc compiler or a compiler elsewhere to compile can you tell us the command you used?
Bacon
Private First Class
Private First Class
Posts: 20
Joined: Mon May 04, 2009 3:30 pm

Re: Plugin Installation?

Post by Bacon »

No I didn't compile it myself, I downloaded a plugin in .so format already. So I'm attempting your compiling guide and I got a bit confused at one part. How do I include bzfsAPI.h into the code?
candy on me head n.n
User avatar
SkillDude
Private First Class
Private First Class
Posts: 336
Joined: Sun Apr 01, 2007 4:50 pm
Location: United States

Re: Plugin Installation?

Post by SkillDude »

Alright, I assume you have the gcc compiler. If that is the case, you can use this command to include the bzfsAPI.h file and compile your plugin to .so. (I assume your plugin does not need plugin_utils.h. If so, you will need to include that too.

The command is:

Code: Select all

g++ -I /path/to/bzflag/include/ -shared -o plugin.so plugin.cpp
Now, in your bzflag source code, you should have an include directory. If you look in there, there rests a bzfsAPI.h file. You specify the exact path that is found in. For the plugin.so and plugin.cpp part, you can use absolute paths if you have to. The .so is the place the file will appear and the .cpp is the place the source plugin file is found. (Maybe I'll write up a BZFlag Plugin Compiling guide on the wiki also based on this post.)

Hope that helps you.
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Plugin Installation?

Post by allejo »

Sorry to ruin your train of thought sig. The only OS you need to compile the plugin for, is Linux. It was also stated in the very first post that this was Mac OS X. I'm currently not on my Mac right now, so I can't check, but I'm pretty sure the path to the plugin is wrong.

Bacon, right click on the BZFlag-2.4.0.app and "Show Package Contents." Then look for the plugins folder and you'll see the .so files there. Unless 2.4.0 was not shipped with prebuilt plugins, which I doubt is the case.
User avatar
SkillDude
Private First Class
Private First Class
Posts: 336
Joined: Sun Apr 01, 2007 4:50 pm
Location: United States

Re: Plugin Installation?

Post by SkillDude »

He is also using Hitpoints, which is why I wanted to make sure he was able to compile. Because there is no Mac OS X plugin version. And if you look at the error he got for trying to run that plugin:

Code: Select all

   /Applications/BZFlag-2.4.0.app/Contents/PlugIns/Hitpoints.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00
WARNING: unable to load the plugin; /Applications/BZFlag-2.4.0.app/Contents/PlugIns/Hitpoints.so
It isn't compiled correctly for that system.
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Plugin Installation?

Post by blast »

If you downloaded a .so from the forum, it was probably for Linux, not OSX. And it may have been for 2.0, not 2.4.

Ideally, you should be compiling the server and plugins from source from the latest SVN version (and keep it up to date). Most of the top servers do not run the released version - they run the "bleeding edge" code.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Plugin Installation?

Post by allejo »

My most sincerest apologies. PlugIns is the correct folder (I never knew that o.o). And Sig, I over saw that, thanks for pointing it out :)
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

Re: Plugin Installation?

Post by macsforme »

It does indeed look like plugins packaged with the OS X binary do not load (at least on some systems). Not sure how that one slipped past me, but will have to take a look later.
Post Reply