How to install Linux packages in Replit - linux

I tried to use nasm in a bash project on Replit (educator) but it failed as nasm was not installed.
However, there are some assembly projects on Replit. So I forked a project, added my code, and boom it worked.
How nasm got installed in that project? Dunno, cause it's nowhere explained.
Now, I'd like to use external functions like printf in the assembly code. The code being x86-32, I need to install something similar to glibc-devel.i686 and glibc-devel (this on Fedora). Seems to be gcc-multilib in Ubuntu.
My question is : how do we install Linux packages in a bash project on Replit? Thanks for the help.

To install a Linux package in a bash project on Replit, run the command directly from the console or shell. If the command is found on Nix, you'll get an invite to run it from Nix and the package will be added to the config file replit.nix in your poject.
> nasm --version
nasm: command not installed, but was located via Nix.
Would you like to run nasm from Nix and add it to your replit.nix file? [Yn]:
> cat replit.nix
{ pkgs }: {
deps = [
pkgs.nasm
pkgs.bashInteractive
];
}
However, if the command you're trying to run is in a script, pressing the "Run" button or launching the script from the shell will only give an error "Command not found".
You can also add the package to your project by directly editing replit.nix.
You can check if your package exists in Nix using the NixOS Search - Packages page.

In bash type:
$ nix-env -iA nixpkgs.nasm

Related

How do use a command where you changed its installation directory in linux?

Hello I am on a linux server running 2.6.18-274.e15. I have installed a program called scons in order to compile a program called rosetta. In order to get scons to install when I ran it's python install I used the following command
python setup.py install flexed --prefix=.
This was because I am unable to use the folder it was trying to download into with my user status. When I call "scons --version" I am getting "command not found".
What I am wondering:
Is running scons even possible with my setup?
If so, what command would I use?
Thanks!
you need to add the directory of your binary to your path, in the shell:
$ export PATH=$PATH:/the/dir/of/your/binary

Net-SNMP perl module won't make

Firstly, I am using a Beaglebone Black with the Angstrom distribution.
My mib2c program for net-snmp won't work and give the following error:
ERROR: You don't have the SNMP perl module installed. Please obtain
this by getting the latest source release of the net-snmp toolkit from
http://www.net-snmp.org/download/ . Once you download the source and
unpack it, the perl module is contained in the perl/SNMP directory.
See the README file there for instructions.
So I go to /net-snmp/perl/SNMP and run
perl Makefile.PL
make
Now it gives me this error:
make: *** No rule to make target `/usr/lib/perl/5.14.2/ExtUtils/typemap', needed by `SNMP.c'. Stop.
Ok, so I know that the ExtUtils module must be installed (which it is), but all that I have in that folder are .pm files. When I run them using perl nothing happens. I've also tried to look for the files online (after I create a typemap file there it asks for a xsubpp file aswell), but to no avail.
How do I install those modules so that the correct files will be there?
On Ubuntu 14.04, I needed to sudo apt-get install libsnmp-perl
Install Perl Net::SNMP
perl -MCPAN -e 'install Net::SNMP'
You could try to install it using CPAN:
perl -MCPAN -e 'install HTML::Template'

Create .deb package - can't get dependencies

