Vogtinator / fuse-nspire

FUSE filesystem for TI-Nspire calculators
GNU General Public License v3.0
4 stars 1 forks source link

Can't compile the project under Linux #1

Closed N0ury closed 4 years ago

N0ury commented 4 years ago

At make time, I have the following error:

cc -o nspire -lfuse -pthread -L/usr/local/lib -lnspire -lusb-1.0 -O3 -Wall -I/usr/local/include/libnspire -I/usr/include/libusb-1.0 nspire.o dir.o file.o stat.o  
/usr/bin/ld : /usr/local/lib/libnspire.so : référence indéfinie vers « packet_recv_cx2 »  
/usr/bin/ld : /usr/local/lib/libnspire.so : référence indéfinie vers « packet_send_cx2 »  
collect2: error: ld returned 1 exit status  
make: *** [Makefile:21 : nspire] Erreur 1

Here are some more informations:

pkg-config fuse --libs  
-lfuse -pthread
pkg-config libnspire --libs  
-L/usr/local/lib -lnspire -lusb-1.0
ldd /usr/local/lib/libnspire.so.0.0.0  
   linux-vdso.so.1 (0x00007ffef3b11000)  
   libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007fe9db657000)  
   libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe9db494000)  
   libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fe9db46d000)  
   libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe9db44c000)  
   /lib64/ld-linux-x86-64.so.2 (0x00007fe9db6a0000)

And finally, the strangest:

nm /usr/local/lib/libnspire.so.0.0.0
00000000000060c8 b completed.7363
                 w __cxa_finalize@@GLIBC_2.2.5
00000000000018b0 t data_build
0000000000001440 t data_read
00000000000015a0 t data_scan
0000000000001430 t data_write
0000000000001250 t data_write_special
0000000000001190 t deregister_tm_clones
0000000000001200 t __do_global_dtors_aux
0000000000005d98 d __do_global_dtors_aux_fini_array_entry
00000000000060c0 d __dso_handle
0000000000005e00 d _DYNAMIC
0000000000005da0 d error_msg
0000000000003a7c t _fini
0000000000001d90 t fix_endian
0000000000001240 t frame_dummy
0000000000005d90 d __frame_dummy_init_array_entry
0000000000004b70 r __FRAME_END__
                 U free@@GLIBC_2.2.5
0000000000006000 d _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
00000000000040ec r __GNU_EH_FRAME_HDR
0000000000001000 t _init
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U libusb_bulk_transfer
                 U libusb_claim_interface
                 U libusb_close
                 U libusb_exit
                 U libusb_free_config_descriptor
                 U libusb_get_active_config_descriptor
                 U libusb_get_device
                 U libusb_init
                 U libusb_open_device_with_vid_pid
                 U libusb_release_interface
                 U libusb_reset_device
                 U libusb_set_configuration
                 U malloc@@GLIBC_2.2.5
                 U memchr@@GLIBC_2.2.5
                 U memcpy@@GLIBC_2.14
0000000000002230 t mod_src
0000000000002d30 T nspire_attr
0000000000002520 T nspire_device_info
0000000000002b50 T nspire_dir_create
0000000000002c40 T nspire_dir_delete
0000000000002850 T nspire_dirlist
0000000000002b40 T nspire_dirlist_free
00000000000032e0 T nspire_file_copy
00000000000033d0 T nspire_file_delete
00000000000031f0 T nspire_file_move
0000000000003000 T nspire_file_read
0000000000002e60 T nspire_file_write
0000000000001d70 T nspire_free
0000000000001c20 T nspire_init
00000000000034c0 T nspire_os_send
0000000000003680 T nspire_screenshot
0000000000001bf0 T nspire_strerror
0000000000002080 t packet_ack
0000000000001f20 t packet_dataptr
0000000000001f40 t packet_datasize
0000000000001f80 t packet_fulldatasize
0000000000001f60 t packet_max_datasize
00000000000020e0 t packet_nack
0000000000001de0 t packet_new
0000000000001e80 t packet_new_ack.isra.0
0000000000002150 t packet_recv
                 U packet_recv_cx2
