Comments (21)
你这似乎是没安装python和mojo 0.6.0
from moxt.
都正常安装了的
from moxt.
xxx@xxx:/Downloads$ git clone https://github.com/f0cii/moxt.git/Downloads$ cd moxt/
Cloning into 'moxt'...
remote: Enumerating objects: 186, done.
remote: Counting objects: 100% (186/186), done.
remote: Compressing objects: 100% (141/141), done.
remote: Total 186 (delta 61), reused 161 (delta 38), pack-reused 0
Receiving objects: 100% (186/186), 186.08 KiB | 99.00 KiB/s, done.
Resolving deltas: 100% (61/61), done.
xxx@xxx:
xxx@xxx:/Downloads/moxt$ chmod +x ./scripts/ld/Downloads/moxt$ chmod +x ./scripts/mojoc
xxx@xxx:
xxx@xxx:/Downloads/moxt$ chmod +x ./moxt_test.sh/Downloads/moxt$ ./moxt_test.sh
xxx@xxx:
/usr/bin/env: ‘python’: No such file or directory
./moxt_test.sh: line 3: ./moxt_test: No such file or directory
xxx@xxx:/Downloads/moxt$ which mojo/Downloads/moxt$ mojo -v
/home/xxx/.modular/pkg/packages.modular.com_mojo/bin/mojo
xxx@xxx:
mojo 0.6.0 (d55c0025)
jasper@jasper:~/Downloads/moxt$ python3 -V
Python 3.11.6
from moxt.
试试用以下命令:
python3 ./scripts/mojoc moxt_test.mojo -lmoxt -L . -o moxt_test
from moxt.
还是有错误,是否是因为您的环境中是python而不是python3?然后您代码中指定了是使用python?
xxx@xxx:~/Downloads/moxt$ python3 ./scripts/mojoc moxt_test.mojo -lmoxt -L . -o moxt_test
/usr/bin/env: ‘python’: No such file or directory
collect2: error: ld returned 127 exit status
mojo: error: failed to link executable
from moxt.
正常安装的python。都是可以直接调用python的,默认python就是python3。我安装的是miniconda3.11:
python --version
Python 3.11.5
from moxt.
你试试改一下./scripts/mojoc,将里面的#!/usr/bin/env python,修改成#!/usr/bin/env python3试试,或者删除这行,直接用:
python3 ./scripts/mojoc moxt_test.mojo -lmoxt -L . -o moxt_test
from moxt.
正常安装的python。都是可以直接调用python的,默认python就是python3。我安装的是miniconda3.11: python --version Python 3.11.5
这不能,我是ubuntu自带的python,是python3:
xxx@xxx:/Downloads/moxt$ python -V/Downloads/moxt$ python3 -V
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
xxx@xxx:
Python 3.11.6
from moxt.
请更新代码,我已经把代码中的:
#!/usr/bin/env python
修改为
#!/usr/bin/env python3
目前测试支持系统默认安装的python3,请更新代码后重试
from moxt.
同样有错误:
xxx@xxx:~/Downloads/moxt$ ./moxt_test.sh
/usr/bin/ld: cannot find -lmoxt: No such file or directory
./moxt_test.sh: line 3: ./moxt_test: No such file or directory
似乎问题出在这行:
搜索 "/usr/bin/ld" (1个文件中匹配到1次,总计查找91次)
D:\Job\Github\moxt-main\scripts\ld (匹配1次)
行 25: argv[0] = "/usr/bin/ld" # put back original ld
from moxt.
这个问题是否是因为需要编译libmoxt.so?
from moxt.
我按照您的教程已经安装了
sudo apt install pkg-config
sudo apt install e2fslibs-dev
sudo apt install zlib1g-dev
sudo apt install libssl-dev libcurl4-openssl-dev libaio-dev
xxx@xxx:~/Downloads/moxt-cpp$ xmake -vD
Command 'xmake' not found, did you mean:
command 'umake' from snap ubuntu-make (master)
command 'cmake' from snap cmake (3.28.0)
command 'omake' from deb omake (0.10.6-1)
command 'pmake' from deb bmake (20200710-16)
command 'qmake' from deb qtchooser (66-2build1)
command 'cmake' from deb cmake (3.27.4-1)
command 'gmake' from deb make (4.3-4.1build1)
command 'gmake' from deb make-guile (4.3-4.1build1)
command 'vmake' from deb hdf4-tools (4.2.16-3)
command 'bmake' from deb bmake (20200710-16)
command 'mmake' from deb mmake (2.3-9)
command 'jmake' from deb dist (1:3.5-236-1)
command 'imake' from deb xutils-dev (1:7.7+6.2)
command 'make' from deb make (4.3-4.1build1)
command 'make' from deb make-guile (4.3-4.1build1)
from moxt.
你需要先安装xmake,安装教程参考:
https://xmake.io/#/zh-cn/guide/installation
另外建议安装gcc11,安装命令可能如下:
sudo apt install gcc-11 g++-11
from moxt.
好吧,非常感谢您,我对C/C++比较陌生。我在看看xmake如何编译
from moxt.
我使用xmake构建时,出现了大量的错误信息,这是最后小段打印的错误信息
make: *** [Makefile:91: all] Error 2
error: @programdir/core/sandbox/modules/os.lua:378: execv(make -j3 VERBOSE=1) failed(2)
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:923]:
[@programdir/core/sandbox/modules/os.lua:378]:
[@programdir/core/sandbox/modules/os.lua:291]: in function 'vrunv'
[@programdir/modules/package/tools/cmake.lua:912]: in function '_install_for_make'
[@programdir/modules/package/tools/cmake.lua:1048]: in function 'install'
[./myrepo/packages/p/photonlibos/xmake.lua:28]: in function 'script'
[...dir/modules/private/action/require/impl/utils/filter.lua:125]: in function 'call'
[.../modules/private/action/require/impl/actions/install.lua:366]:
=> install photonlibos @default .. failed
error: @programdir/core/main.lua:309: @programdir/core/sandbox/modules/import/core/base/task.lua:65: @programdir/modules/async/runjobs.lua:320: .../modules/private/action/require/impl/actions/install.lua:471: install failed!
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:923]:
[.../modules/private/action/require/impl/actions/install.lua:471]: in function 'catch'
[@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
[.../modules/private/action/require/impl/actions/install.lua:330]:
[...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:923: in function 'base/os.raiselevel'
(...tail calls...)
@programdir/core/main.lua:309: in upvalue 'cotask'
@programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>
from moxt.
这些错误的信息,我感觉像是您提供的代码无法构建成功:
xaccel@xaccel:~/Downloads/moxt-cpp$ . gen-cmake.sh
checking for platform ... linux
checking for architecture ... x86_64
note: install or modify (m) these packages (pass -y to skip confirm)?
in my-repo-local:
-> photonlibos @default [build_shared:n, static:"photon_sole"]
-> libcds v2.3.3
-> snmalloc-local 2023.11.27
-> spscqueue v1.1
-> nontype_functional @default
-> yyjson-local 0.8.0
in xmake-repo:
-> boost#1 1.83.0 [from:libcds]
-> asio 1.28.0
-> m4 1.4.19 [from:autoconf]
-> autoconf 2.71 [from:automake,libtool,libuv]
-> automake 1.16.5 [from:libuv]
-> libtool 2.4.7 [from:libuv]
-> libuv v1.46.0
-> mpmcqueue v1.0
please input: y (y/n/m)
y
=> install photonlibos @default .. failed
[ 1%] Building CXX object third_party/CMakeFiles/easy_weak.dir/easy_weak/easy_weak.cpp.o
[ 3%] Building CXX object CMakeFiles/photon_obj.dir/common/alog.cpp.o
[ 5%] Building CXX object third_party/CMakeFiles/fstack_weak.dir/fstack_weak/fstack_weak.cpp.o
[ 6%] Linking CXX static library ../output/libfstack_weak.a
[ 8%] Linking CXX static library ../output/libeasy_weak.a
[ 8%] Built target fstack_weak
[ 10%] Building CXX object CMakeFiles/photon_obj.dir/common/checksum/crc32c.cpp.o
[ 10%] Built target easy_weak
[ 12%] Building CXX object CMakeFiles/photon_obj.dir/common/estring.cpp.o
[ 13%] Building CXX object CMakeFiles/photon_obj.dir/common/event-loop.cpp.o
[ 15%] Building CXX object CMakeFiles/photon_obj.dir/common/executor/executor.cpp.o
[ 17%] Building CXX object CMakeFiles/photon_obj.dir/common/expirecontainer.cpp.o
[ 18%] Building CXX object CMakeFiles/photon_obj.dir/common/identity-pool.cpp.o
/home/xaccel/.xmake/cache/packages/2312/p/photonlibos/@default/source/photonlibos/common/alog.cpp: In member function ‘virtual void BaseLogOutput::write(int, const char*, const char*)’:
/home/xaccel/.xmake/cache/packages/2312/p/photonlibos/@default/source/photonlibos/common/alog.cpp:47:16: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | ::write(log_file_fd, begin, end - begin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if you want to get more verbose errors, please see:
-> /home/xaccel/.xmake/cache/packages/2312/p/photonlibos/@default/installdir.failed/logs/install.txt
from moxt.
1.确保安装好xmake:
xmake --version
应该显示 xmake v2.8.5+20231123
2.进入moxt-cpp目录,安装xmake包,执行以下命令:
xmake f -c
正常应该显示全部安装成功
3.然后执行xmake -vD 执行构建 (-vD是显示详细信息)
4.执行gen-cmake.sh,是运行如下: ./gen-cmake.sh
5.这些基本的构建和xmake基本使用,在文档中比较省略,需要掌握这些基本知识
from moxt.
在第二步出现了错误:
xaccel@xaccel:~/Downloads/moxt-cpp$ xmake --version
xmake v2.8.5+20231107, A cross-platform build utility based on Lua
Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io
_
__ ___ __ __ __ | | ______
\ / / | / |/ _ | |/ / __
> < | _/ | /| | < /
//__|| ||_ ||____|
by ruki, xmake.io
👉 Manual: https://xmake.io/#/getting_started
🙏 Donate: https://xmake.io/#/sponsor
xaccel@xaccel:~/Downloads/moxt-cpp$ xmake f -c
checking for platform ... linux
checking for architecture ... x86_64
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
-> boost#1 1.83.0 [from:libcds]
-> asio 1.28.0
-> m4 1.4.19 [from:autoconf]
-> autoconf 2.71 [from:automake,libuv,libtool]
-> automake 1.16.5 [from:libuv]
-> libtool 2.4.7 [from:libuv]
-> libuv v1.46.0
-> mpmcqueue v1.0
in my-repo-local:
-> photonlibos @default [static:"photon_sole", build_shared:n]
-> libcds v2.3.3
-> snmalloc-local 2023.11.27
-> spscqueue v1.1
-> nontype_functional @default
-> yyjson-local 0.8.0
please input: y (y/n/m)
y
=> install photonlibos @default .. failed
[ 1%] Building CXX object third_party/CMakeFiles/easy_weak.dir/easy_weak/easy_weak.cpp.o
[ 3%] Building CXX object CMakeFiles/photon_obj.dir/common/alog.cpp.o
[ 5%] Building CXX object third_party/CMakeFiles/fstack_weak.dir/fstack_weak/fstack_weak.cpp.o
[ 6%] Linking CXX static library ../output/libeasy_weak.a
[ 6%] Built target easy_weak
[ 8%] Building CXX object CMakeFiles/photon_obj.dir/common/checksum/crc32c.cpp.o
[ 10%] Linking CXX static library ../output/libfstack_weak.a
[ 10%] Built target fstack_weak
[ 12%] Building CXX object CMakeFiles/photon_obj.dir/common/estring.cpp.o
[ 13%] Building CXX object CMakeFiles/photon_obj.dir/common/event-loop.cpp.o
[ 15%] Building CXX object CMakeFiles/photon_obj.dir/common/executor/executor.cpp.o
[ 17%] Building CXX object CMakeFiles/photon_obj.dir/common/expirecontainer.cpp.o
[ 18%] Building CXX object CMakeFiles/photon_obj.dir/common/identity-pool.cpp.o
/home/xaccel/.xmake/cache/packages/2312/p/photonlibos/@default/source/photonlibos/common/alog.cpp: In member function ‘virtual void BaseLogOutput::write(int, const char*, const char*)’:
/home/xaccel/.xmake/cache/packages/2312/p/photonlibos/@default/source/photonlibos/common/alog.cpp:47:16: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | ::write(log_file_fd, begin, end - begin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if you want to get more verbose errors, please see:
-> /home/xaccel/.xmake/cache/packages/2312/p/photonlibos/@default/installdir.failed/logs/install.txt
from moxt.
请看输出中的:
if you want to get more verbose errors, please see:
-> /home/xaccel/.xmake/cache/packages/2312/p/photonlibos/@default/installdir.failed/logs/install.txt
需要查看这个文件,看具体什么错误。
另外,要注意一点,查看gcc和g++的版本
gcc --version
g++ --version
请确保是版本11,目前我测试photonlibos库还不支持gcc12编译
from moxt.
十分的感谢您耐心解答
from moxt.
重新更新了多处代码,并且更新到mojo v0.6.1,目前已经增加websocket等支持,运行稳定
from moxt.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moxt.