C library problems installing - c

I am a beginner C programmer, and recently I have run into a problem that I was unable to solve.
I am struggling to install and use a C library. The message error is:
My OS is Mac OS X and im try install the file with ".command" format.
Can someone help me install this library?
Thanks in advance.

More than help installing the library, you need help in understanding what's going on.
Someone gave you a command to run and you ran it, but they were assuming that you were using a different OS, like Ubuntu.
The first message "apt-get not found" is because you're running MacOS, which doesn't have an "apt-get" command.
The second error is because you also don't have wget.
The rest of the messages indicate a poorly written script file, since it blew up twice and still went on to truncate files and do other things.
While you're not going to be able to install apt-get, you might be able to find a compatible version of wget. If not, you can download whatever it was trying to get using your browser, since wget is typically used to automate web HTTP/HTTPS requests.
Without seeing the file, I don't know what the rest if the script was trying to do, but if you read it you should be able to figure out what it was doing, and do it manually.
An easier way to do all this is to install Virtualbox on your mac and run a copy of Ubuntu inside a virtual machine. Then you can run your class assignments without needing to rewrite them all.

Related

How to run gcc in pfsense terminal?

I need to run a javascript script in pfsense terminal but I don't know how to download the gcc nor node library to run it. And if I do don't know how to export the correct command to use the "gcc [command]" and "node [command]" without using the full path.
Is there anyone who can give me steps to download them, and make them usable without full path, cause I'm trying for months now and noone has helped me.
I've tried the normal way of "pkg install X" and drag&drop the library folder directly to the VM I use for the pfsense. I cant even download side package manager cause pfsense doesn't let me.

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.

GDB on Mac OS Sierra, trying to uninstall and remove all files completely but can't

I should preface this by stating I'm working with Xcode on macOS Sierra 10.12.6.
I installed GDB with homebrew and it appeared to install fine until I tried to use it. In terminal it kept saying that it was not a valid command. (I'm new to C and was working with my professor. Even he was baffled when I tried to use it after downloading it in front of him). So later I tried to install it by creating the make file and still having problems. I then used homebrew again but to uninstall and reinstall, still having problems.
Now I'm at the point where I can't even run my C files when I use gcc to compile them. I simply get a statement that unable to open file. I've read someone suggest to sudo mv /usr/local /usr/_local and I'm notified that I don't have permission, even after entering in my password.
I've gotten every error when I try to remove all items belonging to gdb. I've gone as far as removing Xcode in hopes that I can do a fresh install of it all.
I'm at the point where I've begun looking into removing my macports entirely.
I'm looking for any advice into how I can try to start off from a clean slate. I need to use gdb on a project that is due and can't get this up and running. Please help talk me from a ledge!
EDIT:
I have used Sublime to create a simple Hello World file and it compiles and runs fine with gcc. So my project file has become corrupted somehow. At least I can calm down a bit. But I would still like to get this gdb issue figured out and install a fresh copy with everything old removed.
I'm working with Xcode on macOS Sierra 10.12.6
I need to use gdb on a project that is due and can't get this up and running
I don't know how to reinstall gdb on macOS, but be aware that gdb is broken on macOS Sierra as of now (at least debugging dynamic libraries), see Bug report.
So if you even get gdb correctly installed you can probably end up with nothing (gdb won't be able to debug what you want).
Try making your file executable using gcc -Wall -g $fileName.c -o $fileName. This will show all the errors that might exists. Secondly, if it doesn't work and you absolutely need to use gdb, using a VM of Linux(recommend Ubuntu if you're new to Linux or Mate) is a good alternative. You then have to just use sudo apt-get install gdb and even install gdb-dashboard git-hub gdb-dashboard if you want to do some serious debugging. That's the quickest fix that I can think of you are in a hurry. Btw good VMs are VirtualBox and Parallel Desktop(if you want to have access to your local files from the VM).

After software installation: symbol lookup error

I've been installing "hamlib 1.2.15.3" (sourceforge) on my RaspberryPi under Raspbian and everything
worked great for a while.
When I noticed an unimplemented feature, I downloaded the newest developer version here:
here (something like this, but this link may change every day: http://n0nb.users.sourceforge.net/hamlib-3.0~git-6e44327-20140321.tar.gz)
So I downloaded it and did the usual: untar to a folder, ./configure, make, make install.
After all was done, I launched rotctl and there comes this message: rotctl: symbol lookup error: /usr/local/lib/libhamlib.so.2: undefined symbol: g313_caps
I thought the package wasn't flawless and I tried to install the old version again. But it's still like that. Also I tried ldconfig every now and then.
To be honest: I'm a beginner when it comes to linux, so I don't know what I have done there. Maybe I was doing a major mistake, a normal linux user wouldn't do. Maybe it was wrong to install that package without uninstalling the older version. Also I don't even know how to do that.
Basically there is only one file in the source code, I need to change to the newer version. So, if there is anyone who could tell me, how to make a clean uninstall, I could replace only this file in the source and install again. I think that would do the thing.
Or shall I rather ask the people from the hamlib developer team?
Thank you in advance.

Why do I get "Header file missing" (make error)?

I'm trying to install a geocoder for a website I'm building. I'm using Geocoder because the query limit for the Google Maps API falls short of my needs. I installed all the gems required and have SQLite3. When I'm actually trying to install the geocoder gem (Geocoder::US) I get an error while running the make file.
I'm getting an error I cannot figure out. It mentions the error (in the title) then talks of an non-existent file (sqlite3ext.h). Here is the error:
I know this is vague but I've been working for 10+ hours trying to install this and have found little help online. Any advice on which direction to go would be appreciated.
This is from the project's Readme:
To build Geocoder::US, you will need gcc/g++, make, bash or equivalent,
the standard *NIX ‘unzip’ utility, and the SQLite 3 executable and
development files installed on your system.
It seems that you lack the SQLite3 development headers.
This is relevant:
NOTE: If you do not have /usr/include/sqlite3ext.h installed, then
your sqlite3 binaries are probably not configured to support dynamic
extension loading. If not, you must compile and install SQLite from
source, or rebuild your system packages. This is not believed to be a
problem on Debian/Ubuntu, but is known to be a problem with Red
Hat/CentOS.
Also they do not mention Windows. You should:
Ask them if someone uses it on Windows and if there are instructions for that.
Evaluate the thing on Linux, Debian/Ubuntu especially.
-fPiC is not your problem. As the log states, the compiled code is already position independent. The problem is, that the sqllite3ext.h is not in the compiler include path.

Resources