debrouxl / tilibs

TILP (formerly GtkTiLink) can transfer data between Texas Instruments graphing calculators and a computer. It works with all link cables (parallel, serial, Black/Gray/Silver/Direct Link) and it supports the TI-Z80 series (73..86), the TI-eZ80 series (83PCE, 84+CE), the TI-68k series (89, 92, 92+, V200, 89T) and the Nspire series (Nspire Clickpad / Touchpad / CX, both CAS and non-CAS)
http://lpg.ticalc.org/prj_tilp
63 stars 23 forks source link

libticonv does not build under Arch Linux #77

Closed aquamarine-axo closed 7 months ago

aquamarine-axo commented 1 year ago

After freshly git cloning the repository, running cmake . and then make fails with the following output:

[  1%] Building CXX object libticonv/trunk/CMakeFiles/ticonv_objlib.dir/src/charset.cc.o
/home/nicco1690/src/ext/tilibs/libticonv/trunk/src/charset.cc: In function 'char* ticonv_utf16_to_ti80(const short unsigned int*, char*)':
/home/nicco1690/src/ext/tilibs/libticonv/trunk/src/charset.cc:490:61: note: '#pragma message: Warning: FINISH UTF-16-TO-TI-80 CONVERSION'
  490 | #pragma message("Warning: FINISH UTF-16-TO-TI-80 CONVERSION")
      |                                                             ^
[  2%] Building CXX object libticonv/trunk/CMakeFiles/ticonv_objlib.dir/src/filename.cc.o
[  2%] Building C object libticonv/trunk/CMakeFiles/ticonv_objlib.dir/src/iconv.c.o
[  3%] Building CXX object libticonv/trunk/CMakeFiles/ticonv_objlib.dir/src/ticonv.cc.o
[  4%] Building CXX object libticonv/trunk/CMakeFiles/ticonv_objlib.dir/src/tokens.cc.o
/home/nicco1690/src/ext/tilibs/libticonv/trunk/src/tokens.cc: In function 'char* ticonv_varname_detokenize(CalcModel, const char*, unsigned char)':
/home/nicco1690/src/ext/tilibs/libticonv/trunk/src/tokens.cc:520:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
  520 |                 if (dst)
      |                 ^~
/home/nicco1690/src/ext/tilibs/libticonv/trunk/src/tokens.cc:524:9: note: here
  524 |         case CALC_TI89:
      |         ^~~~
[  5%] Building CXX object libticonv/trunk/CMakeFiles/ticonv_objlib.dir/src/type2str.cc.o
[  5%] Built target ticonv_objlib
[  6%] Linking CXX shared library libticonv.so
/usr/bin/ld: CMakeFiles/ticonv_objlib.dir/src/charset.cc.o: warning: relocation against `ti85_charset' in read-only section `.text'
/usr/bin/ld: CMakeFiles/ticonv_objlib.dir/src/charset.cc.o: relocation R_X86_64_PC32 against symbol `ti9x_charset' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libticonv/trunk/CMakeFiles/ticonv_shared.dir/build.make:93: libticonv/trunk/libticonv.so.9.0.4] Error 1
make[1]: *** [CMakeFiles/Makefile2:311: libticonv/trunk/CMakeFiles/ticonv_shared.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
debrouxl commented 1 year ago

Thanks for the report.

FTR, the official way to build libti*+gfm+tilp remains https://github.com/debrouxl/tilp_and_gfm/raw/master/tilp/trunk/build/scripts/install_tilp.sh , which uses the autotools build definitions. Either these work for you, in which case the CMake definitions need fixing, or neither works for you, in which case both build definitions need fixing :)

aquamarine-axo commented 1 year ago

Thanks for your swift response. I vaguely remember trying to use that script on a different system but still Arch Linux, and remember it failing as well, but that was well over six months ago at this point. As I'm on my phone now, I'll test again timorrow afternoon. Thanks :)

debrouxl commented 1 year ago

Interesting. I didn't explicitly use -fPIC / -fPIE in the maintainer build scripts (PIC, i.e. -fpic or better, being the default behaviour for shared libraries anyway), so I just did it locally; however, using the maintainer build scripts, I can't reproduce a build issue similar to yours on Debian sid amd64 (GCC 13, binutils 2.41, etc.). -fPIC and -fPIE are definitely passed to the compiler and linker. The autotools build definitions do therefore not seem all bad.

adriweb commented 1 year ago

Would also be worth re-trying after adjusting the root CMakeLists.txt to use PIC and PIE?

aquamarine-axo commented 1 year ago

After running the script, then fixing some dependency issues (libglade2 was uploaded to the AUR but the latest build from there does not compile correctly, so I had to download an older binary version and manually install it), TiLP was able to successfully install... but the binary that got installed still would not run!

TiLP2 - Version 1.17, (C) 1999-2008 Romain Lievin
THIS PROGRAM COMES WITH ABSOLUTELY NO WARRANTY
PLEASE READ THE DOCUMENTATION FOR DETAILS
built on Aug  5 2023 23:28:28
tilp-INFO: 12:50:32.480: setlocale: (null)
tilp-INFO: 12:50:32.482: bindtextdomain: /usr/local/share/locale/
tilp-INFO: 12:50:32.482: textdomain: tilp2

(tilp:50808): tilp-ERROR **: 12:50:32.482: libticalcs library version is 1.1.10 but 1.1.8 mini required.

fish: Job 1, 'sudo tilp' terminated by signal SIGTRAP (Trace or breakpoint trap)

Perhaps this was from my previous tinkering with libti*? I'll try to remove all of what I did before and attempt to run the install again.

debrouxl commented 1 year ago

Indeed, you need to clean up your previous attempts, as well as any installed packages. libticalcs 1.1.10 is the appropriate version number of a binary built from the source code in the Git repository (the corresponding libticonv version being 1.1.6, libtifiles version 1.1.8 and libticables version 1.3.6), but TILP 1.17 does not match the libraries: currently 1.19 in the tilp_and_gfm repository.

aquamarine-axo commented 7 months ago

Closing issue. I was able to get everything to build correctly on a new install of Arch Linux on my laptop, after building libglade and python2 (dependency of libglade) myself