Video Encoder 264 does not install, problem with LD flags

Hi all,

I have a big problem. I'm trying to install a 264 video encoder (JM 15.1, from H.264/AVC JM Reference Software Download) on OS X 10.5.5.

First of all I had to disable static compilation, because of this error:

ld_classic: can't locate file for: -lcrt0.o

I read about this on some forums and disabled static compilation in Makefile and it was solved. Now I get this error:

creating binary "../bin/lencod.exe"
ld: absolute addressing (perhaps -mdynamic-no-pic) used in _rc_init_GOP from obj/rc_quadratic.o not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs
collect2: ld returned 1 exit status

and here's the Makefile:

NAME=   lencod

### include debug information: 1=yes, 0=no
DBG?= 0
### Generate 32 bit executable : 1=yes, 0=no
M32?= 0
### include O level optimization : 0-3
OPT?= 3
### Static Compilation
STC?= 0

DEPEND= dependencies

BINDIR= ../bin
INCDIR= inc
SRCDIR= src
OBJDIR= obj

ADDSRCDIR= ../lcommon/src
ADDINCDIR= ../lcommon/inc

ifeq ($(M32),1)
CC=     gcc -m32
else
CC=     gcc 
endif

ifeq ($(STC),1)
ifeq ($(DBG),1)  ### Do not use static compilation for Debug mode
STC=0
STATIC=
else
STATIC= -static
endif
else
STATIC= 
endif

LIBS=   -lm $(STATIC)
AFLAGS=  
CFLAGS=  -std=gnu99 -pedantic -ffloat-store -fno-strict-aliasing -fsigned-char $(STATIC)
FLAGS=  $(CFLAGS) -Wall -I$(INCDIR) -I$(ADDINCDIR) -D __USE_LARGEFILE64 -D _FILE_OFFSET_BITS=64

OPT_FLAG = -O$(OPT)
ifeq ($(DBG),1)
SUFFIX= .dbg
FLAGS+= -g
else
SUFFIX=
FLAGS+= $(OPT_FLAG)
endif

OBJSUF= .o$(SUFFIX)

SRC=    $(wildcard $(SRCDIR)/*.c) 
ADDSRC= $(wildcard $(ADDSRCDIR)/*.c)
OBJ=    $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o$(SUFFIX)) $(ADDSRC:$(ADDSRCDIR)/%.c=$(OBJDIR)/%.o$(SUFFIX)) 
BIN=    $(BINDIR)/$(NAME)$(SUFFIX).exe

.PHONY: default distclean clean tags depend

default: messages objdir_mk depend bin 

messages:
ifeq ($(M32),1)
    @echo 'Compiling with M32 support...'
endif
ifeq ($(DBG),1)
    @echo 'Compiling with Debug support...'
    @echo 'Note static compilation not supported in this mode.'
endif
ifeq ($(STC),1)
    @echo 'Compiling with -static support...'
endif
ifeq ($(MMX),1)
    @echo 'Compiling with MMX support...'
endif

clean:
    @echo remove all objects
    @rm -rf $(OBJDIR)

distclean: clean
    @rm -f $(DEPEND) tags
    @rm -f $(BIN)

tags:
    @echo update tag table
    @ctags inc/*.h src/*.c

bin:    $(OBJ)
    @echo
    @echo 'creating binary "$(BIN)"'
    @$(CC) $(AFLAGS) -o $(BIN) $(OBJ) $(LIBS)
    @echo '... done'
    @echo

depend:
    @echo
    @echo 'checking dependencies'
    @$(SHELL) -ec '$(CC) $(AFLAGS) -MM $(CFLAGS) -I$(INCDIR) -I$(ADDINCDIR) $(SRC) $(ADDSRC)                  \
         | sed '\''s@\(.*\)\.o[ :]@$(OBJDIR)/\1.o$(SUFFIX):@g'\''               \
         >$(DEPEND)'
    @echo

$(OBJDIR)/%.o$(SUFFIX): $(SRCDIR)/%.c
    @echo 'compiling object file "$@" ...'
    @$(CC) -c -o $@ $(FLAGS) $<

$(OBJDIR)/%.o$(SUFFIX): $(ADDSRCDIR)/%.c
    @echo 'compiling object file "$@" ...'
    @$(CC) -c -o $@ $(FLAGS) $<

objdir_mk:
    @echo 'Creating $(OBJDIR) ...'
    @mkdir -p $(OBJDIR)

-include $(DEPEND)
  1. I found searched for this error and it seems that other people solved it by upgrading the Xcode to 3.1.2. But my Xcode version is 3.1.2!! I reinstalled it a couple of times and still get the same error. Maybe it's because I installed MacPorts on this a few weeks ago, and uninstalled it?? Maybe I'm not supposed to install the "Unix Development package" in the Xcode?

  2. I tried to add the LDFLAG in the Makefile, with
    -read_only_relocs suppress and I'm not sure it I'm putting it in the right place, and I don't know if that's even supposed to work. Anyway when I add it it diesn't work.

Does anyone have any ideas? If not, can someone try building JM from that link and see if they'll get the same problem? I'm out of ideas.

Many thanks.

If I was in your situation, I would simply try following the instruction in the error message:

Use '-read_only_relocs suppress' to enable text relocs

I tried, but I don't know if I did it right. Where am I supposed to add that option?