LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Compiling FX2_Programmer errors (http://www.linuxquestions.org/questions/slackware-14/compiling-fx2_programmer-errors-4175470325/)

PeterUK 07-20-2013 02:25 PM

Compiling FX2_Programmer errors
 
I am trying to learn about FX2 programming and USB handling, I am trying to compile the whole FX2_programmer code from here

But after changing all the warning mainly have to be with the buffer from unsigned to just char, I getting this error:

Quote:

/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/bin/ld: note: 'pthread_create@@GLIBC_2.1' is defined in DSO /lib/libpthread.so.0 so try adding it to the linker command line
/lib/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [fx2_viewer] Error 1
Also I cannot remove this warning:
Quote:

fx2.c: In function 'usb_reader':
fx2.c:79:2: warning: pointer targets in passing argument 3 of 'usb_bulk_read' differ in signedness [-Wpointer-sign]
In file included from fx2.c:10:0:
/usr/include/usb.h:303:5: note: expected 'char *' but argument is of type 'unsigned char *'
/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/bin/ld: /tmp/cc81eRgD.o: undefined reference to symbol 'pthread_create@@GLIBC_2.1'
But I looked at that function and I have removed "unsigned" from the char, and you see it giving the error at usb.h evaluation.

Here is the make file:

Quote:

CC=gcc -pipe -g -Wall -O2

PREFIX=/usr/local/

#
# FX2 viewer uses GL, GLUT and FFTW
#
# First two usually come standard, the latter can be obtained from
# http://www.fftw.org/
#

VIEWER_LIBS= -L/usr/X11/lib -lGL -lGLU -lglut -lfftw3


all: fx2_programmer fx2_viewer test1



test1: fx2_programmer fx2_viewer
@echo "---------------- FX2 PROGRAMMER -----------------------"
@./fx2_programmer || true
@echo "------------------ FX2 VIEWER -------------------------"
@./fx2_viewer || true


fx2_programmer: fx2_programmer.c
$(CC) fx2_programmer.c -lusb -o fx2_programmer

fx2_viewer: fx2.c fx2.h viewer.c
$(CC) fx2.c viewer.c $(VIEWER_LIBS) -lusb -o fx2_viewer


install: fx2_programmer fx2_viewer
install -s -m 0755 ./fx2_programmer ${PREFIX}/bin/
install -s -m 0755 ./fx2_viewer ${PREFIX}/bin/

tarball:
(cd .. ; tar cvf - fx2_programmer/Makefile fx2_programmer/*.c fx2_programmer/*.h fx2_programmer/README.txt) | gzip - > fx2_programmer.tgz
How do I fix this compiling problem? Thanks

John VV 07-20-2013 02:32 PM

try using g++ instead of gcc

that normally solves the DSO error

if not then you might need to add " -Lpthread " in the linker line

PeterUK 07-20-2013 05:50 PM

Quote:

Originally Posted by John VV (Post 4993867)
try using g++ instead of gcc

that normally solves the DSO error

if not then you might need to add " -Lpthread " in the linker line

If I change g++ it disappear the error but it get some new ones:

Quote:

fx2.c: In function 'void init_buffers()':
fx2.c:62:44: error: invalid conversion from 'void*' to 'char**' [-fpermissive]
fx2.c:64:53: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
viewer.c: In function 'void glut_printf(void*, const char*, ...)':
viewer.c:69:28: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
viewer.c:74:29: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
viewer.c: In function 'void init_fft()':
viewer.c:262:50: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
viewer.c:263:46: error: invalid conversion from 'void*' to 'double (*)[2]' [-fpermissive]
viewer.c:264:46: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
make: *** [fx2_viewer] Error 1
But I guess those can be fixed,

if I leave gcc and add "-Lpthread "

I get:

Quote:

cc -pipe -g -Wall -O2 fx2.c viewer.c -L/usr/X11/lib -lGL -lGLU -lglut -lfftw3 -Lpthread -lusb -o fx2_viewer
/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/bin/ld: /tmp/ccHII0ie.o: undefined reference to symbol 'pthread_create@@GLIBC_2.1'
/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/bin/ld: note: 'pthread_create@@GLIBC_2.1' is defined in DSO /lib/libpthread.so.0 so try adding it to the linker command line
/lib/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [fx2_viewer] Error 1
So no a fixed! :-(

John VV 07-20-2013 06:27 PM

by chance are you building a 32 bit program ( using the 32 bit gcc tools) on a 64 bit OS

also seeing as "fx2_programmer-2.0.2.tgz" is from 2005
your current version of gcc4.7 it very likely way too new


install the compatibility gcc 3.3 or 3.4

gcc 4.1 might work ?

fx2_programmer-2.0.2.tgz is 8 years old and has not been updated to use any newer software

it is likely that you will need to use 8+ year old Operating system or 8+ year old versions of programs


---------- edit ---

just built it ( while replying )
it builds using gcc 4.3 and 4.7
BUT i had to have the lib line in the Makefile use this
Code:

VIEWER_LIBS= -L/usr/X11/lib -lGL -lGLU -lglut -lfftw3 -lm -lpthread
this is on a 64 bit install of OpenSUSE 12.3 ( i have gcc 33 ,43, and 47 installed currently )

PeterUK 07-20-2013 06:46 PM

Quote:

Originally Posted by John VV (Post 4993918)
by chance are you building a 32 bit program ( using the 32 bit gcc tools) on a 64 bit OS

also seeing as "fx2_programmer-2.0.2.tgz" is from 2005
your current version of gcc4.7 it very likely way too new


install the compatibility gcc 3.3 or 3.4

gcc 4.1 might work ?

fx2_programmer-2.0.2.tgz is 8 years old and has not been updated to use any newer software

it is likely that you will need to use 8+ year old Operating system or 8+ year old versions of programs


---------- edit ---

just built it ( while replying )
it builds using gcc 4.3 and 4.7
BUT i had to have the lib line in the Makefile use this
Code:

VIEWER_LIBS= -L/usr/X11/lib -lGL -lGLU -lglut -lfftw3 -lm -lpthread
this is on a 64 bit install of OpenSUSE 12.3 ( i have gcc 33 ,43, and 47 installed currently )

I have gcc-4.7.1-i486-1 on a slackware(14) machine and add the two link libraries and wooallaaa, it compile too, thanks

I did look at that viewer file and notice that was even used of fft and more maths never though I needed the lm link, even I have used in some code :-/, Thanks John that fix that bug!

John do you know a lot of the USB interface?


All times are GMT -5. The time now is 05:47 AM.