Compiling GNU Guile 1.8.8 with msys2: Undefined reference to '_imp__scm_shell' and '_imp__scm_boot_guile' - undefined-reference

I apologize if this is a duplicate, but I was unable to find a question similar to mine on this site.
I am trying to compile GNU Guile 1.8.8 with msys2 on Windows, but am running into undefined reference errors to '_imp__scm_shell' and '_imp__scm_boot_guile'. Here are the steps I have taken so far:
Install and update msys2-20170918
Install base-devel, mingw-w64-i686-toolchain, mingw-w64-x86_64-toolchain, mingw-w64-i686-libtool, and mingw-w64-x86_64-libtool with pacman
Download GNU Guile 1.8.8
Open msys2\mingw32.exe and cd to the source code's directory
Run ./configure --disable-error-on-warning
Run make
After a few minutes, it exits with the following errors:
guile-guile.o: In function 'inner_main':
C:\Users\<username>\Downloads\guile-1.8.8\libguile/guile.c:53: undefined reference to '_imp__scm_shell'
guile-guile.o: In function 'main':
C:\Users\<username>\Downloads\guile-1.8.8\libguile/guile.c:63: undefined refencere to '_imp__scm_boot_guile'
Here is the log file, in case it is useful: https://drive.google.com/open?id=1dUj8ThwZKYL1Haehq3LFu6QAzkbDqqYv
Information on what I'm doing wrong would be much appreciated.

It is perfectly possible to build guile 1.8 in this environment, with a few patches, and only for 32 bits. There is even a binary package available.

Related

What is the meaning of 'ld: library not found for -lm'

I'm a beginner at Fortran code. I install gfortran from the homebrew to my apple silicon mac. The path show in the terminal when I type which fortran is /opt/homebrew/bin/gfortran
I try to use bash shell to run a 'hello world' fortran file on the Desktop (.f90 file). I typed the following command in the terminal. gfortran prog01_01.f90. But it does not work. The error says: ld: library not found for -lm and collect2: error: ld returned 1 exit status. I have no idea how to deal with this problem.
Can anyone please help me this out?
This means that the compiler cannot find the basic mathematical library libm. It should normally be included in your GLIBC or other standard C library installation and be available in the appropriate library directories and I would expect that your package manager would complain that something is missing.
Anyway, you simply have to fix your software installation, we cannot tell you more without details about your system and your software packages. You can try to install GLIBC if you did not install it yet.

dyld: Library not loaded: #rpath/libgfortran.3.dylib

I am trying to learn Fortran programming language, as a test I wrote a simple program like this:
!Fortran Program
program first
print *, "Hello World"
end program first
Then I threw this code file in to mac terminal and run gfortran first.f95 which then gave me an output of a.out as expected.
However, when I try to run the output in terminal by navigating into the output directory and typing ./a.out. It gave me this error output:
dyld: Library not loaded: #rpath/libgfortran.3.dylib
Referenced from: /Users/liang/Desktop/Programs/Fortran/Test/a.out
Reason: image not found
liang is my username.
I had the same problem, and my problem was caused because the library was not in default path and instead "anaconda" got in the path so that's why the compiler could not load it. I am a pure amateur user so I may explain not accurate in terms of technical words.
What I did was, I uninstalled my anaconda and deleted the folder in my Mac. Installed gcc "brew install gcc" again, and it worked! and then after, I installed my anaconda again, so now everything seemingly is ok.
My situation
I am also just learning, and I had a similar error message after compiling MUMPS library (http://mumps-solver.org).
I compiled the sequential version of MUMPS manually after brew installing the dependencies. When I ran the test examples, I got the same error message that libgfortran.3.dylib could not be loaded.
My brew gnu compiler is gcc version 9 and it is invoked by gcc-9, g++-9 and gfortran-9 (for C, C++ and Fortran respectively). Meanwhile gcc, g++ and gfortran invoke the compilers installed by anaconda.
How I solve it
I recompiled MUMPS using gcc-9 and gfortran-9 instead of gcc-9 and gfortran, and now everything works.

ld: library not found for -lgsl

I'm working in OSX and I'm attempting to run a make file and when I try I get the following:
ld: library not found for -lgsl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [harm] Error 1
Earlier I found out the I needed to get the gsl library and I used mac ports and typed:
sudo port install gsl
into my command line window and it seemed to isntall okay. Is the missing lgsl not configured correctly or does it not come with gsl? I tried googling lgsl but didn't get much. I've only been at programming a few days and I don't know if I was supposed to set a path, or even really how to do that.
Thanks for any help you guys could offer.
I just wanted to say that I had the exact problem on OSX. Rather than setting an environment variable, I used an additional compiler flag -L/opt/local/lib, which then lets one use -lgsl. I reference this answer.
I got the same issue and here is how I fixed it:
export LIBRARY_PATH=/usr/local/Cellar/gsl/1.16/lib/
I had previously installed gsl using:
brew install gsl
You need to add the path for where the macports installed the gsl library to your LD_LIBRARY_PATH environment variable (or most likely into the build script environment). I believe macports stores things in /opt/local/lib

Building InstallJammer's installkit on Windows

I'm using InstallJammer to build cross-platform installers for my application (Windows, Linux & Mac). However, InstallJammer development has been discontinued and the official forum is now closed.
I need to build the installkit for Windows, because I'll have to make some changes to the Windows install manifest, in order to add Windows 7 support (otherwise the installer displays the message "This program might not have installed correctly").
I grabbed the latest installkit sources from here: http://sourceforge.net/projects/installjammer/files/installkit/1.2.15/installkit-1.2.15.tar.gz/download
I found this topic http://www.installjammer.com/forums/viewtopic.php?f=3&p=9258 which helped me get started.
I grabbed latest version of MinGW and typed ./configure && make. It started the build process, but there was this error while trying to compile TCL:
c:/installkit-1.2.15/src/tcl/win/tclWinReg.c:750:29: error: lvalue required as increment operand
Since these sources are kind of old, I figured I should try with an older GCC version (I was using 4.7.2). So I downgraded MinGW's GCC to version 3.4.5 and tried again.
This time, TCL built fine. Everything was going well, until it failed to build something called 'miniarc' (I don't know what it is), with the following error message:
miniarc.o:miniarc.c:(.text+0x370c): undefined reference to `_imp__strtoull'
miniarc.o:miniarc.c:(.text+0x37c9): undefined reference to `_imp__strtoull'
miniarc.o:miniarc.c:(.text+0x3cb6): undefined reference to `_imp__strtoull'
miniarc.o:miniarc.c:(.text+0x3e78): undefined reference to `_imp__strtoull'
miniarc.o:miniarc.c:(.text+0x3e9f): undefined reference to `_imp__strtoull'
miniarc.o:miniarc.c:(.text+0x3ff5): more undefined references to `_imp__strtoull' follow
collect2: ld returned 1 exit status
Strange thing is that there's no reference to imp_strtoull inside miniarc.c.
Moving on, I tried to build it in Ubuntu, since I didn't know what else to do, and it worked! GCC version was 4.4.3. So I went and searched for GCC 4.4.3 for MinGW, but the closest version was 4.4.0. I grabbed these and tried again. Same tcl build error (regarding tclWinReg.c).
Then I went back to GCC 4.7.2 and replaced TCL & TK sources (8.4) with the latest ones (8.5) and tried again.
TCL and TK both built fine, and so did some other libs, but when it came to 'miniarc', it failed again. This time with a different error:
undefined reference to `TclIncrVar2'
Apparently, this function no longer exists in TCL 8.5.
So, I'm out of ideas. I even tried emailing the original (and only) InstallJammer developer, but still got no answer (I don't even know if his email is the same).
Does anyone have any suggestions?
EDIT: I should add that I have very little experience with Makefiles and the last time I coded in C was 8 years ago in college. So, I apologize if there is something obvious about all this that I didn't notice.
I don't like the solution, but here's how I got it working:
Using GCC 3.4.5, I started the make process by typing ./configure && make;
The make process stops with an error (mentioned above) when it reaches 'miniarc';
Then, manually, I built a DLL (strtoull.dll) from file strtoull.o (below is the exact command-line I typed);
gcc -pipe -shared -o strtoull.dll strtoull.o -lz -L/c/installkit-1.2.15/Windows/lib /c/installkit-1.2.15/Windows/lib/libtclstub84s.a"
After that, I copied strtoull.dll to miniarc/build and to windows/system32;
Then I entered folder miniarc/build and typed:
gcc -pipe -shared -o miniarc01.dll miniarc.o sha1.o md5.o -lz -L/c/installkit-1.2.15/Windows/lib "/c/installkit-1.2.15/Windows/lib/libtclstub84s.a" strtoull.dll
Finally, I typed make again so it could continue building the rest of the stuff.

how to install haskell openid package in windows

haskell 'openid' package depends on HsOpenSSL and nano-hmac packages which requires openssl. I've compiled openssl for MinGW in C:\OpenSSL\ directory and installed openid package with following command:
cabal install openid --extra-include-dirs=C:\OpenSSL\outinc --extra-lib-dirs=C:\OpenSSL\out
When I'm trying to compile haskell program using this package I'm receiving lots linking errors.
test.hs:
import Network.OpenID
main = print "ok"
ghc --make test.hs:
Linking test.exe ...
C:\OpenSSL\out/libcrypto.a(m_sha1.o):m_sha1.c:(.text+0x60): multiple definition of `EVP_sha1'
C:\OpenSSL\out/libeay32.a(deegs01228.o):(.text+0x0): first defined here
C:\OpenSSL\out/libcrypto.a(m_sha1.o):m_sha1.c:(.text+0x100): multiple definition of `EVP_sha256'
C:\OpenSSL\out/libeay32.a(deegs01230.o):(.text+0x0): first defined here
.....
C:\OpenSSL\out/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x2d4): undefined reference to `X509_VERIFY_PARAM_set_purpose'
C:\OpenSSL\out/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x2f1): undefined reference to `X509_VERIFY_PARAM_set_purpose'
C:\OpenSSL\out/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x314): undefined reference to `X509_VERIFY_PARAM_set_trust'
.....
collect2: ld returned 1 exit status
What I'm doing wrong?
I suspect there may be a version mismatch somewhere. Try using the precompiled binaries for OpenSSL here: http://www.openssl.org/related/binaries.html
I was able to get the instructions here to work with the latest version of HsOpenSSL: http://hackage.haskell.org/trac/ghc/wiki/Builder (in fact I worked with the maintainer to make these instructions work without needing to patch the package.)

Resources