0

I was checking out the portability of Objective-C via gnustep and ran into some problems... I mean everything works on my 2 machines but the major problem is if I run my application on a platform where gnustep is not pre-installed... So I want to build it with static libraries. But I ran into several problems:

1.) I cant find the static libaries under /usr/local/lib so the question came up do they even exist within gnustep?

2.) In case there are static libraries available how to integrate it correctly into my gcc command?

sudo gcc -o main main.m GameRef.m SDLApplication.m SDLEvent.m SDLImage.m SDLMap.m SDLSprite.m Settings.m Utility.m -I -static `gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS` -L `gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES` -lgnustep-base -lSDL -fconstant-string-class=NSConstantString  -std=c99 2>logFile

I'm currently using Ubuntu 12.04LTS and installed the SDL and Gnustep on one machine so the application runs fine... But not on the second because the shared libraries are missing so I need to add them as static but how?

ipmcc
  • 29,581
  • 5
  • 84
  • 147
Georg
  • 423
  • 3
  • 8
  • May be you can try to use anything that work like LD_LIBRARY_PATH and make it point to your so's installed location bundled with the application package? If that isn't possible, better ask on gnustep-list there are people with more experience of static platforms. – Fred Frith-MacDonald Aug 04 '13 at 16:38

1 Answers1

0

The libraries in /usr/local/lib and other system 'lib' directories will be dynamic. They can't be used as static (AFAIK), and finding them wouldn't really help.

I'm no expert with GNUstep, but it sounds like you are missing the Objective-C runtime. You will need to download the source code of the GNUstep libraries and frameworks, and then compile them into static libraries yourself.

Really, wrapping all of those frameworks into your application will just add unnecessary work for both you and your end users. Dynamic libraries exist for a purpose. There's no reason to have multiple copies of the same code on the filesystem. Just require GNUstep as a dependency. Although its a slight pain for the users, they only need to do it once, and with most distros, installation is only a command or two away.

eswick
  • 519
  • 4
  • 16
  • But that means that the end user need to install it manual right? Or should I just add a script which will install packages if needed? – Georg Aug 04 '13 at 01:37
  • The user will have to do it manually. It is not very difficult. A script wouldn't work that well, but think about it. Linux users are usually very adept. They won't get angry when they have to install dependencies. How hard is it to type "apt-get install GNUstep"/"yum install GNUstep"? (or whatever the package name is) – eswick Aug 04 '13 at 14:22
  • For example, it would be hard for Windows users to install GNUstep first. – Fred Frith-MacDonald Aug 04 '13 at 16:48