Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some improvements on ncurses #3049

Closed
wants to merge 3 commits into from
Closed

some improvements on ncurses #3049

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 6, 2024

hi

i wanted to cross compile my project that uses this library for arm64 linux from an x86_64 linux host,

i used xmake f -p cross --cross=aarch64-linux-gnu- (i have the cross gcc and binutils installed on my host, sysroot is at /usr/aarch64-linux-gnu and gcc is prefixed by aarch64-linux-gnu- and its installed to /usr/bin),

but i had got a problem while configuring, a warning complains about ncurses is not supported for cross/arm64,
so i had a quick check of the source and found the supported platform list is hardcoded...

but luckily after removing it and tweaking some ac config options, it does seems to build and work with my original project.

also i thought adding these extsources might make it more friendly for some users?

@ghost ghost changed the title some improvements for ncurses package some improvements on ncurses Jan 6, 2024
@ghost
Copy link
Author

ghost commented Jan 6, 2024

another weird behavior is i cannot use linux as platform type

these attempts were failed (because it detects x86_64 which is my host architecture, and it's wrong since i am trying to cross compile for arm64):

❯ xmake f -m debug -p linux --cross=aarch64-linux-gnu-
checking for architecture ... x86_64
^C
❯ xmake f -m debug -p linux --cross=aarch64-linux-gnu- --bin=/usr/bin --sdk=/usr/aarch64-linux-gnu
checking for architecture ... x86_64
^C

@ghost
Copy link
Author

ghost commented Jan 6, 2024

it detects x86_64 which is my host architecture

i tried to correct it by specifying -a arm64 manually, but the build still eventually fail at some where...

@ghost
Copy link
Author

ghost commented Jan 6, 2024

i have also tried vcpkg, but it ran into this issue:

❯ rm -rf ~/.xmake/ .xmake build /tmp/.xmake1000
❯ vcpkg install ncurses:arm64-linux
Computing installation plan...
The following packages are already installed:
    ncurses:[email protected]#1
ncurses:arm64-linux is already installed
Total install time: 24.8 us
The package ncurses is compatible with built-in CMake variables:

    set(CURSES_NEED_NCURSES TRUE)
    find_package(Curses REQUIRED)
    target_include_directories(main ${CURSES_INCLUDE_DIRS})
    target_compile_options(main ${CURSES_CFLAGS})
    target_link_libraries(main PRIVATE ${CURSES_LIBRARIES})

❯ xmake f -m debug -p linux -a arm64 --cross=aarch64-linux-gnu- -vD
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checking for unzip ... /usr/bin/unzip
checking for git ... /usr/bin/git
checking for gzip ... /usr/bin/gzip
checking for tar ... /usr/bin/tar
note: install or modify (m) these packages (pass -y to skip confirm)?
in vcpkg:
  -> vcpkg::ncurses latest 
please input: y (y/n/m)
y
installing ncurses from vcpkg ..
checking for vcpkg ... /opt/vcpkg/vcpkg
/opt/vcpkg/vcpkg install ncurses:arm64-linux --debug
[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from /opt/vcpkg/vcpkg-bundle.json
[DEBUG] Failed to open: /opt/vcpkg/vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
[DEBUG] Using scripts-root: /opt/vcpkg/scripts
[DEBUG] Using builtin-ports: /opt/vcpkg/ports
[DEBUG] Using installed-root: /opt/vcpkg/installed
[DEBUG] Using buildtrees-root: /opt/vcpkg/buildtrees
[DEBUG] Using packages-root: /opt/vcpkg/packages
[DEBUG] Using vcpkg-root: /opt/vcpkg
[DEBUG] Using scripts-root: /opt/vcpkg/scripts
[DEBUG] Using builtin-registry: /opt/vcpkg/versions
[DEBUG] Using downloads-root: /var/cache/vcpkg
Computing installation plan...
[DEBUG] Loading dep info for: ncurses:arm64-linux
[DEBUG] Found path: /usr/bin/cmake
[DEBUG] 1000: execute_process(/usr/bin/cmake --version)
[DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after    18290 us
[DEBUG] 1001: execute_process(/usr/bin/cmake -DVCPKG_ROOT_DIR=/opt/vcpkg -DPACKAGES_DIR=/opt/vcpkg/packages -DBUILDTREES_DIR=/opt/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=/opt/vcpkg/installed -DDOWNLOADS=/var/cache/vcpkg -DVCPKG_MANIFEST_INSTALL=OFF -P /opt/vcpkg/buildtrees/0.vcpkg_dep_info.cmake)
[DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after    19715 us
The following packages are already installed:
    ncurses:[email protected]#1
[DEBUG] Default binary cache path is: /home/yurri/.cache/vcpkg/archives
ncurses:arm64-linux is already installed
Total install time: 19.9 us
The package ncurses is compatible with built-in CMake variables:

    set(CURSES_NEED_NCURSES TRUE)
    find_package(Curses REQUIRED)
    target_include_directories(main ${CURSES_INCLUDE_DIRS})
    target_compile_options(main ${CURSES_CFLAGS})
    target_link_libraries(main PRIVATE ${CURSES_LIBRARIES})

[DEBUG] /mnt/vss/_work/1/s/src/vcpkg/commands.install.cpp(1425): 
[DEBUG] Time in subprocesses: 38005us
[DEBUG] Time in parsing JSON: 35us
[DEBUG] Time in JSON reader: 39us
[DEBUG] Time in filesystem: 598us
[DEBUG] Time in loading ports: 220us
[DEBUG] Exiting after 43.7 ms (42743us)

error: .../modules/private/action/require/impl/actions/install.lua:398: fetch vcpkg::ncurses-latest failed!
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:949]: in function 'raiselevel'
    [@programdir/core/sandbox/modules/utils.lua:149]: in function 'assert'
    [.../modules/private/action/require/impl/actions/install.lua:398]:

  => install vcpkg::ncurses latest .. failed
error: @programdir/core/main.lua:314: @programdir/modules/async/runjobs.lua:320: .../modules/private/action/require/impl/actions/install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:949]:
    [.../modules/private/action/require/impl/actions/install.lua:474]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
    [.../modules/private/action/require/impl/actions/install.lua:333]:
    [...modules/private/action/require/impl/install_packages.lua:479]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:237]:

stack traceback:
	[C]: in function 'error'
	@programdir/core/base/os.lua:949: in function 'os.raiselevel'
	(...tail calls...)
	@programdir/core/main.lua:314: in upvalue 'cotask'
	@programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>

@ghost
Copy link
Author

ghost commented Jan 6, 2024

humm, looks like windows and macos builds are broken?

@waruqi
Copy link
Member

waruqi commented Jan 6, 2024

humm, looks like windows and macos builds are broken?

you need remove --without-progs and we should disable windows platform.

@ghost
Copy link
Author

ghost commented Jan 7, 2024

i do have a windows and mac pc, so i guess let's see when i will have chance to test build on them and fix...

@ghost ghost closed this by deleting the head repository Aug 4, 2024
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant