Question about Macports - macports

I just got Macports installed on my mac, of which os version is Snow Leopard (10.6). I used Macports to install several packages through 'sudo port install' command, and all these packages are reported active after the installation. I just wonder that whether these packages are really working? For example, macports tells me that 'gcc44 #4.4.2_0 (active)', however in python it says '[GCC 4.0.1 (Apple Inc. build 5493)] on darwin'.
So I just want to know that if there is some problem with my method of installing or my macports needs some configuration after installation?
Any help is appreciated! I am really new in Mac OS.

I believe Python is declaring the version of gcc used to build it which should be the gcc installed on your Mac i.e. the version that came with the Mac OS Development tools. This should be located in /usr/bin/gcc.
You should find the gcc version matches when you execute
/usr/bin/gcc -v
I do not think anything is wrong with your setup or configuration. It just shows Python was compiled using the gcc provided by Apple

Macports installs software not to conflict with the versions provided by Apple. If they replaced the C compiler and libraries, really bad things might happen when Apple provided operating system updates.
gcc is the command for Apple's version of gcc, at /usr/bin and version 4.0.1 for Leopard.
gcc-mp-4.4 is the command for gcc version 4.4 as provided by MacPorts, located at /opt/local/bin.
Similarly there will be versions of python in /opt/local/bin.
Like houmam, I prefer to explicitly invoke versions by name. If you want to connect particular versions to python, I think that the MacPorts package python_select (this has now been replace by port select python) implements this by using symbolic links. I've never used it.

It probably is just that compiler that was picked by the build was that installed by XCode. You can try typing which gcc to see which one is in your path. The macports one would by default be in /opt/local somewhere.

Related

How do I install libuuid with Homebrew on MacOS 11.1?

I'm aware there is a macports libuuid package, however AFAIK it's not safe to use homebrew and macports on the same machine.
This answer seems outdated. I say that because when I use brew install ossp-uuid make doesn't like it, despite seeming to find uuid.h.
What is the current and up to date homebrew package to install libuuid on mac?
Alternatively, could one build libuuid from source and if yes, how?
I was made aware that libuuid is already part of macOS.
It was therefore enough to just add an OS specific include.
#if __APPLE__
#include <uuid/uuid.h>
#else
#include <uuid.h>
#endif
I was porting an app from Linux to MacOS Monterey (could apply to 11.1 (Big Sur) as well).
The link was failing on libuuid, even though it compiled ok as on Linux.
I finally got my build to link, having 'homebrew install'ed ossp-uuid with homebrew version 3.6.4, under Monterey (12.5.1).
I first heard of ossp-uuid in this thread (thanks blkpingu).
I had tried several things before. It compiled ok, but did not link. brew install ossp-uuid fixed that (homebrew 3.6.4), and brew set up the requisite links to find the library under /usr/local/lib .
I left the source code as #include <uuid/uuid.h>, in this particular case.

Compile for windows using mingw-w64 and autotools

