LLVM With Haskell, Strange Linker Error - macos

I just installed LLVM (3.0) successfully, and got the Hackage bindings (3.0.0.0). However when I try to use it, I get the following linker error:
Loading package llvm-base-3.0.0.0 ... can't load .so/.DLL for: (dlopen(lib.dylib, 9): image not found)
There is no name after "for: ", which makes this frustrating, because I don't know what it can't find. I know there isn't much information to go on, but does anyone have any idea why this could be happening?
I am running Mac OS X, in case it matters.

It's a bug in the llvm bindings installer. I had it patched locally and just sent a pull request to bos, hopefully it will get merged soon.
To fix your problem without the patch, find the llvm-base package config file. Mine is located here:
~/.ghc/x86_64-darwin-7.4.1/package.conf.d/llvm-base-3.0.0.0-*.conf
Locate this line and delete it:
extra-ghci-libraries: ""
Then run: ghc-pkg recache --user

Related

runtime error ‘symbol not found in flat namespace’ on macOS 12 but not macOS 10.15, with both Xcode and CMake builds

I have problems building an executable file for a simple disease-transmission model implemented in C++, using cmake under macOS Monterey (v12.6.1). When I build the executable file, I obtain the following error when I try running it:
dyld[5281]: symbol not found in flat namespace (_cblas_caxpy) Abort trap: 6
The problem persists when I try to use XCode (v14.0.1) instead, resulting in the same error message.
Interestingly, my friend is able to build (& run) the executable file under macOS v10.15.7 without any problems.
Does anybody know what is going on here and how this issue can be resolved? The C++ project is publicly available on GitHub: https://github.com/AnnaMariaL/DengueSim
Any help would be very much appreciated.
Thanks!
Anna
tried: build an executable file with cmake, and Xcode under MacOS v12.16.1
expected: executable file
the program runs fine when launched under Xcode itself, but if I try to run the built executable from Xcode on the command line, that fails with the same error as for the CMake executable. So Xcode itself is, somehow, magically able to get this linker issue to resolve.
Your title/post is very confusing, however the issue isn't with cmake. It's with your cblas library and/or your linker. Look at the bug closely:
dyld[5281]: symbol not found in flat namespace (_cblas_caxpy) Abort trap: 6
Your linker is telling you that it can't find a function (symbol) in the given namespace. This is either due to the fact that your linker doesn't know where to find the correct library or you are linking against a wrong version of the library that doesn't have the symbols. The other issues might be related to how the library was built and with what it was built (architecture, compiler, etc...). This we can't answer because we don't have enough information to know for sure.

Error exporting Xcode archive since version 13.2.1

We have been getting an error in exporting an archive since the release of Xcode 13.2.1, and are also seeing it in 13.3. (13.1 works great)
The error is:
Reached end of file while looking for: Mach-O slice.
I get this when exporting on our jenkins/fastlane server as well on my development machine.
Curious if anyone has found a solution for this?
It can be an internal issue with malformed library files, try to reload it.
You can try: export_xcargs: "-allowProvisioningUpdates"

Trouble installing hmatrix through MSYS2 on Windows 10

I've been trying to install hmatrix on my (64-bit) Windows 10 computer; after searching through and trying many possible solutions (including the instructions under "Windows" and "Alternative Windows Build" given here), I decided to pursue the course of action given on this Reddit thread.
However, when I type in the command
cabal install hmatrix -fopenblas --extra-lib-dir=${c:\msys64\mingw64\bin} --extra-include-dir=${c:\msys64\mingw64\include}
into the MSYS2 shell, the following log is given:
Resolving dependencies...
Configuring hmatrix-0.17.0.2...
Failed to install hmatrix-0.17.0.2
Build log ( C:\Users\Christian\AppData\Roaming\cabal\logs\hmatrix-0.17.0.2.log ):
Configuring hmatrix-0.17.0.2...
cabal.exe: Missing dependency on a foreign library:
* Missing C library: libopenblas
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Leaving directory 'C:\msys64\tmp\cabal-tmp-4244\hmatrix-0.17.0.2'
cabal.exe: Error: some packages failed to install:
hmatrix-0.17.0.2 failed during the configure step. The exception was:
ExitFailure 1
However, when I check the directory c:\msys64\mingw64\bin, I see that libopenblas.dll is right there; I don't know why cabal can't seem to find it.
Any insight into why this is not working or what to do?
UPDATE:
The files libopenblas.dll.a and libopenblas.a are in the directory c:\msys64\mingw64\lib. Is it possible I need to somehow include this directory as well? (If I do, how would I do that?)
I also downloaded the files in Alex Vorobiev's comment below and put them in c:\msys64\mingw64\bin if they are .dlls or c:\msys64\mingw64\lib if they are .libs. The header files were already contained in c:\msys64\include\openblas.
I tried several variations on the command in the original post after making these changes, including switching \bin with \lib and switching \include with \include\openblas, but all of them still give the same error.
I'm a bit suspicious about the
if os(windows)
if flag(openblas)
extra-libraries: libopenblas
in the cabal file, could you unpack it and remove the "lib" part? If that doesn't work please post a log with -v3 output. I've seen quite a few people with troubles installing this package. So could you also open a ticket on the GHC bug tracker if this doesn't work (and CC me "Phyx-")?
Secondly, you never said which version of GHC you're using. 8.0.1 should have far less trouble (and won't need the hack to get it working in GHCi) since the runtime linker has been overhauled and should be much better on Windows. 8.0.2 will likely include the new import libraries support as well.