0000000000001fa0 t packet_send
                 U packet_send_cx2
                 U realloc@@GLIBC_2.2.5
00000000000011c0 t register_tm_clones
0000000000002240 t service_connect
0000000000002260 t service_disconnect
                 U strlen@@GLIBC_2.2.5
                 U strncpy@@GLIBC_2.2.5
00000000000060c8 d __TMC_END__
00000000000060d0 b usb_ctx
0000000000002310 t usb_finish
0000000000002440 t usb_free_device
0000000000002320 t usb_get_device
00000000000022d0 t usb_init
00000000000024c0 t usb_read
0000000000002460 t usb_write

But libnspire compiles with no errors.

Am I doing something wrong?

lights0123 commented 4 years ago

Are you sure that you used the correct fork of libnspire? It makes sense that you get errors with the original, as the cx2 in packet_recv_cx2 didn't exist when it was last updated.

N0ury commented 4 years ago

Thanks @lights0123

I've just realized that I was using a shared directory between MacOS and Linux. In fact, at make time I was using the Mac configure result.

So under Linux, I have removed the directory and cloned again the project "libnspire" and "fuse-nspire" But with libnspire, make doesn't work. It says:

CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/c0238/Dropbox/divers/fouretout/libnspire/missing aclocal-1.13 
/home/c0238/Dropbox/divers/fouretout/libnspire/missing: line 81: aclocal-1.13: command not found
WARNING: 'aclocal-1.13' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make: *** [Makefile:355: aclocal.m4] Error 127

On my system, I have aclocal-1.16 and automake-1.16. I don't know how to change the project for using 1.16 versions. Do I have to open an issue on the right project (libnspire)

I'm using Debian sid.

lights0123 commented 4 years ago

I had the same issue. Running autoreconf -f -i fixed it. I'm on Arch Linux, and libnspire seems to want to install itself in a nonstandard directory, so I had to run PKG_CONFIG_PATH=/usr/local/lib/pkgconfig make and LD_LIBRARY_PATH=/usr/local/lib ./nspire in this repo.

N0ury commented 4 years ago

Oh thanks. libnspire compiles fine now

But with fuse-nspire I can't build nspire file. I see:

make

