Rockbox Technical Forums
Rockbox Development => Starting Development and Compiling => Topic started by: robertdundee on December 11, 2014, 11:22:24 AM
-
In the directory ~/rockbox/utils/MTP$ I try to create sendfirm following the instructions. I write make but I get error 1. How can I fix this>
gcc -Wall -lmtp -o sendfirm sendfirm.c
sendfirm.c: In function ‘sendfile_function’:
sendfirm.c:78:9: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
exit(1);
^
sendfirm.c:78:9: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
sendfirm.c: In function ‘main’:
sendfirm.c:142:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
exit(0);
^
/tmp/cchJ6DIx.o: In function `sendfile_function':
sendfirm.c:(.text+0x11d): undefined reference to `LIBMTP_new_file_t'
sendfirm.c:(.text+0x18e): undefined reference to `LIBMTP_Send_File_From_File'
sendfirm.c:(.text+0x1c0): undefined reference to `LIBMTP_Dump_Errorstack'
sendfirm.c:(.text+0x1cf): undefined reference to `LIBMTP_Clear_Errorstack'
sendfirm.c:(.text+0x1fa): undefined reference to `LIBMTP_destroy_file_t'
/tmp/cchJ6DIx.o: In function `main':
sendfirm.c:(.text+0x227): undefined reference to `LIBMTP_Init'
sendfirm.c:(.text+0x24a): undefined reference to `LIBMTP_Get_First_Device'
sendfirm.c:(.text+0x290): undefined reference to `LIBMTP_Release_Device'
collect2: error: ld returned 1 exit status
make: *** [sendfirm] Error 1
-
Do you have libmtp installed? The linker can't find it.
Edit: The wiki lists the dependencies:
The sendfirm utility is used to upgrade the firmware in an MTP device. It can be found in the utils/MTP directory in the Rockbox source tree; the Linux version requires both libusb and libmtp (and their development packages) to compile and use. This utility can be used from Linux and Windows.
For Linux: to compile, just type make in the utils/MTP directory.
For Windows: make sure you have MingW installed and type make sendfirm.exe in the utils/MTP directory (or download the binary here).
http://www.rockbox.org/wiki/GigabeatSInstallation#A_41_Compile_the_sendfirm_utility
-
Thank you. Yes, I have both libusb and libmtp installed. Im stuck on this part. Any advice is greatly appreciated
-
Do you have the development packages too (so that would be a total of 4 packages not 2).
-
Yes, i do have all the packages installed in ubuntu
-
You probably have an old version of gcc which cares about the order when linking.
Try to edit the Makefile (at utils/MTP/Makefile) and replace this line:
gcc $(EXTRA_CFLAGS) $(CFLAGS) $(LIBS) -o $(OUTPUT) sendfirm.c
by this line:
gcc $(EXTRA_CFLAGS) $(CFLAGS) -o $(OUTPUT) sendfirm.c $(LIBS)
-
Many thanks Pamaury !
~/rockbox/utils/MTP$ make
gcc -Wall -o sendfirm sendfirm.c -lmtp
sendfirm.c: In function ‘sendfile_function’:
sendfirm.c:78:9: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
exit(1);
^
sendfirm.c:78:9: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
sendfirm.c: In function ‘main’:
sendfirm.c:142:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
exit(0);
^
-
Many thanks Pamaury !
~/rockbox/utils/MTP$ make
gcc -Wall -o sendfirm sendfirm.c -lmtp
sendfirm.c: In function ‘sendfile_function’:
sendfirm.c:78:9: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
exit(1);
^
sendfirm.c:78:9: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
sendfirm.c: In function ‘main’:
sendfirm.c:142:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
exit(0);
^
Those are just minor warnings. If they really bother you, just add this line to the top of sendfirm.c:
#include <stdlib.h>
-
Thanks. When I try the make sendfirm.exe Im having the following problem>
mingw32-gcc -Wall -o sendfirm.exe sendfirm_win.c MTP_DLL.dll
make: mingw32-gcc: Command not found
make: *** [sendfirm.exe] Error 127
-
To compile sendfirm under Windows, you need the MingGW compiler which is not super easy to install. In this case I suggest you simply use the prebuilt version: https://www.dropbox.com/s/9vwc4qdyh0c6e0p/sendfirm.exe?dl=0 (https://www.dropbox.com/s/9vwc4qdyh0c6e0p/sendfirm.exe?dl=0) (note that this link is on the wiki page...)
-
Thank you Pamaury. I will do that
-
Thanks all,
I know this is 5 years later, but this sorted my make on Linux Mint 19.2 also..