Unable to run Swift code using Command Line Tools

I downloaded Xcode CLT from developer.apple.com/downloads and then installed the package.
Wanting to try my hands at Swift, I attempted to write a simple "hello, world" program, but, things seemed to be "wrong" from the first moment I started it. Look at the following screen output:
$ xcrun swift
Welcome to Swift! Type :help for assistance.
dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/repl_swift
Reason: image not found
1> s="hello, world"
Error in auto-import:
failed to get module 'Swift' from AST context
1> ^D
I am especially concerned with the "dyld" line which is about line # 3 in that output.
I searched around on the web and found that this is caused by some certificate mismatch issues. But, I have neither requested any certificates from Apple, nor issued any certificates to anyone. I just want to try out Swift without downloading the entire XCode.
So, the questions are:
why am I getting the "dyld: Library not loaded:..." error?
how can i fix it?
how can I write, compile and run simple Swift code on the command line before downloading the entire XCode?
Your help is greatly appreciated. Anxiously waiting for your reply.
Edit:
Here's how I installed the tools: I downloaded the tools from the developer.apple.com/downloads web site. I got a dmg file, which I clicked. It contained a package file. When I clicked that, it brought up a nice popup that said something to the effect "installing". I went through all the dialogs it threw at me, selecting all the default values. After a few moments, it said "installed".
I then opened emacs, wrote 10 lines of c, compiled and ran it. worked! So, I got on the web, located the most elementary swift program I could find, copied it and attempted to run it ... and boom ... I got that error. So I started the swift interpreter and typed code into it. Nope! That didn't work either!
So, given all that ... I feel I did my best to install the tools, but, please let me know if I have missed any step that could have caused the CLT to install partially and not completely.
failed to get module 'Swift' from AST context
Use the xcode-select command-line tool:
sudo xcode-select --switch /Applications/Xcode.app
or if you are using Xcode-beta then use this:
sudo xcode-select --switch /Applications/Xcode-beta.app
From the xcode-select manual:
After setting a developer directory, all of the xcode-select provided developer tool shims ... will automatically invoke
the version of the tool inside the selected developer directory.
For more info:
man xcode-select
cd /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources
and then
sudo install_name_tool -rpath #executable_path/../../../../../Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx /Library/Developer/CommandLineTools/usr/lib/swift/macosx repl_swift
Will get rid of the first part of the error. I can't figure out the 2nd part yet. (Error in auto-import). Anyone have any ideas based on the first part of the solution?

Haskell plugins package on Windows addDLL error

I have windows Vista 64 bit. I installed the latest Haskell Platform today (which ghc --version says 7.0.4). I installed the latest cygwin.
I ran cabal install plugins, it had minor issues (I didn't specify prefix path as I should have and there was a missing import in Env.hs), so I cabal expand'ed fixed... it installed.
I run a simple example (specifically this one and I get this error:
Main.exe: user error (loadShared: couldn't load `m' because addDLL: could not load DLL)
Any ideas on how to resolve it?
Oh, and the example works fine on Linux (Ubuntu) GHC 7.0.3, so it's either a Windows for 7.0.4 specific issue.
When it's trying to load libraries, when it looks up the dlls for the integer-gmp package for it receives ["m", "wsock32"]. So the error is caused by it trying to load a dll "m", which apparently doesn't exist. I'm guessing this is a bug somewhere.
After bypassing that, I was able to get further. As Stephen Tetley mentioned, there is another bug about getting an HscEnv. Following that rabit trail, I was able to bypass that. Now, I'm at this error:
Main.exe: Plug.dll.a: Not x86 PEi386
Main.exe: user error (Could not load module `Plug.dll.a')
But I'll mark this question as answered since the specific error I mention in the question is because of what appears to be a bug somewhere in ghc or something.

Resources