Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#11 compiling cinelerra [resend]

open
nobody
None
5
2001-11-03
2001-11-03
Anonymous
No

argh, I hate web based forms.

here's retry..

--------------------------------------------------------
compiling cinelerra.10280
quicktime.100101

Hello,

While Trying to compile current backup of cinelerra
(102801), I came across two compile errors:

=============================================================================
first one is more related to quicktime (quicktime.100101).

First compile error is as follows:

----------------------------

make[1]: Entering directory
`/usr/src/Video4linux/bcast/cinelerra/cinelerra'
g++ -o i686/cinelerra `cat i686/objs`
../quicktime/i686/libquicktime.a(dv.o): In function
`dv_init':
dv.o(.text+0x1a2): undefined reference to `mmx_ok'
../quicktime/i686/libquicktime.a(parse.o): In function
`dv_find_spilled_vlc':
parse.o(.text+0x480): undefined reference to `dv_peek_vlc'
../quicktime/i686/libquicktime.a(parse.o): In function
`dv_parse_ac_coeffs':
parse.o(.text+0x6e5): undefined reference to `dv_peek_vlc'
collect2: ld returned 1 exit status
make[1]: *** [i686/cinelerra] Error 1

----------------------------

the reason for it lies in quicktime/libdv/mmx.h

----------------------------

To use this library, simply include this header
file
and compile with GCC. You MUST have inlining
enabled
in order for mmx_ok() to work; this can be done by
simply using -O on the GCC command line.

/* Function to test if mmx instructions
are supported...
*/
inline extern int
mmx_ok(void)
{
/* Returns 1 if MMX instructions are
supported, 0 otherwise */
return ( mm_support() & 0x1 );
}

----------------------------

the fix is fairly simple

----------------------------

--- quicktime/Makefile-OLD Sat Nov 3 13:27:19 2001
+++ quicktime/Makefile Sat Nov 3 13:27:27 2001
@@ -15,7 +15,7 @@
endif

ifeq ($(USE_MMX), 1)
-CFLAGS += -DARCH_X86
+CFLAGS += -DARCH_X86 -O3

DVMMXOBJ = libdv/asmoff.h

=============================================================================

Second compile error is as follows:

----------------------------

gcc -DHAVE_LIBXXF86VM -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_OSS
-DHAVE_FIREWIRE
-D_REENTRANT -I../../libmpeg3 -I../../quicktime
-DX86_CPU -c -o
mblock_sub44_sads.o mblock_sub44_sads.c
mblock_sub44_sads.s: Assembler messages:
mblock_sub44_sads.s:329: Error: suffix or operands
invalid for `psrlq'
mblock_sub44_sads.s:330: Error: suffix or operands
invalid for `psrlq'
mblock_sub44_sads.s:331: Error: suffix or operands
invalid for `psrlq'
mblock_sub44_sads.s:332: Error: suffix or operands
invalid for `psrlq'
make: *** [mblock_sub44_sads.o] Error 1

----------------------------

The reason for this error is :

#define mmx_i2r(op,imm,reg) \ __asm__ __volatile__ (#op " %0, %%" #reg \ : /* nothing */ \ : "X" (imm) )

#define psrlq_i2r(imm,reg) mmx_i2r (psrlq,
imm, reg)

static __inline__ void shift_blk(const uint32_t
shift)
{
psrlq_i2r( shift,mm0);
psrlq_i2r( shift,mm1);
psrlq_i2r( shift,mm2);
psrlq_i2r( shift,mm3);
}

and shift is 'unsigned int';

----------------------------
more details:

__asm__ __volatile__ ("psrlq %0, %%mm0" : : "X"
(shift) );

Here we have "X" for type which pretty much means any.
However,
from intel data scheets it seems that

PSRLQ MEM REG << OKAY.
PSRLQ REG REG << WRONG.

and on similar note, first line is something what 'as'
will accept, while
second line is something what 'as' will not accept.
(the first line was generated by kgcc, second was
generated by gcc 3.0.2 from the above line)

psrlq 8(%ebp), %mm0
psrlq %eax, %mm0

thus the solution to the problem seem to make sure that
PSRLQ uses "mem reg"
options.

----------------------------

so the suggested patch is:
- make sure m2r is actually indeed memory to register
- change shift_blk to actually use m2r instead of i2r.

--- plugins/mpeg2enc/mmx.h-OLD Sat Nov 3 13:22:31 2001
+++ plugins/mpeg2enc/mmx.h Sat Nov 3 13:21:31 2001
@@ -46,7 +46,7 @@
#define mmx_m2r(op,mem,reg) \ __asm__ __volatile__ (#op " %0, %%" #reg \ : /* nothing */ \ - : "X" (mem))
+ : "m" (mem))

#define mmx_r2m(op,reg,mem) \ __asm__ __volatile__ (#op " %%" #reg ", %0" \ --- plugins/mpeg2enc/mblock_sub44_sads.c-OLD Sat Nov
3 11:18:04 2001
+++ plugins/mpeg2enc/mblock_sub44_sads.c Sat Nov
3 13:21:52 2001
@@ -80,10 +80,10 @@
*/
static __inline__ void shift_blk(const uint32_t shift)
{
- psrlq_i2r( shift,mm0);
- psrlq_i2r( shift,mm1);
- psrlq_i2r( shift,mm2);
- psrlq_i2r( shift,mm3);
+ psrlq_m2r( shift,mm0);
+ psrlq_m2r( shift,mm1);
+ psrlq_m2r( shift,mm2);
+ psrlq_m2r( shift,mm3);
}

/*

=============================================================================

Discussion

  • Edward Sternin
    Edward Sternin
    2003-03-18

    Logged In: YES
    user_id=4535

    I do not get it... this BUG (psrlq_m2r) was pointed out in
    Nov 2001, and yet it is still there in the latest release
    (Feb 2003).

    I had to put it in by hand.

    Is Heroine disagreeing with this? Do they have another fix?

    The 1.1.5 downloads do not compile in exactly the same way.