GithubHelp home page GithubHelp logo

mulle-kybernetik-tv / mulleapxsexample Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 45 KB

๐Ÿšฉ Apache Module based on MulleObjC

License: BSD 3-Clause "New" or "Revised" License

Shell 87.74% Makefile 4.94% C 3.96% Objective-C 3.05% CMake 0.30%

mulleapxsexample's Introduction

MulleAPXSExample

Works on Ubuntu Linux with apache2. This page is a collection of random thoughts. Read it all, if you want to reproduce this.

Research Findings

The apache daemon loads shared libraries with RTLD_GLOBAL. That means, that the global universe variable is shared between modules. Therefore only one global variable (not hashtable) universe exists and the modules share the libMulleObjC-standalone.so loaded by the first extension.

Care must be taken, that classes have differing names.

How to reproduce

Build as explained in Memo: Apache/Libtool/ObjC then also build the second example in src2 likewise. Also install the objc_example2.* files in ./apache2 into the mods-enabled folder of /etc/apache2 alongside the objc_example.* files.

Then check http://localhost/objc-example and http://localhost/objc-example2

Feature: Named Universes

This is done in by specifying -DOTHER_CFLAGS=-fobjc-universename=myuniverse.

Tweaks used to build the first universe

  1. Set MULLE_CRAFT_MULLE_OBJC_MAKE_FLAGS to -DSTANDALONE=ON, so that MulleObjC gets build as a shared library, but not the constituent static libraries.
  2. Specified a craftinfo for MulleObjC so that OTHER_CFLAGS is set to -fobjc-universename="vfl1848"
  3. Otherwise do as explained way below, and don't forget to copy the .so file.

Tweaks used to build the second universe

  1. remove the old stuff with mulle-sde clean all
  2. Specified a craftinfo for MulleObjC so that OTHER_CFLAGS is set to -fobjc-universename="vfl1849" (a different universename)
  3. Change the soname of the standalone library to libMulleObjC2-standalone.so
  4. rename built standalone library to libMulleObjC2-standalone.so and copy it to /usr/lib
  5. Go into src2 and make and make install

See: mulle-sde environment list

Memo: Apache/Libtool/ObjC

Libtool can not properly deal with the --whole-archive flag as researched by reading this and this mailthread.

This makes it not feasible to link ObjC code statically into a Libtooling environment such as an apache module. But linking a shared library to a C apache module is not a problem.

Build MulleObjC with STANDALONE.

Note: use tweak idea above

mulle-sde -v craft buildorder --release -- -DSTANDALONE=ON
sudo cp -a ../dependency/lib/libMulleObjC-standalone.so /usr/lib

Since we are going to install into /usr/lib a LD_RUN_PATH seems pointless.

Now build and install the module:

cd src
make
sudo make install
sudo apache2ctl restart

Again a LD_LIBRARY_PATH would be pointless, because the apache daemon doesn't seem to pick it up. Or we would have to edit /etc/apache2/envvars.

Install dependencies

This is a partial mulle-sde project.

mulle-sde MulleAPXSExample

Now you can let mulle-sde fetch the required dependencies and build the project for you:

mulle-sde craft buildorder

Build

Venture into the src directory and run make.

Read mulle_objc_example.c for more information.

Install

apache2 contains configuration files that need to be added after sudo make install

Debug

How to debug inside the apache.

$ sudo -s
# . /etc/apache2/envvars
# MULLE_SDE_TRACE_UNIVERSE=YES \
  MULLE_SDE_TRACE_ENABLED=YES \
  gdb /usr/sbin/apache2
gdb> set verbose on
gdb> run -X

mulleapxsexample's People

Contributors

mulle-kybernetik-tv avatar mulle-nat avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.