Installing pymc on Mac OS 10.14.5 - python-3.x

I'm attempting to install pymc on MacOS 10.14.5 Mojave. However, there seems to be a problem with the gfortran module. The error message is minimally helpful.
I have attempted all the possible ways to install pymc as suggested here: https://pymc-devs.github.io/pymc/INSTALL.html
I first came across a problem with not recognising f951 in my gfortran compiler, but I solved that by adding the path to f951 explicitly to my PATH.
Now I come across the following after a bunch of warning messages in pymc.flib.f:
ld: unknown option: -idsym
error: Command "/usr/local/bin/gfortran -Wall -g -m64 -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-10.7-x86_64-3.7/cephes/i0.o build/temp.macosx-10.7-x86_64-3.7/cephes/c2f.o build/temp.macosx-10.7-x86_64-3.7/cephes/chbevl.o build/temp.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/pymc/flibmodule.o build/temp.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/pymc/fortranobject.o build/temp.macosx-10.7-x86_64-3.7/pymc/flib.o build/temp.macosx-10.7-x86_64-3.7/pymc/histogram.o build/temp.macosx-10.7-x86_64-3.7/pymc/flib_blas.o build/temp.macosx-10.7-x86_64-3.7/pymc/blas_wrap.o build/temp.macosx-10.7-x86_64-3.7/pymc/math.o build/temp.macosx-10.7-x86_64-3.7/pymc/gibbsit.o build/temp.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/pymc/flib-f2pywrappers.o -L/Users/cameron/anaconda3/lib -L/usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0 -L/usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0/../../.. -L/usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0/../../.. -lmkl_rt -lpthread -lgfortran -o build/lib.macosx-10.7-x86_64-3.7/pymc/flib.cpython-37m-darwin.so" failed with exit status 1
No online searches reveal what might cause the exit status 1 with gfortran.

Many thanks to #mishsx for suggesting re-installing gfortran. This is something I had done previously but this time I used homebrew, as explained here: stackoverflow.com/a/48184252/7841468
I went into my /usr/local/ and /usr/local/bin/ and deleted the gfortran folders since I had not previously installed gfortran with homebrew. One small problem was that the path was not included the first time I used homebrew, so I removed it with brew rm gcc, then reinstalled with brew install gcc.
The pymc installation then went ahead without error.

As mentioned, this can usually be fixed by purging your gfortran install and switching to brew fully.
However, the underlying issue is actually being caused by not having a valid collect2 (part of GCC) available to your gfortran. This causes the spec to pass flags to ld (only collect2 understands -idsym/-dsym).
I'm mostly noting this as a classic broken gfortran example.

Related

Configure which gcc is called by shell script

I've been struggling with this issue for several weeks now, working it off and on. I've got Ubuntu running on Windows. I also installed OpenFOAM to analyze CFD simulations. My issue is the default the gcc called at the command prompt is the OpenFOAM one.
$ gcc --version
gcc (OpenFOAM) 6.3.0
I needed updated libraries installed for something else I'm working on. I managed to get all the libraries installed, but linux is still looking to the OpenFOAM version of gcc (which doesn't see the libraries) when I run the program at the command prompt. I am calling a shell scrip that in turns calls other programs, so I cannot determine a way to directly call out the full path to the desired gcc version.
I've worked out that the bash gcc command is actually linked to three versions of gcc:
$ type -a gcc
gcc is /opt/OpenFOAM/OpenFOAM-v2012/ThirdParty/platforms/linux64/gcc-6.3.0/bin/gcc
gcc is /usr/bin/gcc
gcc is /bin/gcc
This leads me to believe that the shell scrip is going to the first one and ignoring the next two. How do I get it to go to the second?
i.e. so terminal would return
gcc is /usr/bin/gcc
gcc is /bin/gcc
gcc is /opt/OpenFOAM/OpenFOAM-v2012/ThirdParty/platforms/linux64/gcc-6.3.0/bin/gcc
This should yield the correct version of gcc being called and the installed libraries I need to be referenced at runtime.
$ which gcc
/opt/OpenFOAM/OpenFOAM-v2012/ThirdParty/platforms/linux64/gcc-6.3.0/bin/gcc
I was expecting this to return /usr/bin/gcc instead.
I tried appending the /bin/gcc/ to the front of the path variable:
$ export PATH = /usr/bin/:$PATH
without success. (edited for syntax)
I also researched installing multiple versions of gcc on Ubuntu and worked out there is a command that should permit me to do what I'm trying to, but it doesn't work:
$ sudo update-alternatives --config gcc
update-alternatives: error: no alternatives for gcc
I was expecting to be able to select which version of gcc was called.
Thanks for rici's input:
$ export PATH=/usr/bin:$PATH
prepended '/usr/bin' to the path variable before all the OpenFOAM stuff.
$ type -a $PATH
returned
gcc is /usr/bin/gcc
gcc is /opt/OpenFOAM/OpenFOAM-v2012/ThirdParty/platforms/linux64/gcc-6.3.0/bin/gcc
gcc is /usr/bin/gcc
gcc is /bin/gcc
This should have resolved my issue except for some reason it's still looking for another library in the OpenFOAM directories. As for the original question, the matter is resolved.