cc -c -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -O3 -Wall -I/usr/local/include/libnspire -I/usr/include/libusb-1.0 -o nspire.o nspire.c
cc -c -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -O3 -Wall -I/usr/local/include/libnspire -I/usr/include/libusb-1.0 -o dir.o dir.c
cc -c -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -O3 -Wall -I/usr/local/include/libnspire -I/usr/include/libusb-1.0 -o file.o file.c
cc -c -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -O3 -Wall -I/usr/local/include/libnspire -I/usr/include/libusb-1.0 -o stat.o stat.c
cc -o nspire -lfuse -pthread -L/usr/local/lib -lnspire -lusb-1.0 -O3 -Wall -I/usr/local/include/libnspire -I/usr/include/libusb-1.0 nspire.o dir.o file.o stat.o
/usr/bin/ld: nspire.o: in function `main':
nspire.c:(.text.startup+0x39): undefined reference to `nspire_init'
/usr/bin/ld: nspire.c:(.text.startup+0x6d): undefined reference to `fuse_opt_parse'
/usr/bin/ld: nspire.c:(.text.startup+0x90): undefined reference to `fuse_main_real'
/usr/bin/ld: nspire.c:(.text.startup+0x9c): undefined reference to `nspire_free'
/usr/bin/ld: nspire.c:(.text.startup+0xd9): undefined reference to `nspire_strerror'
/usr/bin/ld: dir.o: in function `nsp_readdir':
dir.c:(.text+0x16): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x28): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x3c): undefined reference to `nspire_dirlist'
/usr/bin/ld: dir.c:(.text+0xa4): undefined reference to `nspire_dirlist_free'
/usr/bin/ld: dir.c:(.text+0xa9): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.o: in function `nsp_mkdir':
dir.c:(.text+0xe5): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0xf7): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x106): undefined reference to `nspire_dir_create'
/usr/bin/ld: dir.c:(.text+0x10d): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.o: in function `nsp_rmdir':
dir.c:(.text+0x135): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x147): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x156): undefined reference to `nspire_dir_delete'
/usr/bin/ld: dir.c:(.text+0x15d): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.o: in function `nsp_rename':
dir.c:(.text+0x18e): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x1a0): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x1b2): undefined reference to `nspire_file_move'
/usr/bin/ld: dir.c:(.text+0x1b9): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.o: in function `nsp_delete':
dir.c:(.text+0x1e5): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x1f7): undefined reference to `fuse_get_context'
/usr/bin/ld: dir.c:(.text+0x206): undefined reference to `nspire_file_delete'
/usr/bin/ld: dir.c:(.text+0x20d): undefined reference to `fuse_get_context'
/usr/bin/ld: file.o: in function `nsp_truncate':
file.c:(.text+0x13): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x2e): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x40): undefined reference to `nspire_attr'
/usr/bin/ld: file.c:(.text+0x4d): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x65): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x94): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0xac): undefined reference to `nspire_file_read'
/usr/bin/ld: file.c:(.text+0xb9): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0xce): undefined reference to `nspire_file_write'
/usr/bin/ld: file.c:(.text+0xe6): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x121): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x137): undefined reference to `nspire_file_write'
/usr/bin/ld: file.o: in function `nsp_open':
file.c:(.text+0x1a8): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x1ba): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x1cc): undefined reference to `nspire_attr'
/usr/bin/ld: file.c:(.text+0x1dc): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x24c): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x281): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x2a5): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x2bd): undefined reference to `nspire_file_read'
/usr/bin/ld: file.o: in function `nsp_create':
file.c:(.text+0x321): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x333): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x345): undefined reference to `nspire_attr'
/usr/bin/ld: file.c:(.text+0x353): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x366): undefined reference to `nspire_file_write'
/usr/bin/ld: file.c:(.text+0x36f): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x3ab): undefined reference to `fuse_get_context'
/usr/bin/ld: file.o: in function `nsp_fsync':
file.c:(.text+0x528): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x549): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x55e): undefined reference to `nspire_file_write'
/usr/bin/ld: file.c:(.text+0x580): undefined reference to `fuse_get_context'
/usr/bin/ld: file.o: in function `nsp_release':
file.c:(.text+0x610): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x632): undefined reference to `fuse_get_context'
/usr/bin/ld: file.c:(.text+0x647): undefined reference to `nspire_file_write'
/usr/bin/ld: file.c:(.text+0x669): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.o: in function `nsp_statfs':
stat.c:(.text+0xe): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0x20): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0x2f): undefined reference to `nspire_device_info'
/usr/bin/ld: stat.c:(.text+0x8b): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.o: in function `nsp_getattr':
stat.c:(.text+0xd1): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0xe3): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0xf5): undefined reference to `nspire_attr'
/usr/bin/ld: stat.c:(.text+0x183): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.o: in function `nsp_access':
stat.c:(.text+0x1ce): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0x1e0): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0x1f2): undefined reference to `nspire_attr'
/usr/bin/ld: stat.c:(.text+0x1fe): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0x20e): undefined reference to `fuse_get_context'
/usr/bin/ld: stat.c:(.text+0x239): undefined reference to `fuse_get_context'
collect2: error: ld returned 1 exit status
make: *** [Makefile:21: nspire] Error 1

An idea?

lights0123 commented 4 years ago

I did not get that error, and I have no clue why you did. It looks like it passed the correct linker args.

N0ury commented 4 years ago

I have found. I need to replace: $(CC) -o $@ $(LIBS) $(CFLAGS) $^ with $(CC) -o $@ $^ $(LIBS) $(CFLAGS) .o files must be before libraries

It works fine now.

Thanks for all.