# Not very happy about this "libobjc.so.2" problem



## Niatross (Dec 18, 2012)

I run "pkg_libchk" and receive the following messages regarding missing libraries:

```
enigma-1.01_11: /usr/local/bin/enigma misses libenet.so.2  
gnustep-back-0.22.0: /usr/local/GNUstep/System/Library/Bundles/libgnustep-back-022.bundle/libgnustep-back-022 misses libobjc.so.2
gnustep-back-0.22.0: /usr/local/GNUstep/System/Tools/font_cacher misses libobjc.so.2
gnustep-back-0.22.0: /usr/local/GNUstep/System/Tools/gpbs misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Applications/GSSpeechServer.app/GSSpeechServer misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/AudioOutput.nssound/AudioOutput misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/GSPrinting/GSCUPS.bundle/GSCUPS misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/GSPrinting/GSLPR.bundle/GSLPR misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/Sndfile.nssound/Sndfile misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/TextConverters/RTFConverter.bundle/RTFConverter misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Library/Libraries/libgnustep-base.so.1.24.0 misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/libgmodel.bundle/libgmodel misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/HTMLLinker misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/ColorPickers/NamedPicker.bundle/NamedPicker misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/autogsdoc misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/cvtenc misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/ColorPickers/StandardPicker.bundle/StandardPicker misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/defaults misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/ColorPickers/WheelPicker.bundle/WheelPicker misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/gdnc misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/gspath misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/make_strings misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/pl misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/pl2link misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/pldes misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plget misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plmerge misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plparse misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plser misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/sfparse misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/xmlparse misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Libraries/libgnustep-gui.so.0.22.0 misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Services/GSspell.service/GSspell misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/gclose misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/gcloseall misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/gopen misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/make_services misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/say misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/set_show_service misses libobjc.so.2
swt-3.5.2_2: /usr/local/lib/libswt-awt-gtk-3557.so misses libjawt.so
swt-devel-3.7.1_1,1: /usr/local/lib/libswt-awt-gtk-3738.so misses libjawt.so
```

What's all this about? Why would I be missing these libraries and how would I resolves these errors?

Note:
I'm using FreeBSD 9.0-RELEASE and Portmaster to upgrade my installed ports.

IMPORTANT:
Using "portmaster -r <port>" did not correct the issues (above).


----------



## Beeblebrox (Dec 18, 2012)

libobjc.so.2 is part of gcc and version 4.2 I believe (?), it should be located under /usr/local/lib. What version of gcc do you have installed? If you use a version > 4.2 then try to first deinstall & reinstall that. 

If you are just using the gcc supplied with world, and libobjc.so.2 is nowhere to be found then rebuild your world so that he missing library file is created.

If libobjc.so.2 (or other version) is infact there but you get this message then you should rebuild lang/gnustep-base and x11-toolkits/gnustep-gui


----------



## wblock@ (Dec 18, 2012)

As a general "how this happens", an example scenario.

The user installs a standard system including X and Firefox.  graphics/png is installed as a dependency; Firefox and many other programs need it.

Later on, a new version of png comes out and the port is upgraded.  The user installs this new version, but does not rebuild everything that depends on png.  All those programs are still looking for an old library that went away when png was upgraded.

So what should be done?  Several things:

1. Before upgrading or installing a new port, first read /usr/ports/UPDATING.  You only need to pay attention to entries that have been added since the last time you installed or upgraded.  Don't pick and choose, just look at all of them.  If any apply to your system (ports you have installed or instructions that apply to all systems), do them in order from oldest to newest.  Don't install or upgrade anything until you've caught up with the latest UPDATING changes.

2. When upgrading installed applications, use a port upgrade tool, either ports-mgmt/portmaster or ports-mgmt/portupgrade (or the -devel version).  These programs will look for programs that depend on the port being upgraded and rebuild them.  portmaster does it automatically, portupgrade has -r.

To fix the problems in post #1, figure out what port provided the missing libraries.  Install or reinstall that port, and force the port upgrade program to rebuild everything that depends on it.  My first guess would be lang/gcc46 for most of them.


----------



## Niatross (Dec 18, 2012)

How did you guys know what port "libobjc.so.2" belonged to?

The following commands could be used to find out what port a file belongs to, but if the file is missing, the following commands will not work:


```
find / -name libobjc.so.2
pkg_info -W </path/to/libobjc.so.2>
```

