# ffmpeg: "libthr.so.3" and "libc.so.7" giving me fits



## Niatross (Aug 16, 2014)

I need to create a static ffmpeg executable on FreeBSD 9.3-RELEASE. I'm close but I still have two libraries that are giving me fits.

How do I compile ffmpeg so that the static libthr.a and libc.a libraries are included within the ffmpeg executable? Every time I compile ffmpeg from source and I do a `ldd ffmpeg`, I get the following:


```
libthr.so.3 => /lib/libthr.so.7 (0x28c2c000)
libc.so.7 => /lib/libc.so.7 (0x28c4d000)
```
All the other third-party static libraries (ex: libaacplus.a, libmp3lame.a, etc...) are added correctly and do not show up when I run the `ldd` command.


----------



## talsamon (Aug 20, 2014)

Maybe, this is what you want:

https://github.com/pyke369/sffmpeg


----------



## Niatross (Aug 20, 2014)

talsamon said:
			
		

> Maybe, this is what you want:
> 
> https://github.com/pyke369/sffmpeg


Tried that a few days ago so I wouldn't have to build my own static ffmpeg , but it has its own problems and throws Error 1 compile errors.


----------



## Niatross (Aug 20, 2014)

Let' go a step further.

Let's not even think about my problem of trying to create a static ffmpeg executable. Let's ask this question:

Has anyone created a static executable of any kind with the following two static libraries: libthr.a and libc.a?

If you did, how did you do it?


----------



## talsamon (Aug 20, 2014)

I never used it. But there's a Makefile flag 
	
	



```
BUILD_STATIC=YES
```


----------



## ljboiler (Aug 21, 2014)

```
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>

void* mythread( void* arg )
{
  return NULL;
}

int main( int argc, const char* const argv[] )
{
 pthread_t pthr;
 pthread_attr_t pthattr;

 int i;

 pthread_attr_init(&pthattr);
 pthread_attr_setdetachstate(&pthattr, PTHREAD_CREATE_DETACHED);

 while( 1 ) {
  for( i=100; i; i-- )
   if( pthread_create( &pthr, &pthattr, mythread, NULL ) != 0 )
    fprintf( stderr, "pthread_create failed\n" );

  putchar( '.' );
  fflush( stdout );
  usleep( 25000 );
 }
}
```

Build with the following command:

```
cc -o pthr1-static -pthread -static pth1.c
```
The result:

```
jimmy@jmobile:~/wsThreads % ldd pth1-static 
ldd: pth1-static: not a dynamic ELF executable
```


----------

