Runing mix new app_first failed on CentOS - centos
I also encounter the problem: Runing mix new app_first failed in Elixir.
It runs on centos. This is the message:
The erlang version is normal :
github#localhost:$ erl
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
The elixir version is normal
github#localhost:~/elixir-otp-24$ bin/elixir --version
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.14.0 (compiled with Erlang/OTP 24)
But the mix is abnormal
github#localhost:~/elixir-otp-24$ bin/mix
{"init terminating in do_boot",{badarg,[{erlang,apply,[{'Elixir.Kernel.CLI.Config',[],<<".">>,[],true,[],[],false},update_commands,[#Fun<Elixir.Kernel.CLI.18.41400255>]],[{error_info,#{module=>erl_erts_errors}}]},{'Elixir.Kernel.CLI',process_argv,2,[{file,"lib/kernel/cli.ex"},{line,191}]},{'Elixir.Kernel.CLI',main,1,[{file,"lib/kernel/cli.ex"},{line,14}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({badarg,[{erlang,apply,[{_},update_commands,[_]],[{_}]},{Elixir.Kernel.CLI,process_argv,2,[{_},{_}]},{Elixir.Kernel.CLI,main,1,[{_},{_}]},{init,start_em,1,[]},{init,do_boot,3,[]}]})
Crash dump is being written to: erl_crash.dump...done
I have tried many ways, such as building from source. But it always failed.
I find the anwer: it should be setting environment variables.
PATH=/data/github/elixir-otp-24/bin:$PATH
Put it in .bashrc
Source .bashrc
It works
github#localhost:~$ mix
** (Mix) "mix" with no arguments must be executed in a directory with a mix.exs file
Usage: mix [task]
Related
How to fix "pytest: error: unrecognized arguments: -n"
Hi I am trying to run my tests parallely(pytest-xdist) on the azure pipelines. Till now the tests were running perfectly fine. Suddenly the pytest is throwing a weird error saying "unrecognized argument". The file name : integration_test.py Command used : pytest -n 5 --tb=short integration_test.py -v -s --> to run 5 tests parallely Total number of tests : 57 Versions : pytest==6.2.5 pytest-xdist==2.3.0 Even tried with the latest versions of these 2 modules. Error : ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: -n integration_test.py How can I overcome this error?
This error is what you encountered: As hoefling mentioned, the solution is to install the pytest-xdist: pip install pytest-xdist
On MacOS just running pytest might be ran by a different Python's version than you thought. $ pytest ============================================================================== test session starts =============================================================================== platform darwin -- Python 3.9.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1 rootdir: [REDACTED] plugins: anyio-3.5.0, cov-3.0.0 While $ python3 -m pytest ============================================================================== test session starts =============================================================================== platform darwin -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0 rootdir: [REDACTED] plugins: xdist-2.5.0, forked-1.4.0, pylama-8.4.1 Be careful, and launch it as a module :)
Tests for libffi fail on LFS
I am working on a Linux From Scratch project and I've run into some (potential) issues. In chapter 6.49: Libffi-3.2.1, I executed the "sed", "configure" and "make" commands successfully but when I executed "make check", it appears that every test fails: MAKE x86_64-unknown-linux-gnu : 0 * check ...stuff... Test run by root on Fri Jul 13 23:51:21 2018 Native configuration is x86_64-unknown-linux-gnu === libffi tests === Schedule of variations: unix Running target unix ...a lot of failures... FAIL: libffi.call/va_struct3.c -W -Wall -Wno-psabi -Os (test for excess errors) FAIL: libffi.call/va_struct3.c -W -Wall -Wno-psabi -O2 -fomit-frame-pointer (test for excess errors) === libffi Summary === # of unexpected failures 685 # of unresolved testcases 685 I've been following the book pretty closely, but maybe I missed something along the way. Should I even worry about this or should I just install it anyway and move on? Let me know if more information is needed.
Nevermind, I solved it. I basically went back and redid everything. I usually I copy and paste the commands from the LFS book into a bash script and run it that way (if I can get a away with it). Well, apparently I forgot to write one for the diffutils package. But this seems strange to me because I wouldn't think that missing that script would cause issues with a test that seems to use DejaGNU let alone get me that far without any troubles. Anyway, my LFS is up and running now! 😁
erlang os:cmd() command with UTF8 binary
I'm trying to get an Erlang function to execute a bash command containing unicode characters. For example, I want to execute the equivalent of: touch /home/jani/ჟანიweł I put that command in variable D, for example: io:fwrite("~ts", [list_to_binary(D)]). touch /home/jani/ჟანიwełok but after I execute: os:cmd(D) I get file called á??á??á??á??weÅ?. How can I fix it? os:cmd(binary_to_list(unicode:characters_to_binary("touch /home/jani/编程"))). Executing this command creates a file named ç¼?ç¨?, while executing the equivalent touch command directly in a terminal creates the file with the correct name.
Its because Erlang reads your source files like latin1 by default, but on newer versions of erlang you can set your files to use unicode. %% coding: utf-8 -module(test). -compile(export_all). test() -> COMMAND = "touch ჟანიweł", os:cmd(COMMAND). and then compiling and executing the module works fine rorra-air:~ > erl Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] Eshell V6.4 (abort with ^G) 1> c(test). {ok,test} 2> test:test(). [] and it created the file on my filesystem rorra-air:~ > ls -lta total 144 -rw-r--r-- 1 rorra staff 0 Jun 9 15:18 ჟანიweł
Calling sem_open on Solaris as ordinary user
This call fails on Solaris with EACCES when ran as ordinary user: sem_open(fileName.c_str(), O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, 1); When process is started as root, it runs fine. Is this expected behavior? Environment: $ uname -a SunOS solaris 5.11 11.0 i86pc i386 i86pc $ g++ --version g++ (GCC) 4.5.2
At the command line try: prctl $$ These are the system enforced resource limits your process has. Note there are process.max-sem-ops process.max-sem-nsems project.max-sem-ids These are limits that have a number, if you do not see them (or the limits are already reached) then you have to add them to your account's profile with projadd or projmod to increase them if your project already exists. If you cannot do this (no root access) consult with your sysadmin, s/he probably has some reason for not allowing semapahore access. Note carefully: sempahores are kernel persistent. If you ran your code a bunch of times the sempahores you created are likely still out there. To see existing semaphores try ipcs -as To remove lingering sempahores that your code should have removed use ipcrm
Erlang boss_db hello world?
Recently I tried to install and run a demo of boss_db ORM for Erlang. Here is what I did: clone the repository cd boss_db/ rebar get-deps put a simple mydb.erl file into src/: -module(mydb). -compile(export_all). start() -> DBOptions = [{adapter, pgsql}, {db_host, "localhost"}, {db_port, 5432}, {db_username, "postgres"}, {db_password, "mypass"}, {cache_enable, false}, {cache_exp_time, 0}], boss_db:start(DBOptions). rebar compile cd ebin/ run erl mydb:start() Here is what I get: ** exception exit: shutdown Whatam I doing wrong here? How is it supposed to be run? P.S. I tried to run application:start(boss_db) as well, but the result is the same. P.P.S. I have read the documentation twice, but I still have no idea how to run the whole thing.
You are not adding dependencies to the code path. That's why an exception is thrown when they are not found. Don't cd into ebin and erl. Instead run erl -pa ebin -pa deps/*/ebin from the current directory. Btw this is not a good way to do this kind of stuff. Instead create a new empty app using rebar. Add boss_db as a dependency to your app in rebar.config. Put your own source files under src. And then rebar get-deps compile erl -pa ebin -pa deps/*/ebin
git clone git://github.com/evanmiller/boss_db.git cd boss_db/ rebar get-deps emacs src/mydb.erl rebar compile erl -pa ./ebin ./deps/*/ebin These steps worked for me. code:is_loaded() will not work right after you run erl. Only when the module is invoked, the code is loaded. I do get an application shutdown, but it is because the code is trying to connect to a Postgres DB and can't connect to it. Erlang R15B02 (erts-5.9.2) [source] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9.2 (abort with ^G) 1> mydb:start(). ** exception exit: shutdown =ERROR REPORT==== 9-Oct-2012::12:13:07 === ** Generic server <0.35.0> terminating ** Last message in was {'EXIT',<0.34.0>, {{badmatch, {error, {{badmatch, {error, {{badmatch,{error,econnrefused}}, [{pgsql_sock,init,1, [{file,"src/pgsql_sock.erl"},{line,51}]}, {gen_server,init_it,6, [{file,"gen_server.erl"},{line,304}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,227}]}]}}}, [{boss_db_controller,init,1, [{file,"src/boss_db_controller.erl"},{line,31}]}, {gen_server,init_it,6, [{file,"gen_server.erl"},{line,304}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,227}]}]}}}, [{poolboy,new_worker,2, [{file,"src/poolboy.erl"},{line,348}]}, {poolboy,prepopulate,4, [{file,"src/poolboy.erl"},{line,370}]}, {poolboy,init,2, [{file,"src/poolboy.erl"},{line,74}]}, {gen_fsm,init_it,6, [{file,"gen_fsm.erl"},{line,361}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,227}]}]}} ** When Server state == {state, {<0.35.0>,poolboy_sup}, simple_one_for_one, [{child,undefined,boss_db_controller, {boss_db_controller,start_link, [[{size,5}, {max_overflow,10}, {adapter,pgsql}, {db_host,"localhost"}, {db_port,5432}, {db_username,"postgres"}, {db_password,"mypass"}, {cache_enable,false}, {cache_exp_time,0}]]}, temporary,brutal_kill,worker, [boss_db_controller]}], {set,0,16,16,8,80,48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[], []}, {{[],[],[],[],[],[],[],[],[],[],[],[],[],[], [],[]}}}, 0,1,[],poolboy_sup, {boss_db_controller, [{size,5}, {max_overflow,10}, {adapter,pgsql}, {db_host,"localhost"}, {db_port,5432}, {db_username,"postgres"}, {db_password,"mypass"}, {cache_enable,false}, {cache_exp_time,0}]}} ** Reason for termination == ** {{badmatch, {error, {{badmatch, {error, {{badmatch,{error,econnrefused}}, [{pgsql_sock,init,1, [{file,"src/pgsql_sock.erl"},{line,51}]}, {gen_server,init_it,6, [{file,"gen_server.erl"},{line,304}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,227}]}]}}}, [{boss_db_controller,init,1, [{file,"src/boss_db_controller.erl"},{line,31}]}, {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,227}]}]}}}, [{poolboy,new_worker,2,[{file,"src/poolboy.erl"},{line,348}]}, {poolboy,prepopulate,4,[{file,"src/poolboy.erl"},{line,370}]}, {poolboy,init,2,[{file,"src/poolboy.erl"},{line,74}]}, {gen_fsm,init_it,6,[{file,"gen_fsm.erl"},{line,361}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}