Is there a command or FreeBSD online database that I could go to to find out about which port a file belongs to?


----------



## Beeblebrox (Dec 18, 2012)

Sorry, not that simple (at least as-far-as-I-know).
Usually I just parse the name in my head: lib.obj.c = library.object.c



> but if the file is missing


So libobjc.so.2 is missing in /usr? I use lang/gcc46 and the file related to that is /usr/local/lib/gcc46/libobjc.so.3 and not libobjc.so.2.

If you are not using a separate gcc port, rebuild world.


----------



## Niatross (Dec 18, 2012)

The "libobjc.so.2 " file is not missing, but "pkg_libchk" thinks it is:


```
find / -name libobjc.so.2
/usr/local/lib/compat/libobjc.so.2
/usr/local/lib/gcc42/libobjc.so.2
/usr/local/lib32/compat/libobjc.so.2
```

I noticed that pkg_info lists two version of gcc:


```
gcc-4.2.5.20090325_5 GNU Compiler Collection 4.2
gcc-4.6.3           GNU Compiler Collection 4.6
```

Anyway, the "libobjc.so.3" library is installed for the lang/gcc46:


```
find / -name libobjc.so.3
/usr/local/lib/compat/libobjc.so.3
/usr/local/lib/gcc46/libobjc.so.3
/usr/local/lib32/compat/libobjc.so.3
```

I ran the following command to reinstall the gcc 4.6 port and the installation went fine:


```
portmaster -r gcc-4.6.3
```

I can't reinstall the following package because its deprecated:


```
gcc-4.2.5.20090325_5 GNU Compiler Collection 4.2
```

I'm still receiving the errors (above) about missing libraries. I'm starting to pull my hair out now. Does anybody have a gun?


----------



## kpa (Dec 18, 2012)

You have to recompile the port(s) that requires the missing libraries, in this case the gnustep-* ports. 

Ignore the libraries in the compat -directories, they won't be used by the linker when building ports. They are there only for compatibility with installed packages that need older versions of the shared libraries.


----------



## kpa (Dec 18, 2012)

I'm pretty sure that the reason why the lang/gcc42 is needed by those gnustep ports is that the base system GCC does not have the objective C compiler included.

If you can find a way to force those ports to use lang/gcc46 you wouldn't need to have lang/gcc42  installed.


----------



## Niatross (Dec 18, 2012)

kpa said:
			
		

> You have to recompile the port(s) that requires the missing libraries, in this case the gnustep-* ports.



In fact I recompiled "gnustep-base" (which also builds "gnustep-gui" and "gnustep-back") using the following command:


```
portmaster -r gnustep-base
```

All three build just fine but it still doesn't fix the problem.


----------



## Niatross (Dec 18, 2012)

> If you can find a way to force those ports to use lang/gcc46 you wouldn't need to have lang/gcc42  installed.



How come these "gnustep-*" ports still rely on lang/gcc42 and have not been upgraded to use lang/gcc46?


----------



## kpa (Dec 18, 2012)

This could do the trick if you put it in /etc/make.conf

```
GNUSTEP_WITH_GCC46=yes
```

Read the comments in /usr/ports/Mk/bsd.gnustep.mk


----------



## Niatross (Dec 19, 2012)

Receive a compile error when using:


```
GNUSTEP_WITH_GCC46=yes
```

The GCC42 compiler compiles everything fine but I still get the "libobjc.so.2" errors when running "pkg_libchk"

I created the following symbolic link for a half-ass resolution to the problem:


```
ln -s /usr/local/lib/gcc42/libobjc.so.2 /usr/local/lib/libobjc.so.2
```

Now, why in the hell am I having to create a symbolic like to get "gnustep-*" software to work?

Symbolic links are not a fix. This is a half-ass way to get around a problem. Obviously "libobjc.so.2" cannot be found in the "/usr/local/lib/gcc42" directory. It needs to be in the "/usr/local/lib" directory. Why is this?


----------



## Niatross (Dec 19, 2012)

*ldconfig - Directory Search Path*

I run "pkg_libchk" and receive the following messages regarding a missing "libobjc.so.2" library:

```
gnustep-back-0.22.0: /usr/local/GNUstep/System/Library/Bundles/libgnustep-back-022.bundle/libgnustep-back-022 misses libobjc.so.2
gnustep-back-0.22.0: /usr/local/GNUstep/System/Tools/font_cacher misses libobjc.so.2
gnustep-back-0.22.0: /usr/local/GNUstep/System/Tools/gpbs misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Applications/GSSpeechServer.app/GSSpeechServer misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/AudioOutput.nssound/AudioOutput misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/GSPrinting/GSCUPS.bundle/GSCUPS misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/GSPrinting/GSLPR.bundle/GSLPR misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/Sndfile.nssound/Sndfile misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/TextConverters/RTFConverter.bundle/RTFConverter misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Library/Libraries/libgnustep-base.so.1.24.0 misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Bundles/libgmodel.bundle/libgmodel misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/HTMLLinker misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/ColorPickers/NamedPicker.bundle/NamedPicker misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/autogsdoc misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/cvtenc misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/ColorPickers/StandardPicker.bundle/StandardPicker misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/defaults misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/ColorPickers/WheelPicker.bundle/WheelPicker misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/gdnc misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/gspath misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/make_strings misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/pl misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/pl2link misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/pldes misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plget misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plmerge misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plparse misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/plser misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/sfparse misses libobjc.so.2
gnustep-base-1.24.0: /usr/local/GNUstep/System/Tools/xmlparse misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Libraries/libgnustep-gui.so.0.22.0 misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Library/Services/GSspell.service/GSspell misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/gclose misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/gcloseall misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/gopen misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/make_services misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/say misses libobjc.so.2
gnustep-gui-0.22.0: /usr/local/GNUstep/System/Tools/set_show_service misses libobjc.so.2
```

The directory search path for ldconfig has the blue line before the red line. I need to set the red line before the blue line. How do I change the order of the ldconfig directory search path? Which one do I use? Do I use the "LD_LIBRARY_PATH" environment variable or should I use the "ldconfig_paths" setting in the "/etc/rc.conf" file


```
find / -name libobjc.so.2
[color="Blue"]/usr/local/lib/compat/libobjc.so.2[/color]
[color="Red"]/usr/local/lib/gcc42/libobjc.so.2[/color]
```


----------



## cpm@ (Dec 19, 2012)

Try the following options in your /etc/make.conf:

```
WITH_GNUSTEP_DEVEL=yes
GNUSTEP_WITH_LIBOBJC2=yes
```

Now devel/gnustep supports clang, please read the Quick Guide.


----------



## Niatross (Dec 21, 2012)

The gnustep-* ports that are installed are fine. The problem is the gnustep-* ports cannot find the "libobjc.so.2" library because the ldconfig directory search path has "/usr/local/lib/compat" before "/usr/local/lib/gcc42".

The gnustep ports do not want to use the "libobjc.so.2" library from the "/usr/local/lib/compat" directory. The gnustep-* ports want to use the libobjc.so.2 library from the "/usr/local/lib/gcc42" directory.

So, how do I change the order of the ldconfig directory search path? Post #13 explains what I'm trying to accomplish.


----------



## SirDice (Dec 21, 2012)

Read post #14 and rebuild the gnustep ports.


----------



## kpa (Dec 21, 2012)

Assuming none of your installed packages need the libraries in /usr/local/lib/compat you can empty the whole directory. The compat libraries are only there for allowing programs that depend on older versions of shared libraries to continue functioning.


----------



## Niatross (Dec 21, 2012)

SirDice said:
			
		

> Read post #14 and rebuild the gnustep ports.



I DO NOT need to compile the gnustep ports. They have been compiled and installed already. The "PROBLEM" is this: The gnustep ports are looking at the "ldconfig" search path and using the first "libobjc.so.2" library that it can find (AKA: "/usr/local/lib/compat"). This is the WRONG DIRECTORY!!!

I want the gnustep ports" to use the "libobjc.so.2" library in the /usr/local/lib/gcc42"

Anyway, can somebody please answer the question in post #13.

BTW: Post 14 will not work. You'll receive compiling errors if you use those settings.


----------



## SirDice (Dec 21, 2012)

Niatross said:
			
		

> Post #14 throws an "Error 1" compile error.


That's just a generic error that doesn't say much. Please post the full error.



> Anyway, can someone answer the question in post #13


It's already answered in #14. The correct way to handle this situation.


----------



## Niatross (Dec 21, 2012)

> It's already answered in #14. The correct way to handle this situation.



The following line in the /etc/rc.conf file places /usr/local/lib/gcc42 before /usr/local/lib/compat:


```
ldconfig_paths="/usr/local/lib/gcc42"
```

Problem solved. No more missing "libobjc.so.2" errors.


----------



## Beeblebrox (Dec 21, 2012)