I am trying to create a simple .deb package by following a wonderful tutorial,
and my problem is that when I try to get the dependencies of the package by executing this command:
dpkg-depcheck -d ./configure
I get this error:
strace: ./configure: command not found
Running strace failed (command line:
strace -e trace=open,execve -f -q -o /tmp/depchqCdeiv ./configure
which I don't understand. Do you have any idea about what could be causing this?
This on Ubuntu 12.04.
I think that tutorial is not the better approach to create quality deb packages.
Better resources would be:
Debian New Maintainers' Guide
Introducing the Debian packaging tutorial
About the error, I imagine that the software that you are trying to package doesn't use autotools, and for that reason it doesn't have any configure script. The way that the dependencies are checked depends on the build system used. If you don't have a configure script, maybe your project root directory has a SConstructp, a setup.py or simply a Makefile.
Giving more information about the software you are trying to package I can provide further help.
Best regards

Node.js Cygwin not supported

I am trying to install node.js. I followed this tutorial and i am stuck in the middle.
When I write ./configure in my cygwin terminal it says "cygwin not supported". Please help me out
Thanks in advance.
Node in my experience runs fine in cygwin, what Node usually has EINVAL errors in seems to be MINTTY which is a terminal emulation 'skin' that is default to cygwin. I still am not sure why these EINVAL errors happen 100% but the following are the steps and tricks I use to get node working.
In my /cygwin/home/{username}/.bashrc I add node to path so cygwin can find it
export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"
If you run a 32 bit version of node:
export PATH=$PATH:"/cygdrive/c/Program Files (x86)/nodejs/"
Then to make npm run without windows to linux issues I launch cygwin in admin mode then run:
dos2unix '/cygdrive/c/Program Files/nodejs/npm'
At this point running files and most npm packages will run in MINTTY just fine, although every once and awhile you will run into EINVAL issues with certain npm packages as karma. Also you will not be able to run the interpreter directly in MINTTY, anytime I want to do these things I run:
cygstart /bin/bash
This will open a native cygwin bash.exe window, from here you run the interpreter or an any troubling package command that results in a EINVAL. It slightly sucks you have to do this but I rarely use this day to day, and I love MINTTY too much to not use it.
Also note that you can run any one line node code in MINTTY by just running something like:
node -e "console.log('hello node')"
As a simpler derivative of troy's answer for those just looking to install NPM packages:
Install Node.js with the Windows installer package.
Add it to the PATH with export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/" (obviously replacing the path to Node.js's installation directory with where you installed it).
There's a current bug in the Windows version that can be fixed by running mkdir -p ~/AppData/Roaming/npm. This is a bug for all of Windows and not just Cygwin. At some point of the future, you won't have to do this anymore, but the command shouldn't have any negative side effects.
Test it. Eg, npm install pretty-diff -g.
In order to be able to run the newly installed software, you'll need to add the install locations to your PATH. You can find these with npm bin -g and npm bin (the -g flag is the "global" installation location).
Not really anything special that you have to do to get it to run in Cygwin (although I can't say if everything works).
Use Console2, it allows you to run create tabs of CLI shells. It seems running cygwin inside console2 allows me to use node REPL just fine. I have no idea why :P
Follow this guide to add cygwin to console2:
http://blog.msbbc.co.uk/2009/11/configuring-console-2-and-bash-with.html
With Bjørn's suggestion (using Console2) and Soyuka's alias (steps here), my node.js v0.10.13 and npm v1.3.2 are now working under Babun v1.02, a Cygwin distribution.
For windows, Just run bash.exe in cmd, so that you could have a bash work around with cmd console directly, which could support ALL NODE WORKING PERFECTLY.
C:\Users\郷>bash
郷#CHIGIX ~
$ node
>
I'm using this wrapper in /usr/local/bin/node (note no extension!)
#!/bin/sh
_cmd="$(cygpath -lw -- "$1" )"
shift
"/proc/cygdrive/C/Program Files/nodejs/node.exe" "$_cmd" "$#"
This is far from perfect, as Node do not understand Cygwin directory tree, but works relatively well with relative names.
From Windows, run Cygwin.bat (instead of Cygwin Terminal) then in that run node: see and reply on this answer on this effectively-same question asked 1.5 years later.
Grab and run the node.js Windows installer.
In the Cygwin prompt type node
See if it works.

Cannot run Code::Blocks: libwx_gtk2u-2.8.so.0 not found

I am trying to install Code::Blocks 10.05 from (non-SVN) sources (codeblocks-10.05-src.tar.bz2). My OS is Ubuntu 11.04. I needed to download and install wxWidgets first (I now have wxGTK-2.8.12), which seemed to work. I compiled it according to these instructions:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux
Then I configured C::B with
./configure --with-wx-config=/opt/wx/2.8/bin/wx-config
and ran
export LDFLAGS="-Wl,-R /opt/wx/2.8/lib"
make
sudo -i
make install
When trying to run C::B, I get the following error:
codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0: cannot open shared object file: No such file or directory
The same question was asked here: error while loading shared libraries, but the suggested solution (namely adding the wxWidgets config to the options passed to configure) didn't work for me.
The output of wx-config --prefix is /opt/wx/2.8,
The output of wx-config --libs is -L/opt/wx/2.8/lib -pthread -lwx_gtk2u-2.8,
and that of which wx-config is /opt/wx/2.8/bin/wx-config.
I looked for the library and found /opt/wx/lib/libwx_gtk2u-2.8.so.0 to be a link to libwx_gtk2u-2.8.so.0.8.0 in the same folder.
What might be wrong here?
The problem is that the program cannot find the WX widgets libraries at run time. You will need to set your LD_LIBRARY_PATH variable to include the location of wxWidgets like this:
LD_LIBRARY_PATH=/opt/wx/2.8/lib ./codeblocks
The reason why its failing is because you compiled codeblocks against wxWidgets found in /opt/ and not the one installed in /usr/; the program doesn't know to look in /opt for the wx libraries.
Probably the easiest way to get code::blocks up and running on Ubuntu is to just install it via the Synaptic Package Manager. Just type in codeblocks into 'Quick search'. Find codeblocks on the list and just right-click to mark for install. Any dependencies and missing libraries needed will automatically be handled and installed by Synaptic as necessary.
If you're interested in trying the C::B nightly builds on Ubuntu then you'll want to checkout Jens' unofficial debian-repository here.
You can visit Why do I have to define LD_LIBRARY_PATH with an export every time I run my application? for a more generic case. For a particular case like yours you can follow the below given steps
If you had installed wxGTK then you would see the file in /usr/local/lib. You would get this error when the the above path is not as part of the makefile. I received this error while starting wxFormBuilder after building from source on CentOS. There are 2 approaches.
Approach 1: Putting the path in .bashrc
gedit /home/{your-username}/.bashrc
Then after the line # User specific aliases and functions paste the following
export $LD_LIBRARY_PATH=/usr/local/lib.
This would work for fine but for the current login, but for other users like root you might have to do the same in the respective .bashrc files.
Approach 2: Creating your own conf files
cd /etc/ld.so.conf.d
gedit wxformbuilder.conf
Give the path /usr/local/lib and save the file.
ldconfig (To update the library path).

Resources