How do I install Pact onto Windows? - pact-lang

I was going through the beginner tutorial and came to the Atom SDK page. I have a windows system, so installing brew doesn't work, but the tutorial only gives a way for Linux systems or Mac OS systems to install Pact. Is there any way to install Pact onto windows?

There is no official support for Windows (to my knowledge), but there is a possible workaround that worked for me. The workaround involves Ubuntu and WSL(Windows Subsystem for Linux).
The first step is installing Ubuntu and WSL in your windows device. Those who have done this could move ahead to step two. I followed this Youtube video for setting up WSL
With WSL Terminal set up, go to the terminal home directory and download the compressed pact executable from the official pact releases Github, suiting your ubuntu version, using command line curl. An example command I used for Ubuntu 20.04 and Pact v4.3 is:
curl -LJO https://github.com/kadena-io/pact/releases/download/v4.3/pact-4.3-linux-20.04.zip
3.Install unzip on command line using:
sudo apt install unzip
Unzip the compressed executable to the same directory using the unzip command. ex:
unzip pact-4.3-linux-20.04.zip`
this will add a pact.exe file on that directory
Update the user permissions on the pact.exe file using chmod command to enable read and execute.
chmod u=rx ./pact
Add the directory with pact executable to terminal permanent search path. This is done by exporting a new path in the .bash_profile file. (Editing .bash_profile could be done through any command line text editor e.g. vim). I followed this tutorial to complete this step.
And that should allow you to start pact from a windows wsl terminal.

Related

C Code Won't Compile in MacOS Catalina or Big Sur

I am unable to compile C code on neither MacOS Catalina nor Big Sur. I see the header files present in /usr/include/, but I get errors from my C compiler.
Current error messages I get from the compiler are:
For "#include <time.h>" => error: cannot open source file "time.h"
For "#include <stdint.h>" => error: cannot open source file
"stdint.h"
What I've tried:
I tried sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / and it says "upgrade successful", but does not resolve any errors.
I tried uninstalling and reinstalling XCode (Version 10.1)
I tried downloading the .pkg file you mentioned (because I was missing it) but was told my macOS version was too new
The files I need are stored in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include, so we added a new CPATH and PATH variable (separately) for that path to ~/.bash_profile and /etc/paths
I tried to provide #include statements with explicit paths to those files, which quickly spiraled out of control
I tried to move all of the required files from the above directory to my project folder and changing the paths appropriately in the code
I tried to run sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
The files should also be stored in Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include, so I tried doing the above steps with this path as well
Any advice would be helpful. Thank you!
To provide more clarity based on a comment from Joshua below, these are the steps I followed to set up the 32-bit ARM cross-compiler:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
brew install gmp
brew install mpfr
brew install libmpc
Downloaded "binutils-2.36.tar.xz" from here
Outside of the binutils directory, created a directory called
"build32"
../binutils-2.36/configure --target=arm-none-eabi --disable-nls --enable-languages=c --without-headers
make -j4 all
sudo make install
Downloaded "gcc-arm-src-snapshot-10.2-2020.11.tar.xz" from here
Inside the main directory, created a subdirectory called "build32"
../gcc-arm-src-snapshot-10.2-2020.11/configure --target=arm-none-eabi --disable-nls --enable-languages=c --without-headers
make -j4 all-gcc
sudo make install-gcc
I ended up switching to a Windows Subsystem for Linux setup on another machine for what I was working on. Another option is to set up a VM on the Mac. I could not figure out another solution for getting it to "just work" on the Mac. Thanks to everyone for the suggestions!
For those looking to pivot to WSL, follow this setup guide.
For those looking to go the VM workaround route, this is one process that was graciously recommended to me:
"1. Install Virtualbox from https://www.virtualbox.org/
Install Vagrant from https://www.vagrantup.com/
Download the prebuilt ARM gcc cross compiler from the link above in my question.
Move the download file into the project directory and run the following command to extract it:
tar -xvf gcc-arm-10.2-2020.11-x86_64-arm-none-eabi.tar.xz
Download this Vagrantfile (fyi 'this' triggers a download of said file) and move it to the project directory as
well. This file tells vagrant how to setup the VM. It will mount the
project directory as well as the SD card. On line 41 of this file it
tells vagrant where the SD card is located so change the first path
on this line to where your SD card is located. Additionally, because
the project directory is mounted, you can still edit the project
files locally on your machine instead of having to use what's on the
VM if you use this solution.
After all that, you should be ready to create/start the VM using the
command vagrant up. To log into the VM, vagrant ssh after the
vagrant up command finishes. Your project files should be located in
the /vagrant directory. You are now all setup to compile the project
and if you run make cp it should compile the project and copy it
over to the SD card.
To shutdown the VM you can run vagrant halt to shutdown the VM, and
to get rid of the VM you can run vagrant destroy. vagrant destroy
will not delete any of the files that were shared from your computer
to the VM."

What to install and how to run an executable file on Mac?

So I'm in terminal, and have a directory called CAPTURE on my desktop, I'm trying to run a program called 'testme'. I read that you need to have build-essential installed but I think that's only on Linux systems and I'm on a Mac so it wasn't necessary because it's already built in (I think). So, I navigated from ~ with:
cd Desktop/CAPTURE
Then, I tried running a bunch of different commands that I found while looking on the internet:
./testme
which returned zsh: exec format error: ./testme
xcode-select --install
which installed properly and I thought I could run the ./testme command but I got the same error as before. Then I tried navigating to the directory again and used
chmod +x ./testme
./testme
which also did not work. I've never run executables before so I really have no familiarity with these commands so they might be super wrong. If anyone can help me run the file properly, that would be much appreciated.
Since your question is tagged as C and Clang, and you are talking about build-essential, I will assume that you are attempting to build an application from source code.
Instead of build-essential, in macOS, you need Xcode. The Xcode CLI tools will work if the application is text-only or Curses, but you will need the entire Xcode IDE for any graphical application.
If running ./testme is telling you Executable format error is probably because it's a prebuilt executable, very likely a Linux ELF executable that will not run in macOS.
My suggestion is to try to build the software. Most C applications will build if you run make inside the directory. make is installed by default by Xcode. Other applications may need a third-party build system, such as CMake, but I do not know if that's the case.

I can't find /rootfs on Windows 10

I'm very confused with the whole WSL situation. Sometimes I feel like I get it but in reality, I don't. My main confusion is where does Ubuntu (I use Ubuntu 20.04) save files? And how do they intertwine with files I install with Windows Command Line? All installations I have done via Ubuntu have been a waste of time, I can't find packages or libraries I install for any programming language. If someone knows of a course or video that could help me understand, I would appreciate it if you share it as well.
The specific situation of this question is caused because I installed a package for C with Ubuntu (the cs50 one) but I can't get VS Code to recognize it. I tried adding /usr/local path to the c_cpp_properties.json but it doesn't find this path.
I go to this folder in the explorer and I don't find anything, as expected.
Thanks in advance.
The file ext4.vhdx is the complete filesystem for the Linux subsystem. However, you can't (or shouldn't) access it directly from Windows 10.
Instead (within the Linux subsystem) you can access your C: drive through mount point /mnt/c (E.g. ls -l /mnt/c/Users ), and that way copy files between the two file systems.
If you want to user Windows explorer (again within the Linux subsystem), use following command:
/mnt/c/Windows/explorer.exe .
Just found out. You can access the files directly from Windows 10. E.g:
dir \\wsl$\Ubuntu-20.04\home
I faced the same problem. I was trying to reach rootfs but couldn't and as you have shown, I was reaching a dead end at "ext4.vhdx". After looking at articles, I found the home directory is found within the Linux subsystem, and to reach there you can use the following path to Linux and go to Linux > Ubuntu > home > user/admin and you'll be in your home directory.
You can directly type \\\\wsl$ in the directory path and then you can see the below image to access the file directory of ubuntu.
File Directory
Then, You can navigate here to see all the files as same as rootfs.`
\Ubuntu-22.04\home\user-name
`
I had the same issue and this is how I figured it out:
first, open PowerShell and type: wsl -d Ubuntu
then, go to your file explorer and type: \\wsl$
this will open the Ubuntu folder and you can access all your files

How do I know the macports package name for a command?

A script I need to run uses tempfile, but I don't have that on my Mac. I do use Macports. How can I find out which Macports package I need to install to get tempfile?
tempfile is a shell command used in scripting. It's an ELF binary on my Linux box and belongs to the debianutils package, as shown by dpkg -S /bin/tempfile. I Installed the Macports debianutils package and now have tempfile.
Just wondering how I'll figure this out if I don't have a Linux box handy...
Is tempfile a Python library? If so, you should be able to install it with pip if you have it.
On another note, you should probably switch to Homebrew as your package manager.

(Mac OSX) Adding libraries to C -specifically gnuplot

I am a begineer trying to get code in C. I am working on a Mac and using xcode. My only past experience has been with java using eclipse and everything was pretty straight forward. I have almost no experience with terminal.
I am required to learn a bit of C for a project I will be working on and the learning of syntax is coming along okay, but I am at a point where I need to include some libraries in my c program. Specifically I am attempting to make plots with gnuplots.
I have downloaded gnuplot-4.6.3 from their repository and I do not even know how to install the files. I have been looking around and have tried using terminal to use the ./configure command when I am in the gnuplot-4.6.3 directory. But I really don't know what I am doing so I don't even know where to go next or what to do next.
Sorry if this is so trivial, I honestly just have never done this before and I cannot find a good tutorial on what to do.
Thanks for any help you can offer.
I would recommend using MacPorts for installing third-party tools and libraries. It knows the dependencies required and will install them as part of the installation.
Download it from macports.org.
Install it, and allow it to modify your ~/.profile so that /opt/local/bin is in your $PATH (any issue then just do export PATH=/opt/local/bin:$PATH from the command line).
sudo port selfupdate
sudo port install gnuplot
Now that will install the library into /opt/local/lib with the include files in /opt/local/include, so now just add that library to your Xcode project. Select the target and in the Build Phases tab open up the Link Binary With Libraries and press the + button and select Add Other. Now find /opt/local/lib/libgnuplot.a (I am assuming that's what it's called; I don't have it installed my self):
Now add /opt/local/include to your Header Search Paths so the compiler can find the gnuplot header files. Select the target and in Build Setting type in "header search" in the search box. Now double-click on the Header Search Path in the target column (or the project column to the right) and add /opt/local/include:
It's fine! You're learning then! Keep up! When I hit this kind of problem you may want to learn about the basis for linux gcc/g++ compilation and linking processes. Then you should learn Cmake and Automake, which are basically packages to configure projects before compiling building.
A typical (good) project in Unix systems build with commands
./configure
make
sudo make install
or
cmake CMakelists.txt
make all
sudo make install
That's what you need to do after downloading a source tarball online to install unix programs.
Now since you are using Mac, there are so-called package installers, one which is macports and homebrew. I personally suggest homebrew than macports here (I've tried both, although macports still outnumber homebrew with the number of repos, homebrew has the newest support, especially when upgrading to a new OS). So to install homebrew you can do
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Execute that in your terminal (see http://brew.sh/) for more information.
Then you could simply install GNUplot by
brew install gnuplot

Resources