> This could do the trick if you put it in /etc/make.conf
> GNUSTEP_WITH_GCC46=yes


Use /usr/local/buildflags.conf from sysutils/bsdadminscripts for port-by-port settings. Some ports do not build with threads enabled for example, and you can disable the thread on a per port basis for those ports which complain about it.


----------



## Niatross (Dec 22, 2012)

Beeblebrox said:
			
		

> Use /usr/local/buildflags.conf from sysutils/bsdadminscripts for port-by-port settings. Some ports do not build with threads enabled for example, and you can disable the thread on a per port basis for those ports which complain about it.



I'm interested in this buildflags.conf file. Tell us exactly what's in your buildflags.conf file to get the gnustep port to build successfully.


----------



## Beeblebrox (Dec 22, 2012)

Have you set up gcc46 as your new default compiler in /etc/make.conf? If not, this is how. You can do this in make.conf or buildflags.conf. The only thing I have that gets it done is (as already posted):

```
GNUSTEP_WITH_GCC46=	yes
```
If you are still having problems, I suspect you have not set gcc46 as the ports compiler. Go to the full thread from the link above to see a sample of some entries in my buildflags.conf


----------



## Niatross (Dec 24, 2012)

Beeblebrox said:
			
		

> Have you set up gcc46 as your new default compiler in /etc/make.conf?



Yes, I have set up gcc46 as my new default compiler in /etc/make.conf.

What command can I use to find out which gcc compiler (ex: 4.2.1 or 4.6.3) is being used when I build the base system (kernel and world)? 

In regards to ports, I can go to the port (ex: shells/bash) and execute the following command to display the compiler that will be used to build the port:


```
make -V CC
```

If it returns "cc", then the port will be compiled with gcc 4.2.1
If it returns "gcc46", then the port will be compiled with 4.6.3


----------



## Beeblebrox (Dec 24, 2012)

> when I build the base system (kernel and world)


You should not build the base system with anything other than what is supplied in the base system - that means either gcc42 or clang. Trying to build the base system from a gcc version installed from the ports tree is reserved for the "walking dead". If you want to buildworld with a better compiler than gcc42, you should try clang (HOWTO here).



> Yes, I have set up gcc46 as my new default compiler in /etc/make.conf.


Take a close look at the code you placed in make.conf. If you copied as-is, it means: "use gcc46 for building stuff under folder /usr/ports". It does not mention anything about /usr/src, which means that buildworld will default to base version of cc - whatever it is.



> to display the compiler that will be used to build the port


If you set your default ports compiler to gcc4* in make.conf or buildflags.conf, all ports will always use whatever gcc version you specified, UNLESS:

Unless, the port's Makefile specifically asks for a different gcc version, which happens to be the case for lang/gnustep-base, hence the necessary additional code to force another version of gcc.

In the future, should you run in to compile problems, it is worth wile to look at the port Makefile for clues.

Are you still unable to compile lang/gnustep-base?


----------



## Niatross (Dec 24, 2012)

Why do you say the following:


```
If you want to buildworld with a better compiler than gcc42, you should try clang
```

Why can't you buildkernel with clang? Why do you limit clang to buildworld only?


----------



## jb_fvwm2 (Dec 24, 2012)

*One other method, maybe quicker.*



			
				wblock@ said:
			
		

> As a general "how this happens", an example scenario.
> 
> The user installs a standard system including X and Firefox.  graphics/png is installed as a dependency; Firefox and many other programs need it.
> 
> ...



After trying pkg_libchk, it reported a slew of ports which depended upon older libraries. Howsoever, beginning the recompile of most of them I ran across the problem of many ports not having been rebuilt after the pcre bump. As I had too many installed to rebuild them all[1], one can write a short list (on paper of the ones one knows will be used, say, in the next year, and try running them without X running (at the command line).  I found that several large multi-hour-compile ports needed only a minor dependency bump, while many other lesser ports needed a full recompile that would not have been guessed at otherwise.  

[1] unless one has crafted some scriptable methodology; I know for a fact it can be done, but it may not be worth the while of anyone fixing such problems; it takes much less time to recompile a lesser number of ports (this way) than many more of them (if one has many installed.).

Sorry for the rough draft of a guide, though, and for it maybe not being the most convenient for those reading the thread who have only 
maybe a third of the number of "desktop" ports installed.


----------



## kpa (Dec 25, 2012)

Put up the full build log in for example pastebin, we can't even start to guess what is wrong with build if all the information is just "exit 1".


----------