Aseprite ninja build error "cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND"

While trying to build Aseprite on Debian 10 (amd64) virtualbox VM, after building Skia, the ninja aseprite command returns the error:
/usr/bin/ld: cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND
[1/1] Linking CXX executable bin/aseprite
FAILED: bin/aseprite
: && /usr/bin/c++ -Wall -Wno-switch -O2 -g -DNDEBUG src/CMakeFiles/aseprite.dir/main/main.cpp.o -o bin/aseprite lib/libapp-lib.a lib/libclip.a -lxcb -lpthread lib/libdio-lib.a lib/libfilters-lib.a lib/libflic-lib.a lib/libtga-lib.a lib/librender-lib.a lib/libdoc-lib.a lib/libfixmath-lib.a lib/libui-lib.a lib/liblaf-os.a lib/liblaf-gfx.a lib/liblaf-ft.a /root/deps/skia/out/Release-x64/libskia.a -lSKIA_OPENGL_LIBRARY-NOTFOUND /usr/lib/x86_64-linux-gnu/libfontconfig.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libXcursor.so /root/deps/skia/out/Release-x64/libskshaper.a lib/libobs.a lib/libundo.a lib/libcmark.a lib/libjpeg.a lib/libgiflib.a lib/libwebpdemux.a lib/libwebpmux.a lib/libwebp.a -lpthread -lm lib/libfreetype.a lib/libharfbuzz.a lib/libfreetype.a lib/libharfbuzz.a lib/libpng16.a -lm lib/libjson11.a lib/libarchive.a /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/x86_64-linux-gnu/libssl.so lib/libfmt.a lib/libtinyexpr.a lib/liblauxlib.a lib/liblua.a lib/liblualib.a lib/libupdater-lib.a lib/libcfg-lib.a lib/libver-lib.a lib/libtinyxml.a lib/libnet-lib.a lib/liblaf-base.a lib/libmodpbase64.a /usr/lib/x86_64-linux-gnu/libdl.so lib/libcurl.a lib/libz.a -ldl && :
/usr/bin/ld: cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
How may I solve this?
It appears that CMake is looking for OpenGL and failing... Aseprite doesn't seem to use OpenGL anyway, so disabling that altogether by clearing the cache variable SKIA_OPENGL_LIBRARY should work:
cd aseprite/build
cmake -DSKIA_OPENGL_LIBRARY="" ..
ninja aseprite
I have tested it on Windows, but I'm not entirely sure if it will work on Linux...
For anyone still looking for an answer to this. I got it to build on Ubuntu 20.04.
Follow the instructions to build skia over at the skia git repository. Make a note of which folder you cloned the repository into, you will need it later. I tried using the pre-built binaries but I must have been doing something wrong and could just never get it work.
When the build is complete you will see a note about 32-byte alignment, and if you check the out\Release-x64 folder you will see a libskia.a file. Now you know that skia was built succesfully.
Install the aseprite linux build dependencies with sudo apt-get install -y g++ cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev. You will find these instructions at the aseprite git repository.
Follow the instruction further down that page for the linux install but pay attention to the parameters you need to change regarding the location of that libskia.a file mentioned in point 2.
Before you start building (and why you're here) you need to enter #Ben_'s command given above to unlink the dependency to OPENGL (cmake -DSKIA_OPENGL_LIBRARY="" ..)
Now proceed to build aseprite with as the rest of the build instructions given on its repo page with ninja aseprite
Now go to aseprite/build/bin and find the aseprite executable.
You can copy this bin folder to another folder, and run aseprite from there. You can then delete all of the sources you downloaded.
There will be a bunch of errors during the python step, and you'll notice it complains about not being able to find some repositories, I think common.git is one of them. You may safely ignore this warning.
If you want to keep supporting development of the application I do recommend you spend whatever it costs for a license (but it's totally legal to build your own copy like this).

Header files are not found by GCC

Working with embedded C-projects. There are libraries, include files and so on - for micro controllers. No need for me to use GCC for a host machine and OS (Linux Mint 64 bit). As a rule...
But now I'm trying to compile mspdebug project from a Github - with a GCC of course. And I get an error at the very begin of make:
mspdebug$ make
cc -DUSE_READLINE -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Itransport -Idrivers -Iutil -Iui -DLIB_DIR=\"/usr/local/lib/\" -o util/btree.o -c util/btree.c
util/btree.c:19:20: fatal error: assert.h: No such file or directory
#include <assert.h>
^
compilation terminated.
I search for the includes in all possible paths (I've got the list of them via gcc -v command) - there are no assert.h file, as well, as stdio.h and so on. Except virtual box directories there is only one place (where GCC does not search includes): /usr/lib/syslinux/com32/include
AFAIK, all standard libs and includes are installed with the GCC. So I try to reinstall GCC (4.8.4) - nothing changes.
What is the normal way to give GCC all standard environment it needs?
Thanks to the right direction set by Sam Varshavchik I found the info in the stackoverflow. So I did the following:
1) installed build-essential:
sudo apt-get install build-essential
2) installed libusb (since my try to build the package revealed the absence of usb.h):
sudo apt-get install libusb-dev
And it is OK! The mspdebug (v.023) is compiled and successfully tested!
So, Linux Mint 17.2 (at least) requires installing some libs to a GCC, the most basic is build-essential.
assert.h is not part of gcc, it's a part of glibc.
Most likely, your Linux distribution puts the system headers into a separate package that you need to install.
Fedora, for examples, puts the header files in the glibc-headers package. However, you can't be using Fedora, because Fedora's gcc package has a dependency on glibc-headers, to make sure that it gets pulled in.
Whatever Linux distribution you're using, you need to research which distribution package will install the system header files you need to build stuff with.

GNU ARM - nano.specs not found

Last days I've been trying to compile a STM32F4xx project with Ubuntu 14.04LTS, Eclipse and GNU ARM plugin for Eclipse. Now it says that nano.specs is missing.
Here is my build log:
14:39:35 **** Incremental Build of configuration Release for project F4Test ****
make all
Building target: F4Test.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -Wextra -g -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"F4Test.map" --specs=nano.specs -o "F4Test.elf" ./system/src/stm32f4-hal/stm32f4xx_hal.o ./system/src/stm32f4-hal/stm32f4xx_hal_cortex.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash_ramfunc.o ./system/src/stm32f4-hal/stm32f4xx_hal_gpio.o ./system/src/stm32f4-hal/stm32f4xx_hal_iwdg.o ./system/src/stm32f4-hal/stm32f4xx_hal_pcd_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_pwr.o ./system/src/stm32f4-hal/stm32f4xx_hal_pwr_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_rcc.o ./system/src/stm32f4-hal/stm32f4xx_hal_rcc_ex.o ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/_write.o ./system/src/newlib/assert.o ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o ./system/src/cmsis/system_stm32f4xx.o ./system/src/cmsis/vectors_stm32f4xx.o ./src/BlinkLed.o ./src/Timer.o ./src/_initialize_hardware.o ./src/main.o
arm-none-eabi-g++: error: nano.specs: No such file or directory
make: *** [F4Test.elf] Error 1
14:39:35 Build Finished (took 65ms)
I found some nano.specs files on my computer. What should I do? Just remove linker flag (I can't actually do that, because I can't figure out how to do that in Eclipse) or something else?
Thanks for your help!
I solved the problem. I was just using arm-none-eabi-xxx packages provided by Ubuntu, not original ones - that was the problem. All you need to do is simply download packages from toolchain's website and install them. They work just fine!
Optional step
If you have installed the bundled toolchain from Ubuntu's repositories - get rid of them:
$ sudo apt-get remove gcc-arm-none-eabi
Recommended way to install
This is described on the plugin's page:
http://gnuarmeclipse.github.io/toolchain/install/
-> with an exact description what packages are needed for your specific edition (14.04 LTS, x64 in this case).
First, install 32-bit dependency libraries:
$ sudo apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0
(15.04 - and later? - need just lib32ncurses5, while older Ubuntus - 12.04 e.a. - have ia32-libs).
Then download a pre-compiled toolchain package from here:
https://launchpad.net/gcc-arm-embedded/+download
(they recommend gcc 4.9 at the time of writing, but it should be OK to take the newest, gcc 5.3 version).
Recommended install location
Finally untar the package into /usr/local - this way the Eclipse plugin should find it, without configuring toolchains in Eclipse preferences or modifying $PATH variable.
$ cd /usr/local
$ sudo tar xf ~/Downloads/gcc-arm-none-eabi-*-linux.tar.bz2
If you are compiling for ARM Cortex-M or Cortex-R, try installing the package gcc-arm-embedded with apt-get instead of gcc-arm-none-eabi. This worked for me, and the suggestion came from the documentation for Arm's "Yotta" build tool: http://yottadocs.mbed.com/#linux-cross-compile.

Qt Creator compile error "cannot find -lGL". Other solutions are not working

I have installed QT5 that also comes with QT creator on an amd machine running ubuntu 12.04. My grapics driver is a radeon r9270x if that matters.
When I try to compile a basic "hello world" type Qt program I get the error message "cannot find -lGL". I have searched around and here( Qt: can't find -lGL error ) it says to use "sudo apt-get install libgl1-mesa-dev" but when I do I already have that installed. Here ( Installing Qt on linux, cannot find -lGL ) it says to install "sudo apt-get install libgl-dev" but that only gets me
"Reading package lists... Done Building dependency tree Reading
state information... Done Package libgl-dev is a virtual package
provided by: libgl1-mesa-swx11-dev 8.0.4-0ubuntu0.7
libgl1-mesa-dev-lts-trusty 10.1.3-0ubuntu0.1~precise1
libgl1-mesa-dev-lts-saucy 9.2.1-1ubuntu3~precise1
libgl1-mesa-dev-lts-raring 9.1.7-1ubuntu2~precise1
libgl1-mesa-dev-lts-quantal 9.0.3-0ubuntu0.4~precise1
libgl1-mesa-dev 8.0.4-0ubuntu0.7 You should explicitly select one to
install.
E: Package 'libgl-dev' has no installation candidate"
Various other resources that I have used say to do similar things but I get this error still. Any ideas?
As a side not, not knowing the relevance, I could not get QT creator to launch for the longest time. It would always seg fault and core dump. I finally updated my amd catylist control center/video drivers and that fixed the problem.
Here is the compile output from qt creator:
02:34:21: Running steps for project myHelloWorld... 02:34:21:
Configuration unchanged, skipping qmake step. 02:34:21: Starting:
"/usr/bin/make" g++
-Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64 -Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -o myHelloWorld main.o
-L/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread /usr/bin/ld: cannot find -lGL collect2: ld returned 1 exit status make: *** [myHelloWorld]
Error 1 02:34:21: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project myHelloWorld (kit: Desktop Qt
5.3 GCC 64bit) When executing step "Make" 02:34:21: Elapsed time: 00:00.
Try running this, restart Qt creator and try a clean build.
sudo apt-get install mesa-common-dev
EDIT:
Could be that you just miss Mesa package. Take a look at XCB dependencies listed here and install what’s missing.
I’ve seen this error also mentioned in a different case, but I don’t remember the solution there. I think I had solved the problem by installing the “libglu1-mesa-dev” package.
sudo apt-get install libglu1-mesa-dev -y
But I am not entirely sure if just this had fixed the issue or I had to install anything else.
So what I found worked for me, I manual added the path to the library and compiled. Then I was able to remove the manually added path. I assume somewhere on the backend it was not searching the correct place and once it was shown it remembered and kept the correct location.

Resources