I've this project called librsync.
Installed ubuntu package called mingw-w64. Looked at automake manpage.
What I want to do is to build executable that runs on windows or dll, whichever I could get working.
./configure --host "what do i put here?"
By looking at ubuntu packages I can't figure it out. From automake manpage - If I had mingw32 it should be i586-mingw32msvc. But how do I figure that out on my own in the first place? At least, what should I put in hosts param if I have mingw-w64?
For building something with a cross compiler, you will use configuration-gcc as the C compiler with configuration being what you would pass to --host to build a library or executable.
ls /usr/bin/*mingw*gcc should give you the C compiler to use, allowing you to know what the configuration is.
MinGW (aka mingw32): iX86-pc-mingw32 or iX86-mingw32msvc (X is a 4, 5, or 6 depending on how it was configured)
mingw-w64: ARCH-w64-mingw32 (ARCH is one of i686 or x86_64)
I've honestly not seen anything else for mingw-w64, except in its earlier days when it used ARCH-pc-mingw64, but that shouldn't be used anymore.

simics installation libstdc++.so.6 version not found

I downloaded a tarball of simics from the web.
I tried to run the ./simics-gui
and I get this error
/home/leungtimothy/Desktop/simics/simics-4.0.60/amd64-linux/sys/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/lib/x86_64-linux-gnu/libproxy.so.1)
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so
I looked up a lot of posts, most of them are relate to linking problem. I am not able to find a libstdc++.so.6 on my 64 bits ubuntu v13.04 .
Any ideas about how to fix this?
Thank you so much
libstdc++ is the GNU Standard C++ library, which will be required by applications built with the GNU C++ compiler.
Evidently libstdc++6 is not installed on your system. It is typically installed by installing the GNU C++ compiler:
sudo apt-get install g++
If you don't need the compiler you can install libstdc++6 independently:
sudo apt-get install libstdc++6
I believe that Simics also ships with a few system libraries, that you can find in the installed base package (directory simics-<version>), at the path <host>/sys/lib/, where libstdc++.so.6 is one of them.
Looking at the path, it looks like it is Simics 4.0 which is over 8 years olds.
I suggest download and install the latest version of Simics from a proper source,
https://downloadcenter.intel.com/download/30403/Intel-Simics-Public-Release-Preview

How do I fix a "version `GLIBC_2.14' not found" error?

I've compiled a C program under Ubuntu 12.04, built a Debian package out of it, and want to install it on a server running Debian Lenny.
Last time I did that (about two months ago) it worked: I could install the package and run the binary. But now I get the following error message:
(binary's name): /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by (binary's name))
Other than upgrading my machine to Ubuntu 12.4, the only significant change we've brought to the code is a call to strdup(), for which I had to enable the _POSIX_C_SOURCE=200809L feature test macro.
Upgrading the server to the latest Debian version is not my preferred option as it is not under my direct control.
How do I fix this problem?
I think the critical bit of info here is 'upgrading my machine'. So when this worked before, you were building and packaging on something earlier than 12.04? If so, then the issue is that 12.04 now ships with a newer version of libc (apparently 2.14), and your binary now records a dependency on that version of libc. When you try to run on Lenny, which likely uses an older version of libc, the linker detects that the Lenny version does not support the 2.14 API, and fails.
I think the best way forward is probably to do your development and testing on 12.04, and then when you want to create packages for a specific Debian release, use pbuilder or similar to create debs. This will ensure that the libraries used for the packaging build match the target platform.

How to set up libusb on Mac OS X?

I'd like to try to make a user-space device driver using libusb on Mac, but I'm confused where to start. In the SDK installer (which I got from http://www.ellert.se/twain-sane) it said something about examples which I couldn't find anywhere on my computer.
Could anyone please describe how do I set up libusb for development on OS X? May I use Xcode? What should I include in my code?
brew install libusb-compat
Working on OSX Yosemite 10.10
Easiest way to do this:
brew install libusb
Homebrew is amazing and I recommend it for all developers that use Mac.
I tried to install the SDK from the aforementioned website and couldn't find a trace of it once the installer finished. Though I did find some libusb items at /usr/local/Developer/SDKs/MacOSX10.6.sdk/usr/local/ I'm not sure it came from that installer as I couldn't find any examples, just libraries and they were labeled as libusb0.1.4.
On the other hand, since you asked your question with the macports tag, I'd suggest you use that to install libusb as it at least puts everything in a known location:
/opt/local/var/macports/software for install files
/opt/local/lib for libraries
/opt/local/include for header files
If you've never used macports then once you have macports installed then you can install libusb using
sudo port install libusb
to install libusb1.0 or
sudo port install libusb-legacy
to install libusb0.1.12.
Then you can create a project in Xcode and link to the libusb-*.a library contained in /opt/local/lib (in my directory my library file is called libusb-1.0.a since I have libusb1.0 installed).
I don't have much experience using Xcode so I can't help you any further down this path. Personally what I've done so far is use a Python wrapper called pyusb to do some quick experimentation with libusb as I don't have to do IDE setup or library/include file setup with Python.
UPDATE: Poking around the macports install directory for libusb, I didn't find any examples included which was a bummer. If you've gotten this far then I'd suggest going directly to the source for libusb, download and unpack the tar file, and building the code that's in the example directory. Sorry for the roundabout way of getting libusb examples but I've really come to appreciate the organization macports imposes on installations which saves me quite a bit of future pain (like when I want to uninstall).
once libusb is installed using following command:
brew install libusb
or
brew install libusb-compat
link libusb to the build system using
brew link libusb
to be able to configure any project depending on libusb, use pkg-config:
pkg-config --cflags libusb-1.0
and
pkg-config --libs libusb-1.0
before calling any ./configure

Resources