Unable to runhaskell my wxHaskell program that works in GHCI - haskell

I am trying to create a HelloWorld.exe on Windows 7 that demonstrates a very simple wxHaskell program I have found online. The code is below:
module HelloWorldWX where
import Graphics.UI.WX
main :: IO ()
main
= start hello
hello :: IO ()
hello = do
f <- frame [text := "Hello!"]
quit <- button f [text := "Quit", on command := close f]
set f [layout := widget quit]
in a file called HelloWorldWX.hs. I downloaded the binary distribution of wxHaskell (wxInstall-Achelanne-64-0.1). After running Install.bat I noticed it used Cabal to set up a new package location where it installed wx-0.92.0.1 and all of its depedencies. The first time it ran it failed for some non-specified reason. I ran ghc-pkg list and found all of the packages were listed in the new cabal package location. I decided to unregister all of the packages and try again. This second time it was successful and prompted me to include the following directories in my search path which I did:
C:\Users...\Downloads\wxInstall-Achelanne-64-0.1\DLLs;C:\Users...\Downloads\wxInstall-Achelanne-64-0.1\wxWidgets\lib\gcc_dll
At this point when I loaded HelloWorldWX.hs into GHCI and ran main, I got the window frame with the Quit button like I expect.
I then compiled the .hs file into a .o file. I then attempted to create an executable with the following command:
ghc -v -o HelloWorldWX HelloWorldWX.o
Glasgow Haskell Compiler, Version 7.10.3, stage 2 booted by GHC version 7.10.2
Using binary package database: C:\Users\...\Haskell Platform\7.10.3\lib\pack
age.conf.d\package.cache
Using binary package database: C:\Users\...\AppData\Roaming\ghc\x86_64-mingw
32-7.10.3\package.conf.d\package.cache
wired-in package ghc-prim mapped to ghc-prim-0.4.0.0-428c198583a031a3ea42dd32ae6
f9bab
wired-in package integer-gmp mapped to integer-gmp-1.0.0.0-3c8c40657a9870f5c33be
17496806d8d
wired-in package base mapped to base-4.8.2.0-14035a44a8b95c6832da6dae1420f59e
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.10.0.0-bcb07fec12
f32563bb45d7fb009640b1
wired-in package ghc mapped to ghc-7.10.3-7a0d3c701e4b1d1f2c3f3bd2deae9bed
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags:
Created temporary directory: C:\Users\...\AppData\Local\Temp\1\ghc13152_0
*** C Compiler:
"C:\Users\...\Haskell Platform\7.10.3\lib/../mingw/bin/gcc.exe" "-fno-stack-
protector" "-DTABLES_NEXT_TO_CODE" "-c" "C:\Users\...\AppData\Local\Temp\1\g
hc13152_0\ghc_1.c" "-o" "C:\Users\...\AppData\Local\Temp\1\ghc13152_0\ghc_2.
o" "-IC:\Users\...\Haskell Platform\7.10.3\lib/include"
*** Windres:
"C:\Users\...\Haskell Platform\7.10.3\lib/../mingw/bin/windres.exe" "--prepr
ocessor=\"C:\Users\...\Haskell Platform\7.10.3\lib/../mingw/bin/gcc.exe\" \"
-fno-stack-protector\" \"-DTABLES_NEXT_TO_CODE\" \"-E\" \"-xc\" \"-DRC_INVOKED\"
" "--use-temp-file" "--input=C:\Users\...\AppData\Local\Temp\1\ghc13152_0\gh
c_4.rc" "--output=C:\Users\...\AppData\Local\Temp\1\ghc13152_0\ghc_5.o" "--o
utput-format=coff"
*** Linker:
"C:\Users\...\Haskell Platform\7.10.3\lib/../mingw/bin/gcc.exe" "-fno-stack-
protector" "-DTABLES_NEXT_TO_CODE" "-Wl,--hash-size=31" "-Wl,--reduce-memory-ove
rheads" "-Xlinker" "--stack=0x800000,0x800000" "-static-libgcc" "-o" "HelloWorld
WX.exe" "-Wl,--enable-auto-import" "HelloWorldWX.o" "C:\Users\...\AppData\Lo
cal\Temp\1\ghc13152_0\ghc_5.o" "-LC:\Users\...\Haskell Platform\7.10.3\lib\b
ase_HQfYBxpPvuw8OunzQu6JGM" "-LC:\Users\...\Haskell Platform\7.10.3\lib\inte
g_2aU3IZNMF9a7mQ0OzsZ0dS" "-LC:\Users\...\Haskell Platform\7.10.3\lib\ghcpr_
8TmvWUcS1U1IKHT0levwg3" "-LC:\Users\...\Haskell Platform\7.10.3\lib/rts" "C:
\Users\...\AppData\Local\Temp\1\ghc13152_0\ghc_2.o" "-Wl,-u,ghczmprim_GHCziT
ypes_Izh_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Czh_static_info" "-Wl,-u,ghcz
mprim_GHCziTypes_Fzh_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Dzh_static_info"
"-Wl,-u,base_GHCziPtr_Ptr_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Wzh_static_i
nfo" "-Wl,-u,base_GHCziInt_I8zh_static_info" "-Wl,-u,base_GHCziInt_I16zh_static_
info" "-Wl,-u,base_GHCziInt_I32zh_static_info" "-Wl,-u,base_GHCziInt_I64zh_stati
c_info" "-Wl,-u,base_GHCziWord_W8zh_static_info" "-Wl,-u,base_GHCziWord_W16zh_st
atic_info" "-Wl,-u,base_GHCziWord_W32zh_static_info" "-Wl,-u,base_GHCziWord_W64z
h_static_info" "-Wl,-u,base_GHCziStable_StablePtr_static_info" "-Wl,-u,ghczmprim
_GHCziTypes_Izh_con_info" "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info" "-Wl,-u,ghc
zmprim_GHCziTypes_Fzh_con_info" "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info" "-Wl,
-u,base_GHCziPtr_Ptr_con_info" "-Wl,-u,base_GHCziPtr_FunPtr_con_info" "-Wl,-u,ba
se_GHCziStable_StablePtr_con_info" "-Wl,-u,ghczmprim_GHCziTypes_False_closure" "
-Wl,-u,ghczmprim_GHCziTypes_True_closure" "-Wl,-u,base_GHCziPack_unpackCString_c
losure" "-Wl,-u,base_GHCziIOziException_stackOverflow_closure" "-Wl,-u,base_GHCz
iIOziException_heapOverflow_closure" "-Wl,-u,base_ControlziExceptionziBase_nonTe
rmination_closure" "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_clo
sure" "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure" "-Wl,-u,
base_GHCziIOziException_allocationLimitExceeded_closure" "-Wl,-u,base_ControlziE
xceptionziBase_nestedAtomically_closure" "-Wl,-u,base_GHCziEventziThread_blocked
OnBadFD_closure" "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure" "-Wl,-u,base
_GHCziTopHandler_flushStdHandles_closure" "-Wl,-u,base_GHCziTopHandler_runIO_clo
sure" "-Wl,-u,base_GHCziTopHandler_runNonIO_closure" "-Wl,-u,base_GHCziConcziIO_
ensureIOManagerIsRunning_closure" "-Wl,-u,base_GHCziConcziIO_ioManagerCapabiliti
esChanged_closure" "-Wl,-u,base_GHCziConcziSync_runSparks_closure" "-Wl,-u,base_
GHCziConcziSignal_runHandlersPtr_closure" "-lHSbase-4.8.2.0-HQfYBxpPvuw8OunzQu6J
GM" "-lHSinteger-gmp-1.0.0.0-2aU3IZNMF9a7mQ0OzsZ0dS" "-lHSghc-prim-0.4.0.0-8TmvW
UcS1U1IKHT0levwg3" "-lHSrts" "-lCffi-6" "-lwsock32" "-luser32" "-lshell32" "-lm"
"-lwsock32" "-lgdi32" "-lwinmm"
HelloWorldWX.o:fake:(.text+0x35): undefined reference to `wxcorzuLc8buVrXMQOAAoN
jm2eSy1_GraphicsziUIziWXCoreziLayout_zdfWidgetObject_closure'
HelloWorldWX.o:fake:(.text+0x91): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziAttributes_ZCze_con_info'
HelloWorldWX.o:fake:(.text+0x9a): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziTopLevelWindow_zdfFormObject_closure'
HelloWorldWX.o:fake:(.text+0xca): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziAttributes_set_closure'
HelloWorldWX.o:fake:(.text+0x11d): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziTopLevelWindow_zdfCloseableObject_closure'
HelloWorldWX.o:fake:(.text+0x15f): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziControls_zdfCommandingObject4_closure'
HelloWorldWX.o:fake:(.text+0x164): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziEvents_on_closure'
HelloWorldWX.o:fake:(.text+0x1ef): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziWindow_zdfTextualObject_closure'
HelloWorldWX.o:fake:(.text+0x27e): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziAttributes_ZCze_con_info'
HelloWorldWX.o:fake:(.text+0x2ce): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziAttributes_ZCze_con_info'
HelloWorldWX.o:fake:(.text+0x2ff): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziControls_button_closure'
HelloWorldWX.o:fake:(.text+0x427): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziWindow_zdfTextualObject_closure'
HelloWorldWX.o:fake:(.text+0x4b9): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziAttributes_ZCze_con_info'
HelloWorldWX.o:fake:(.text+0x4eb): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziFrame_frame_closure'
HelloWorldWX.o:fake:(.text+0x5da): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWX_start_closure'
HelloWorldWX.o:fake:(.text+0x1f8): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziClasses_text_info'
HelloWorldWX.o:fake:(.text+0x430): undefined reference to `wxzu6QQu5v1wfyA22ZZSl
eeGHgzz_GraphicsziUIziWXziClasses_text_info'
HelloWorldWX.o:fake:(.data+0x70): undefined reference to `wxcorzuLc8buVrXMQOAAoN
jm2eSy1_GraphicsziUIziWXCoreziLayout_zdfWidgetObject_closure'
HelloWorldWX.o:fake:(.data+0x78): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziAttributes_set_closure'
HelloWorldWX.o:fake:(.data+0x80): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziTopLevelWindow_zdfFormObject_closure'
HelloWorldWX.o:fake:(.data+0x88): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziTopLevelWindow_zdfCloseableObject_closure'
HelloWorldWX.o:fake:(.data+0x90): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziEvents_on_closure'
HelloWorldWX.o:fake:(.data+0x98): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziControls_zdfCommandingObject4_closure'
HelloWorldWX.o:fake:(.data+0xa8): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziWindow_zdfTextualObject_closure'
HelloWorldWX.o:fake:(.data+0xb0): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziControls_button_closure'
HelloWorldWX.o:fake:(.data+0xc8): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWXziFrame_frame_closure'
HelloWorldWX.o:fake:(.data+0xd8): undefined reference to `wxzu6QQu5v1wfyA22ZZSle
eGHgzz_GraphicsziUIziWX_start_closure'
C:\Users\...\AppData\Local\Temp\1\ghc13152_0\ghc_2.o:ghc_1.c:(.rdata$.refptr
.ZCMain_main_closure[.refptr.ZCMain_main_closure]+0x0): undefined reference to `
ZCMain_main_closure'
collect2.exe: error: ld returned 1 exit status
*** Deleting temp files:
Deleting: C:\Users\...\AppData\Local\Temp\1\ghc13152_0\ghc_6.rsp C:\Users\pp
77316\AppData\Local\Temp\1\ghc13152_0\ghc_5.o C:\Users\...\AppData\Local\Tem
p\1\ghc13152_0\ghc_4.rc C:\Users\...\AppData\Local\Temp\1\ghc13152_0\ghc_3.r
sp C:\Users\...\AppData\Local\Temp\1\ghc13152_0\ghc_2.o C:\Users\...\App
Data\Local\Temp\1\ghc13152_0\ghc_1.c
*** Deleting temp dirs:
Deleting: C:\Users\...\AppData\Local\Temp\1\ghc13152_0
I am not really sure why it is having problems finding these references.
I tried executing then with
runhaskell HelloWorldWX.hs
and received the following error popup from ghc:
The Verbose flag being set here gives a bunch of information that doesn't really elaborate on any specific problems.
I am running Haskell GHC 7.10.3 full package from Windows Installer to a local Users directory. I do not have Local Administrator privileges on this workstation but I could try on another machine.
Any clues? I imagine the first failed install of wxHaskell has corrupted something or I am running into a privilege issue.

I figured out what the problem was. I forgot that for GHC to create an executable that you need to explicitly specify Cabal packages that you wish to include. Commenter Tomasz Lewowski was partially correct. The -L option for linking libraries was required by gcc, however the ghc application intelligently adds ALL the required library paths for a given Cabal package by using the -package option.
The second part of making this work was that I needed to compile the .o file specifying -main-is for the main method. I wrote up the simple batch file and got it working.
ghc -v -main-is HelloWorld.main HelloWorld.hs
ghc -v -o HelloWorld HelloWorld.o -package strict-0.3.2 -package wx-0.92.2.0 -package wxc-0.92.2.0 -package wxcore-0.92.2.0 -package wxdirect-0.92.2.0
This created the Windows executable just fine and it works like a charm.

Related

Undefined references and gcc error when building Haskell executable with cabal?

I set up a simple cabal project to try and acquaint myself with it better, and I have a very simple Main.hs file:
main :: IO ()
main = putStrLn "Hello, World!"
So then I try to build it, using cabal new-configure and then cabal new-build. There's no problems for the configure command, but building it gives this:
[1 of 1] Compiling Main ( Main.hs, /home/redacted/Documents/Haskell/nixtut/dist-newstyle/build/x86_64-linux/ghc-8.0.1/newp-0.1.0.0/x/newp/build/newp/newp-tmp/Main.o )
Linking /home/daniel/Documents/Haskell/nixtut/dist-newstyle/build/x86_64-linux/ghc-8.0.1/newp-0.1.0.0/x/newp/build/newp/newp ...
/nix/store/6yjpyqkx6d9k5f2s2g8h9kz40q6rz1yx-binutils-2.31.1/bin/ld: //nix/store/siks2gcfwx6qwh27m7c5r5lixcr621bd-glibc-2.27/lib/libpthread.so.0: undefined reference to `_IO_enable_locks#GLIBC_PRIVATE'
/nix/store/6yjpyqkx6d9k5f2s2g8h9kz40q6rz1yx-binutils-2.31.1/bin/ld: //nix/store/siks2gcfwx6qwh27m7c5r5lixcr621bd-glibc-2.27/lib/libpthread.so.0: undefined reference to `__mmap#GLIBC_PRIVATE'
/nix/store/6yjpyqkx6d9k5f2s2g8h9kz40q6rz1yx-binutils-2.31.1/bin/ld: //nix/store/siks2gcfwx6qwh27m7c5r5lixcr621bd-glibc-2.27/lib/libpthread.so.0: undefined reference to `__munmap#GLIBC_PRIVATE'
/nix/store/6yjpyqkx6d9k5f2s2g8h9kz40q6rz1yx-binutils-2.31.1/bin/ld: //nix/store/siks2gcfwx6qwh27m7c5r5lixcr621bd-glibc-2.27/lib/libpthread.so.0: undefined reference to `__mprotect#GLIBC_PRIVATE'
/nix/store/6yjpyqkx6d9k5f2s2g8h9kz40q6rz1yx-binutils-2.31.1/bin/ld: //nix/store/siks2gcfwx6qwh27m7c5r5lixcr621bd-glibc-2.27/lib/libpthread.so.0: undefined reference to `__tunable_get_val#GLIBC_PRIVATE'
/nix/store/6yjpyqkx6d9k5f2s2g8h9kz40q6rz1yx-binutils-2.31.1/bin/ld: //nix/store/siks2gcfwx6qwh27m7c5r5lixcr621bd-glibc-2.27/lib/libpthread.so.0: undefined reference to `__sigtimedwait#GLIBC_PRIVATE'
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
Here is my .cabal file:
name: newp
version: 0.1.0.0
synopsis: toying around
-- description:
homepage: none
-- bug-reports:
license: BSD-3-Clause
license-file: LICENSE
author: redacted
maintainer: none
-- copyright:
category: practice
extra-source-files: CHANGELOG.md
executable newp
main-is: Main.hs
--other-modules:
-- other-extensions:
build-depends: base ^>=4.9.0.0
-- hs-source-dirs:
default-language: Haskell2010
I can't seem to understand what's wrong. GCC is installed, I'm not trying to link any external library, I'm not using any other modules, I have no idea know what these references allude to.
Any help is appreciated, because frankly, I don't know where to begin with this. I've tried looking online, but all the situations are different and the solutions don't seem to apply to me. I noticed that for others a similar error occurs when there's an issue with linking or not including modules in the cabal file, but I'm not sure how or if that applies here.
While I don't have a definitive answer as to why the error occurred, after reinstalling nix I could finally build the project. So the issue was not with cabal.

Crypto++ causes undefined reference in Qt Creator, but not in code::blocks

Nearly every function from Crypto++ produces undefined reference in Qt Creator, code::blocks however runs just great.
LIBS+= -lcryptopp
in .pro file seems to work as I can include needed files and declare variables unless constructor is overloaded.
For example
CryptoPP::Integer integer;
std::string str=CryptoPP::IntToString(integer, 10);
Throws
.../main.cpp:54: undefined reference to `std::string CryptoPP::IntToString<CryptoPP::Integer>(CryptoPP::Integer, unsigned int)'
collect2: error: ld returned 1 exit status
make: *** [PDBM] Error 1
07:10:21: The process "/usr/bin/make" exited with code 2.
cryptest.pro
Makefile
full rebuild //sorry, stackoverflow wants those links to be a code
/usr/lib/ contains libcrypto++.a, libcrypto++.so, libcryptopp.so and link to libcrypto++.a named libcryptopp.a
New findings: I have tried to compile this library before and now my project folder has all the .h and .cpp files in cryptopp folder. To provide all the code without showing the code new project has been created and more errors appeared:
In file included from /usr/include/cryptopp/secblock.h:7:0,
from /usr/include/cryptopp/integer.h:7,
from ../cryptest/main.cpp:7:
/usr/include/cryptopp/misc.h: In instantiation of ‘std::string CryptoPP::IntToString(T, unsigned int) [with T = CryptoPP::Integer; std::string = std::basic_string<char>]’:
../cryptest/main.cpp:54:54: required from here
/usr/include/cryptopp/misc.h:424:58: error: invalid cast from type ‘CryptoPP::Integer’ to type ‘char’
result = char((digit < 10 ? '0' : ('a' - 10)) + digit) + result;
^
Makefile:1113: recipe for target 'main.o' failed
Which means that cryptopp has been using those new .h files. So it is not only a problem with linker as I previously thought.
I'm on Ubuntu 16.04, using Qt 5.8 and Crypto++ from repository.
-lcryptopp
This option simply tells your linker that you want to link to a shared library called libcryptopp.so. However, it does not tell your linker where to find the shared library.
You must specify the folder which contains the developer's copy of the library, using the -L option. For example, if the library is in /usr/lib, then write this:
LIBS += -L/usr/lib/ -lcryptopp

Installing pciutils on Cygwin and makefile error

I want to run a project that communicates with a USB device using libusb. I already have it on Linux, and it works great there, so I want to run it on Windows with Cygwin. I installed libusb for Windows and libusb in Cygwin, then tried to compile it. It turns out that you need pciutils, unlike on Linux in which it's really easy to get it. In Cygwin it's a problem.
After overcoming some difficulties I managed to get further with my purpose of compiling pciutil in the Cygwin environment. I follwed these steps:
Download winio package for Windows and went to Winio\Binaries and copied winio32.dll and winio32.sys to the pciutil directory.
Copy config.h/mk from ../win32 to ../lib
Go to ..\lib\i386-io-winodws.h and change line 39 to "lib = LoadLibrary("WinIo32.dll");"
$ make
The make step didn't work. It showed me a makefile error, so I tried to play with it without any luck.
I got this error:
gcc lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/libpci.a -o lspci
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x95): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0xd3): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0xf1): undefined reference to `_outpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x110): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x170): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x184): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x1af): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x204): undefined reference to `_outpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x218): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x242): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x259): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x2d5): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x30c): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x328): undefined reference to `_inpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x348): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3b2): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3c6): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3ed): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x417): undefined reference to `_inpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x42f): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x447): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x457): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x65a): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x666): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x67c): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x688): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x69f): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x6c3): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x729): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x73d): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x751): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x75d): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x778): undefined reference to `_inp'
collect2: error: ld returned 1 exit status
Makefile:96: recipe for target 'lspci' failed
make: *** [lspci] Error 1
I went to the Makefile, line 96, but I didn't understand what to change there in order to make it work (if you like, I could post the entire makefile too):
%: %.o
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $#
Since you're using a 32-bit version of Windows you can use the Cygwin port of pciutils. The files in the win32 subdirectory are actually for the MinGW port, and that's why you get the link errors.
The first thing you should do unpack the source files to a new directory so you can start from fresh. Your changes and modifications aren't necessary to compile it using Cygwin. Be sure not to copy any of the files in the win32 directory this time, they're not needed. Also don't copy the winio32 files, you don't need them either. Don't make any changes to any of the files.
The next thing to do is to install the ioperm package using Cygwin's setup-x86.exe. Type ioperm in the search box to quickly find it amongst all the other packages. Once it's been installed run ioperm -i from the Cygwin prompt to install the driver that allows applications to do direct I/O.
Next change directory to where you unpacked the fresh copy of pciutils and run the following command from the Cygwin shell:
make HOST=i386-pc-cygwin
That should be all you need to do to create the library and utilities.

Error "collect2: error: ld returned 1 exit status" shows while compiling vim (Versin>=7.4.399) from Cygwin

I've tired to maintenance the latest VIM/GVIM for windows, here is my OpenSource project.
However, I found the compile always failed by cygwin since the vim version higher than v7.4.399 (including v7.4.399).
Version less than v7.4.399 can be compiled with the same command successfully!
Failed Information:
obj/ex_docmd.o:ex_docmd.c:(.text+0x45f): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xbb7): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0xbe6): undefined reference to `crypt_encode_alloc'
obj/fileio.o:fileio.c:(.text+0xd69): undefined reference to `crypt_encode_inplace'
obj/fileio.o:fileio.c:(.text+0x69e3): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c66): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c97): undefined reference to `crypt_free_key'
obj/fileio.o:fileio.c:(.text+0x716f): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x7177): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x8e48): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0x8e73): undefined reference to `crypt_decode_inplace'
obj/fileio.o:fileio.c:(.text+0x906d): undefined reference to `crypt_method_nr_from_magic'
obj/fileio.o:fileio.c:(.text+0x9098): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90c8): undefined reference to `crypt_create_from_header'
obj/fileio.o:fileio.c:(.text+0x90df): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90e7): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x9158): undefined reference to `crypt_decode_alloc'
obj/fileio.o:fileio.c:(.text+0x9e3f): undefined reference to `crypt_append_msg'
obj/fileio.o:fileio.c:(.text+0x9ed4): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x9edc): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0xa5bc): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xca32): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0xdd15): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0xdd37): undefined reference to `crypt_create_for_writing'
obj/fileio.o:fileio.c:(.text+0xe2d2): undefined reference to `crypt_append_msg'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: obj/fileio.o: bad reloc address 0x2e8 in section `.rdata'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
Make_cyg.mak:603: recipe for target 'vim.exe' failed
make: *** [vim.exe] Error 1
The compile command:
make -B -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgramFiles/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgramFiles/Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34 FEATURES=huge IME=yes GIME=yes MBYTE=yes CSCOPE=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=no
I checked the difference between v7-4-398 and v7-4-399, and found there something updated with encryption. Then I added the libs and other stuff about crypt in cygwin as below, but the compile still CANNOT work....
What should I do can compile the higher version vim ?
Environments:
Cygwin version: Latest setup-x86_64.exe, mintty 1.2-beta1 (x86_64-pc-cygwin)
Have you tried compiling with all the patches that are currently available. I think Bram Moolenaar (Maintainer for vim) forgot to add some of the files in one of the patches and one of the later one fixes that. If not post to vim_dev#vim.org
This was also reported to at https://groups.google.com/forum/#!topic/vim_dev/D8FyRd0EwlE.
Patch 7.4.401 should fix it https://groups.google.com/forum/#!topic/vim_dev/q0dbl0_9k9U
Got this issue again on CentOS 7, Python 2.7.10, 64bit.
According to this answer, this issue has been fixed;
export vi_cv_path_python_plibs="-L/<python_config_path> ..."
For example in my situation:
export vi_cv_path_python_plibs="-L/usr/local/lib/python2.7/config ..."
Compile command:
$ ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp --with-python-config-dir=/usr/local/lib/python2.7/config --with-features=huge --disable-smack --enable-cscope --with-tlib=ncurses --with-compiledby=marslo#china
$ cd src && make first
$ cd .. && make
$ make install
You can disable sodium library in ./configure such as :
./configure -disable-libsodium

Build error with Haskell GD bindings

I've installed the GD package (http://hackage.haskell.org/package/gd-3000.4.0) using cabal. When I try to compile the program which uses GD I receive an error:
[mp262554#students:~/jpp/haskell]$ ghc gd.hs
compilation IS NOT required
gd.o: In function `sV8_info':
(.text+0x1bf): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_saveJpegFile_closure'
gd.o: In function `sUY_info':
(.text+0x3be): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_drawLine_closure'
gd.o: In function `sUI_info':
(.text+0x51a): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_newImage_closure'
gd.o: In function `sUI_info':
(.text+0x6a5): undefined reference to `__stginit_gdzm3000zi4zi0_GraphicsziGD_'
gd.o: In function `sVc_srt':
(.data+0x34): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_drawLine_closure'
gd.o: In function `sVc_srt':
(.data+0x38): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_saveJpegFile_closure'
gd.o: In function `sUI_srt':
(.data+0x4c): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_newImage_closure'
collect2: ld returned 1 exit status
GD package provides bindings to GD library written in C. You need to link the C library to your program. Try --make option of the GHC first:
ghc --make gd.hs
GHC with --make should figure dependencies automatically and link a multi-module program correctly. You can also consider using -l and -L options manually.
Messages like this may indicate that files do in fact need recompiling. Try ghc -fforce-recomp

Resources