rbash88 / pyffmpeg

Automatically exported from code.google.com/p/pyffmpeg
0 stars 0 forks source link

Error: "undefined reference to `floorf' " during the compilation #50

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
 - What steps will reproduce the problem?

The software compilation with the following command:
python ./setup.py build

I got the following error:
Error: undefined reference to `floorf'

Full output:
gcc -pthread -shared -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 
-Wl,--build-id -Wl,--enable-new-dtags build/temp.linux-i686-2.7/pyffmpeg.o 
-L/opt/ffmpeg/lib -L/usr/lib -lavformat -lavcodec -lavutil -lswscale 
-lpython2.7 -o build/lib.linux-i686-2.7/pyffmpeg.so
build/temp.linux-i686-2.7/pyffmpeg.o: In function 
`__pyx_pf_8pyffmpeg_10AudioTrack_1reset_tps':
/home/varenne/jmvp/aa/pyffmpeg-2.1beta/pyffmpeg.c:5193: undefined reference to 
`floorf'
build/temp.linux-i686-2.7/pyffmpeg.o: In function 
`__pyx_pf_8pyffmpeg_10AudioTrack_init':
/home/varenne/jmvp/aa/pyffmpeg-2.1beta/pyffmpeg.c:4910: undefined reference to 
`floorf'
collect2: ld a retourné 1 code d'état d'exécution
build/temp.linux-i686-2.7/pyffmpeg.o: In function 
`__pyx_pf_8pyffmpeg_10AudioTrack_1reset_tps':
/home/varenne/jmvp/aa/pyffmpeg-2.1beta/pyffmpeg.c:5193: undefined reference to 
`floorf'
build/temp.linux-i686-2.7/pyffmpeg.o: In function 
`__pyx_pf_8pyffmpeg_10AudioTrack_init':
/home/varenne/jmvp/aa/pyffmpeg-2.1beta/pyffmpeg.c:4910: undefined reference to 
`floorf'
collect2: ld a retourné 1 code d'état d'exécution
error: Command "gcc -pthread -shared -Wl,--as-needed -Wl,--no-undefined 
-Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags 
build/temp.linux-i686-2.7/pyffmpeg.o -L/opt/ffmpeg/lib -L/usr/lib -lavformat 
-lavcodec -lavutil -lswscale -lpython2.7 -o 
build/lib.linux-i686-2.7/pyffmpeg.so" failed with exit status 1

 - What is the expected output? What do you see instead?

After investigation on Internet, it appears that the "floorf" symbol is defined 
in a "libm.so" library. Then, the "-lm" argument shall be added to the "gcc" 
command. To fix it, you can add the following lines in the "setup.py" file:

if platform.startswith("linux"):
    libs += [ 'm' ]

 - What version of the product are you using? On what operating system?

"pyffmpeg-2.1beta.tar.gz"
"Linux Mageia 1" 32 bits

 - Please provide any additional information below.

Original issue reported on code.google.com by 000JeanM...@gmail.com on 4 May 2012 at 3:23