Closed Alexey-T closed 4 months ago
Hello @Alexey-T although we've got an older version on Haiku, I've been on and off trying to update our version. I was looking for the command used last time to build it but can't find it anymore (should be in some comment burried deep down somewhere). Could you give me a hint or do you know how I got it to build (been a long time) :)
EDIT used/using cudaup to build it with (currently): ./cudaup.sh -g -m -l/boot/home/fpcupdeluxe/lazarus -o haiku
EDIT2 nvm, found it: ./cudaup.sh -g -m -w qt5 - Qt 5 -l /boot/system/non-packaged/bin/fpcupdeluxe/lazarus
sorry, but I don't have this info. it is buried in this GIthub issues somewhere. or not?
Found it here (after a long search): https://github.com/Alexey-T/ATSynEdit/issues/291#issuecomment-997708529
./cudaup.sh -g -m -w qt5 - Qt 5 -l /boot/system/non-packaged/bin/fpcupdeluxe/lazarus
can you tell me what does it mean: - Qt 5
? it is not looking like a supported option.
Build failure atm (maybe needs a new ticket?): https://bpa.st/K2HBY
Fatal: (10022) Can't find unit system used by fcllaz
this means that FPC is not setup properly - mabe fpc.cfg file is missing something, I don't have knowledge.
Build it with fpcupdeluxe with the default path given there, will investigate further, ps, the cmd was wrong indeed, a bit further along the issue linked there is the right one. Thanks for the quick reply!
Will Haiku be released? When??
So far we're still in beta, and in no rush to release a R1 version (small developer pool), but things are running pretty fine so far.
OK, with some checking I was able to build Cudatext from a checkout, build done with Lazarus (cudaup or lazbuild failed in Terminal but building the dependencies seperatly inside a project in Lazarus did the trick) :) 👍
Great, thanks. Maybe you can make the full package?
I see the sidebar icons (and Copy icon in the About dlg) are missing … it means that app cannot find its folder “data”.
You can click the sidebar place with 3 blue number and read which errors app writes.
Great, thanks. Maybe you can make the full package?
Already got a 32bit package locally done, will check on a build/package for 64bit later. :)
I see the sidebar icons (and Copy icon in the About dlg) are missing … it means that app cannot find its folder “data”.
Have to check that out, where in the source does it check for the "data" folder?
File proc_globdata.pas . Search there for Haiku default path… I am not at home to tell more.
I see the sidebar icons (and Copy icon in the About dlg) are missing … it means that app cannot find its folder “data”.
This is done with a postinstall script that comes with the package, better would be if this wasn't needed :)
File proc_globdata.pas . Search there for Haiku default path… I am not at home to tell more.
So far haven't figure out how to separate AppDir_Data (only data) from AppDir_Settings (user specific data/settings) ...
EDIT this works but I'm not sure it's the best sollution:
diff --git a/app/proc_globdata.pas b/app/proc_globdata.pas
index 28470fa..b573fb1 100644
--- a/app/proc_globdata.pas
+++ b/app/proc_globdata.pas
@@ -1335,9 +1335,9 @@ begin
{$ifdef haiku}
{$ifdef CPU64}
- exit('/boot/system/develop/lib/libpython3.7m.so');
+ exit('/boot/system/lib/libpython3.9.so.1.0');
{$else}
- exit('/boot/system/develop/lib/x86/libpython3.7m.so');
+ exit('/boot/system/lib/x86/libpython3.9.so.1.0');
{$endif}
{$endif}
@@ -1511,6 +1511,8 @@ begin
HomeConfig:= AppDir_Home+'/config/settings';
OpDirLocal:= HomeConfig+'/cudatext';
CreateDirUTF8(OpDirLocal);
+ AppDir_Py:= '/boot/system/data/cudatext/'+DirectorySeparator+'py';
+ AppDir_Data:= '/boot/system/data/cudatext/'+DirectorySeparator+'data';
end;
procedure InitDirs_UnixCommon;
@@ -1622,8 +1624,10 @@ begin
], S);
{$endif}
- AppDir_Py:= OpDirLocal+DirectorySeparator+'py';
- AppDir_Data:= OpDirLocal+DirectorySeparator+'data';
+ {$ifndef haiku}
+ AppDir_Py:= OpDirLocal+DirectorySeparator+'py';
+ AppDir_Data:= OpDirLocal+DirectorySeparator+'data';
+ {$endif}
AppDir_Lexers:= AppDir_Data+DirectorySeparator+'lexlib';
AppDir_LexersLite:= AppDir_Data+DirectorySeparator+'lexliblite';
AppDir_DataThemes:= AppDir_Data+DirectorySeparator+'themes';
Although it launches fine and looks OK getting some output when launched from Terminal with different python versions (only python3.7 produces no errors), first launch (python3.9), second launch (python3.7), third launch (python3.8) and last launch (python3.10), when launched with LD_PRELOAD=/boot/system/develop/lib/x86/libpython3.10.so ./cudatext
it produces no errors, looking with readelf -d ./cudatext
it doesn't seem to link to the python library?:
Terminal launches
~/CudaText_up/src/CudaText/app> ./cudatext
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "_Py_NoneStruct" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "_PyLong_One" returned: -2147478780
~/CudaText_up/src/CudaText/app> ./cudatext
~/CudaText_up/src/CudaText/app> ./cudatext
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "_PyLong_One" returned: -2147478780
~/CudaText_up/src/CudaText/app> ./cudatext
resolve symbol "_Py_NoneStruct" returned: -2147478780
resolve symbol "PyExc_RuntimeError" returned: -2147478780
resolve symbol "_Py_NoneStruct" returned: -2147478780
readelf output
~/CudaText_up/src/CudaText/app> readelf -d cudatext
Dynamic section at offset 0xdd9010 contains 26 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libroot.so]
0x00000001 (NEEDED) Shared library: [libnetwork.so]
0x00000001 (NEEDED) Shared library: [libtextencoding.so]
0x00000001 (NEEDED) Shared library: [libiconv.so.2]
0x00000001 (NEEDED) Shared library: [libQt5Pas.so.1]
0x00000010 (SYMBOLIC) 0x0
0x0000000f (RPATH) Library rpath: [./:7375ORIGIN]
0x0000000c (INIT) 0x6ce034
0x0000000d (FINI) 0xd65ebd
0x00000004 (HASH) 0xb4
0x00000005 (STRTAB) 0x1867f0
0x00000006 (SYMTAB) 0x67bd0
0x0000000a (STRSZ) 3483344 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000003 (PLTGOT) 0xdea940
0x00000002 (PLTRELSZ) 12832 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x6cae14
0x00000011 (REL) 0x4fcc74
0x00000012 (RELSZ) 1892768 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x4fcc44
0x6fffffff (VERNEEDNUM) 1
0x6ffffff0 (VERSYM) 0x4d8ec0
0x6ffffffa (RELCOUNT) 236592
0x00000000 (NULL) 0x0
Trying to build the seperate packages works fine on 32bit, on 64bit I'm running into Access violation
(not sure it's related to the package of bogus fpcupdeluxe which seems somewhat bogus on 64bit):
Lazarus build 64bit
Hint: (lazarus) compile package BGRABitmapPack 11.5.4 Flags=[]
Hint: (lazarus) Compiler file changed for BGRABitmapPack 11.5.4
File="/boot/home/config/non-packaged/bin/fpc/bin/x86_64-haiku/fpc.sh"
State file="/boot/home/CudaText_up/src/bgrabitmap/bgrabitmap/lib/x86_64-haiku-qt5-3.2.2/BGRABitmapPack.compiled"
Info: (lazarus) Execute Title="Compile package BGRABitmapPack 11.5.4"
Info: (lazarus) Working Directory="/boot/home/CudaText_up/src/bgrabitmap/bgrabitmap/"
Info: (lazarus) Executable="/boot/home/config/non-packaged/bin/fpc/bin/x86_64-haiku/fpc.sh"
Info: (lazarus) Param[0]="-B"
Info: (lazarus) Param[1]="-MObjFPC"
Info: (lazarus) Param[2]="-Scgi"
Info: (lazarus) Param[3]="-O3"
Info: (lazarus) Param[4]="-OoREGVAR"
Info: (lazarus) Param[5]="-l"
Info: (lazarus) Param[6]="-vewnhibq"
Info: (lazarus) Param[7]="-Fu/boot/home/config/non-packaged/bin/lazarus/packager/units/x86_64-haiku"
Info: (lazarus) Param[8]="-Fu/boot/home/config/non-packaged/bin/lazarus/components/lazutils/lib/x86_64-haiku"
Info: (lazarus) Param[9]="-Fu/boot/home/config/non-packaged/bin/lazarus/components/freetype/lib/x86_64-haiku"
Info: (lazarus) Param[10]="-Fu/boot/home/config/non-packaged/bin/lazarus/lcl/units/x86_64-haiku"
Info: (lazarus) Param[11]="-Fu/boot/home/config/non-packaged/bin/lazarus/lcl/units/x86_64-haiku/qt5"
Info: (lazarus) Param[12]="-Fu/boot/home/CudaText_up/src/bgrabitmap/bgrabitmap/"
Info: (lazarus) Param[13]="-FU/boot/home/CudaText_up/src/bgrabitmap/bgrabitmap/lib/x86_64-haiku-qt5-3.2.2/"
Info: (lazarus) Param[14]="-dLCL"
Info: (lazarus) Param[15]="-dLCLqt5"
Info: (lazarus) Param[16]="bgrabitmappack.pas"
TApplication.HandleException: EAccessViolation
Access violation
Stack trace:
$0000017FB352CA30
$00000183F4AF51E0
$00000183F4BBC3DE
$00000183F4ADEFAB
$00000183F5064EB7
$00000183F5062FDE
$00000183F519AD81
$00000183F51B6ACB
$00000183F51A886D
$00000183F5847C90
$00000183F5845D5D
$00000183F5840664
$00000183F4D21217
$00000183F4E0F652
$00000183F4E0D201
$00000183F4D2016A
$00000183F4D20F2F
Created a 32bit release at: https://github.com/Begasus/CudaText-Haikuports/releases/tag/1.195.0.6 (still no luck on 64bit) For this I created a new repository not containing unneeded clutter.
Added a release note at the forum: https://discuss.haiku-os.org/t/new-updated-in-haikudepot/4169/359?u=begasus
- exit('/boot/system/develop/lib/libpython3.7m.so');
+ exit('/boot/system/lib/libpython3.9.so.1.0');
{$else}
- exit('/boot/system/develop/lib/x86/libpython3.7m.so');
+ exit('/boot/system/lib/x86/libpython3.9.so.1.0');
added this fix. OK.
- AppDir_Py:= OpDirLocal+DirectorySeparator+'py';
- AppDir_Data:= OpDirLocal+DirectorySeparator+'data';
+ {$ifndef haiku}
+ AppDir_Py:= OpDirLocal+DirectorySeparator+'py';
+ AppDir_Data:= OpDirLocal+DirectorySeparator+'data';
+ {$endif}
this fix is not ok. but maybe this is better: adjust OpDirLocal for Haiku. in this code:
procedure InitDirs;
var
S: string;
begin
OpFileExe:= ParamStr(0);
OpDirExe:= ExtractFileDir(OpFileExe);
OpDirPrecopy:= GetDirPrecopy;
OpDirLocal:= OpDirExe;
add:
...
OpDirLocal:= OpDirExe;
{$ifdef haiku}
OpDirLocal:= '/boot/system/data/cudatext';
{$endif}
test it.
index a7ba2d1..2e60d4b 100644
--- a/app/proc_globdata.pas
+++ b/app/proc_globdata.pas
@@ -1565,6 +1565,9 @@ begin
OpDirExe:= ExtractFileDir(OpFileExe);
OpDirPrecopy:= GetDirPrecopy;
OpDirLocal:= OpDirExe;
+ {$ifdef haiku}
+ OpDirLocal:= '/boot/system/data/cudatext';
+ {$endif}
{$ifdef windows}
InitDirs_Windows;
With the suggestion it expects the data in ~/config/settings/cudatext as set in line: https://github.com/Alexey-T/CudaText/blob/e0ac522dc381ebb08a963f21942af4b4c90f7fa8/app/proc_globdata.pas#L1512
While the data 'currently' is in /boot/system/data/cudatext
so you suggest to add some dirs initing to procedure InitDirs_Haiku;
? please do it and show the diff, when tested.
Even if I add AppDir_Py and AppDir_Data in the procedure they overuled by the lines here: https://github.com/Alexey-T/CudaText/blob/e0ac522dc381ebb08a963f21942af4b4c90f7fa8/app/proc_globdata.pas#L1625
A variant of my first attempt seems to work, but as you mentioned not the correct one:
diff --git a/app/proc_globdata.pas b/app/proc_globdata.pas
index a7ba2d1..c7a884c 100644
--- a/app/proc_globdata.pas
+++ b/app/proc_globdata.pas
@@ -1624,6 +1624,10 @@ begin
AppDir_Py:= OpDirLocal+DirectorySeparator+'py';
AppDir_Data:= OpDirLocal+DirectorySeparator+'data';
+ {$ifdef haiku}
+ AppDir_Py:= '/boot/system/data/cudatext/data';
+ AppDir_Data:= '/boot/system/data/cudatext/data';
+ {$endif}
AppDir_Lexers:= AppDir_Data+DirectorySeparator+'lexlib';
AppDir_LexersLite:= AppDir_Data+DirectorySeparator+'lexliblite';
AppDir_DataThemes:= AppDir_Data+DirectorySeparator+'themes';
Ok, diff looks correct. But installer must place actual dirs there - /boot/system/data/…… - does installer do it?
Ok, diff looks correct. But installer must place actual dirs there - /boot/system/data/…… - does installer do it?
Yeah, when creating the package data will be installed in $dataDir (/boot/system/data) with cp -rf data/cudatext $dataDir
The postinstall script will cp the default_settins dir to ~/config/settings/cudatext (now CudaText finds and can edit the default.json etc files)
Need to switch back to python3.7m for the library, seems to be an import error with python3.9 https://ibb.co/2P1qwcB, while this is still ok with python3.7 https://ibb.co/GWHh8Dk (PS these screenshots are made on 64bit :) )
made the fix. I don't know which path is ok:
please test.
Checking on both arch's now that that is possible, thanks so far!
Hold off on changes for now :) still figuring out some things. Changed AppDir_Py and AppDir_Data again to writable location (that works for installing add-ons importing python ...) (progress :) ) Switching to another python version (checked with python3.9 and python3.10 now (on 32bit)) gives me another error in the log, don't know how to fix that, only one that really works seems to be python3.7 (python3.9 is default in Haiku atm):
Python 3.9.17
Loaded session: "history session.json", 10ms, 3 file(s)
Startup: 400ms, plugins: 0ms ()
Init: cuda_prefs
Traceback (most recent call last):
File "/boot/system/data/cudatext//py/cuda_prefs/__init__.py", line 1, in <module>
from .cd_opts_dlg import Command, OptEdD
File "/boot/system/data/cudatext//py/cuda_prefs/cd_opts_dlg.py", line 9, in <module>
import re, os, sys, json, collections, tempfile
File "/packages/python3.9_x86-3.9.17-1/.self/lib/python3.9/tempfile.py", line 45, in <module>
from random import Random as _Random
File "/packages/python3.9_x86-3.9.17-1/.self/lib/python3.9/random.py", line 49, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: Symbol not found
ERROR: Exception in CudaText for cuda_prefs.dlg_cuda_options: ImportError: Symbol not found
Saved session: "history session.json", 3 file(s), by timer at 11:13:02
Running with LD_PRELOAD=/boot/system/lib/x86/libpython3.9.so.1.0 ./cudatext (when build with python3.9 set) works and things are running fine), not sure why it 'links' with python3.7 fine but not for the other python versions ...
I cannot help with Haiku python 3.9, sorry.
No problem, will stick with python3.7 for now then, need to double/tripple check on both architectures before I send in the fixes I have then, no need to make changes and revert them for now, thanks for the help so far!
Made the switch back to python3.7 and checked on both 32bit and 64bit, things looking good :) Created a PR at: https://github.com/Alexey-T/CudaText/pull/5123
FineTuning packaging and new release for both architectures will come up soon. Thanks for all the help!
EDIT packages for both architectures released now at https://github.com/Begasus/CudaText-Haikuports/releases/tag/1.195.0.6 Will update the release at haikuports today also so they end up in the HaikuDepot where users can install them.
Thanks..
IMO people will find the package on Haiku repo. No need to announce it at homepage.
Sure, no problem, it's announced at the forum also, so people will have read it by now. :)
Package updated to 1.198.0.0 https://github.com/Begasus/CudaText-Haikuports/releases/tag/1.198.0.0
Thanks! I added short info Haiku: unofficial builds <URL>
at the homepage.
As you see in the screenshot I've made some changes, maybe create a PR for 2 of the files to update them to use python3.10?
PR will be nice. or just write here - where and what is changed.
Wait, I will merge it by hands.
You changed flag RTLD_LAZY to RTLD_NOW, near dlopen(...)
, why? it doesn't break the work on Linux. it's needed for Haiku?
It's needed for Haiku (not really needed upstream, can always change that local (not sure if there is a way to make that line Haiku only?)) Without it it doesn't seem to detect the library or the plugings without running with "LD_PRELOAD ..."
Applied all 3 changes.
not sure if there is a way to make that line Haiku only?))
yes, I did it via {$ifdef haiku}.
Thanks! Did a fresh build with the new changes, all good! 👍
@Begasus Does installer put 'data' and 'py' folders to OS write protected folder? it must not! Users must have W rights for 'data' (to install new snippets + themes) and 'py' (to install plugs)
Data is installed in read-only /system/data, but with a postinstall script this is copied to a read/write directory accessable for CudaText (installed extra lexers and plugins already there, so that works fine) :)
1.200.0.0 released today :) https://github.com/Begasus/CudaText-Haikuports/releases/tag/1.200.0.0
You can inform me about Haiku releases. Closing the issue yet..
1.212.0.1 released today: https://github.com/Begasus/CudaText-Haikuports/releases/tag/1.212.0.1 Not sure if you are on a mastodon client, announced there too :)
Thanks. I do not use mastodon. will update the version on the homepage.
https://discuss.haiku-os.org/t/need-help-with-running-cudatext-editor/9717/5?u=alextp