stack install crashes on pretty much anything - haskell

I'm trying to install tidal cycles via stack using stack install tidal.
Installation went smooth for the first couple dependencies but now I'm getting this.
04:24 ~ stack install tidal
mersenne-random-pure64-0.2.2.0: configure
mersenne-random-pure64-0.2.2.0: build
network-2.6.3.2: configure
zlib-0.6.1.2: configure
zlib-0.6.1.2: build
Progress: 3/7
-- While building custom Setup.hs for package zlib-0.6.1.2 using:
/home/mn/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /home/mn/.stack/global-project/.stack-work/logs/zlib-0.6.1.2.log
Configuring zlib-0.6.1.2...
Preprocessing library for zlib-0.6.1.2..
/usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Codec/Compression/Zlib/Stream_hsc_make.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Codec/Compression/Zlib/Stream_hsc_utils.o: requires dynamic R_X86_64_PC32 reloc against 'vprintf' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status
linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Codec/Compression/Zlib/Stream_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Codec/Compression/Zlib/Stream_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Codec/Compression/Zlib/Stream_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Codec/Compression/Zlib/Stream_hsc_make -fuse-ld=gold -fno-PIE -fno-stack-protector -fuse-ld=gold -lz -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/bytestring-0.10.8.2 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/bytestring-0.10.8.2 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/deepseq-1.4.3.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/deepseq-1.4.3.0 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/array-0.5.2.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/array-0.5.2.0 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/base-4.10.1.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/base-4.10.1.0 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/integer-gmp-1.0.1.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/integer-gmp-1.0.1.0 -lgmp -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/ghc-prim-0.5.1.1 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/ghc-prim-0.5.1.1 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/rts -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/rts -lm -lrt -ldl -lpthread
-- While building custom Setup.hs for package network-2.6.3.2 using:
/tmp/stack17553/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0 configure --with-ghc=/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/bin/ghc --with-ghc-pkg=/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/pkgdb --libdir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/lib --bindir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/bin --datadir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/share --libexecdir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/libexec --sysconfdir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/etc --docdir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/doc/network-2.6.3.2 --htmldir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/doc/network-2.6.3.2 --haddockdir=/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/doc/network-2.6.3.2 --dependency=base=base-4.10.1.0 --dependency=bytestring=bytestring-0.10.8.2 --dependency=unix=unix-2.7.2.2
Process exited with code: ExitFailure 1
Logs have been written to: /home/mn/.stack/global-project/.stack-work/logs/network-2.6.3.2.log
[1 of 2] Compiling Main ( /tmp/stack17553/network-2.6.3.2/Setup.hs, /tmp/stack17553/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim ( /home/mn/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack17553/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/setup/StackSetupShim.o )
Linking /tmp/stack17553/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/setup/setup ...
Configuring network-2.6.3.2...
configure: WARNING: unrecognized options: --with-compiler
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/tmp/stack17553/network-2.6.3.2':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
-- While building custom Setup.hs for package mersenne-random-pure64-0.2.2.0 using:
/home/mn/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /home/mn/.stack/global-project/.stack-work/logs/mersenne-random-pure64-0.2.2.0.log
Configuring mersenne-random-pure64-0.2.2.0...
Preprocessing library for mersenne-random-pure64-0.2.2.0..
/usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/System/Random/Mersenne/Pure64/Base_hsc_make.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/System/Random/Mersenne/Pure64/Base_hsc_utils.o: requires dynamic R_X86_64_PC32 reloc against 'vfprintf' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status
linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/System/Random/Mersenne/Pure64/Base_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/System/Random/Mersenne/Pure64/Base_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/System/Random/Mersenne/Pure64/Base_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/System/Random/Mersenne/Pure64/Base_hsc_make -fuse-ld=gold -fno-PIE -fno-stack-protector -fuse-ld=gold -L/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/lib/x86_64-linux-ghc-8.2.2/random-1.1-LLUGZ7T9DqQ5vN0Jbcd0We -Wl,-R,/home/mn/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-10.0/8.2.2/lib/x86_64-linux-ghc-8.2.2/random-1.1-LLUGZ7T9DqQ5vN0Jbcd0We -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/time-1.8.0.2 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/time-1.8.0.2 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/deepseq-1.4.3.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/deepseq-1.4.3.0 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/array-0.5.2.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/array-0.5.2.0 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/base-4.10.1.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/base-4.10.1.0 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/integer-gmp-1.0.1.0 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/integer-gmp-1.0.1.0 -lgmp -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/ghc-prim-0.5.1.1 -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/ghc-prim-0.5.1.1 -L/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/rts -Wl,-R,/home/mn/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/rts -lm -lrt -ldl -lpthread
✘ 04:24 ~
Googled a little and found a few things, tried a few things but none worked, I'm lost.
Any help is appreciated, thanks.

I'm guessing you're using Arch Linux.
I'm in the middle of trying to come up with a comprehensive fix for this and related problems in stack setup, but I believe the simplest course of action is to add this to your ~/.stack/config.yaml:
ghc-build: tinfo6
You may need to run stack setup --reinstall to force a re-install.

Related

Could not determine size of CHARACTER while installing openmpi

I am trying to install openmpi on Amazon ec2 instance. I have uninstalled the openmpi installations present in the system using -
yum remove -y openmpi.x86_64 openmpi-devel.x86_64
This removes 2.1.1-1.31.amzn1 version of openmpi and openmpi devel.
I have downloaded the tar file from official openmpi site. When I try running configure, I get the following error -
checking if C and Fortran are link compatible... yes
checking to see if Fortran compiler likes the C++ exception flags... skipped (no C++ exceptions flags)
checking to see if mpifort compiler needs additional linker flags... none
checking if Fortran compiler supports CHARACTER... yes
checking size of Fortran CHARACTER... configure: WARNING: Could not determine size of CHARACTER
configure: WARNING: See config.log for details
configure: error: Cannot continue
Errors in config.log file -
configure:37098: $? = 0
configure:37111: result: yes
configure:37146: checking size of Fortran CHARACTER
configure:37214: /usr/lib/a-4.2.0-py-3.5.3-dl-gpu-full/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -finline-functions -fno-strict-aliasing -I. -c conftest.c
configure:37221: $? = 0
configure:37231: gfortran conftestf.f90 conftest.o -o conftest -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now
/usr/bin/ld: conftest.o: unrecognized relocation (0x29) in section .text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
configure:37238: $? = 1
configure:37259: here is the Fortran program:
program fsize
I have tried with ./configure —disable-fortran as well but I am getting the same error.
Any help will be appreciated.

Linking error when trying "stack install yesod-bin"

I would like to start developing for web using yesod framework.
But I can not install yesod.
I'm following the steps suggested:
stack new my-project yesod-sqlite
cd my-project
stack install yesod-bin --install-ghc
But the "stack install yesod-bin --install-ghc" command gives me the following output:
clock-0.7.2: configure
clock-0.7.2: build
basement-0.0.4: configure
file-embed-0.0.10.1: download
hourglass-0.2.10: download
basement-0.0.4: build
file-embed-0.0.10.1: configure
file-embed-0.0.10.1: build
hourglass-0.2.10: configure
hourglass-0.2.10: build
file-embed-0.0.10.1: copy/register
hourglass-0.2.10: copy/register
Progress: 4/93
-- While building custom Setup.hs for package basement-0.0.4 using:
/home/mbaroni/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /home/mbaroni/Computacao/prog/yesod-project/.stack-work/logs/basement-0.0.4.log
Configuring basement-0.0.4...
Preprocessing library for basement-0.0.4..
/usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Basement/Terminal/Size_hsc_make.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Basement/Terminal/Size_hsc_utils.o: requires dynamic R_X86_64_PC32 reloc against 'vprintf' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status
linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Basement/Terminal/Size_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Basement/Terminal/Size_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Basement/Terminal/Size_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/Basement/Terminal/Size_hsc_make -fuse-ld=gold -fno-PIE -fno-stack-protector -fuse-ld=gold -L/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/base-4.10.1.0 -Wl,-R,/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/base-4.10.1.0 -L/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/integer-gmp-1.0.1.0 -Wl,-R,/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/integer-gmp-1.0.1.0 -lgmp -L/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/ghc-prim-0.5.1.1 -Wl,-R,/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/ghc-prim-0.5.1.1 -L/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/rts -Wl,-R,/home/mbaroni/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/lib/ghc-8.2.2/rts -lm -lrt -ldl -lpthread
Any idea about what could be the cause of the problem would be greatly appreciated.
My environment:
stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2
uname -a
Linux mbaroni 4.12.13-1-ARCH #1 SMP PREEMPT Fri Sep 15 06:36:43 UTC 2017 x86_64 GNU/Linux
Thanks for helping!
I finally figured out what was the problem and I was able to solve it in my environment.
Reason
It seems that GCC enabled PIE (Position Independent Executable) by default and stack (which uses GCC in the back) does not expect this, causing the reported problem at linking stage (source).
Solution
As suggested here the solution was to configure stack to pass gcc the right flags to correct this.
This is done editing the file "~/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.1/lib/ghc-8.0.1/settings" in my case.
I had to modify the configuration of 3 lines as follows:
...
("C compiler flags", "-fno-PIE -fno-stack-protector -fPIC"),
("C compiler link flags", "-no-pie -fuse-ld=gold"),
("C compiler supports -no-pie", "YES"),
...
Best.

Installing zlib using stack: recompile with -fPIC

When I run
stack --resolver=lts-7.14 install zlib
I'm getting message saying that package should be recompiled with -fPIC flag:
Configuring zlib-0.6.1.2...
Building zlib-0.6.1.2...
Preprocessing library zlib-0.6.1.2...
/usr/bin/ld: .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0/build/Codec/Compression/Zlib/Stream_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
How to tell stack to recompile zlib with -fPIC flag?
I added ghc-options to yaml file:
ghc-options:
zlib: -fPIC
apply-ghc-options: locals
rebuild-ghc-options: true
Also, I added -fPIC flag to ghc-options in cabal file.
But still, I'm getting the same output:
-- While building package zlib-0.6.1.2 using:
/home/vladimir/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_1.24.0.0_ghc-8.0.1 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/vladimir/Desktop/ffmpeg-light/.stack-work/logs/zlib-0.6.1.2.log
Where ghc-options are -ddump-hi and -ddump-to-file and no -fPIC. Did I miss something?
GCC, stack and OS versions:
GCC: gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
Stack: Version 1.3.0, Git revision 99b910d3c8e183aa376cb1e6f0341d86aed6d00e (4372 commits) x86_64 hpack-0.15.0
OS: Ubuntu 16.10
Looks like it is bug.
I found a hack:
I replaced
("C compiler flags", "-fno-PIE -fno-stack-protector")
by
("C compiler flags", "-fPIC -fno-stack-protector")
in file
/home/you/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings
Now it compiles and works. I tested it on my project.
The issue is in how Cabal invokes hsc2hs. You need commit https://github.com/haskell/cabal/commit/c993a0c6660aa10d8c79ed0cc4961c59acfc91c8 which is present as of Cabal 1.24.1.0.

Cross-compiling Snap7 for MIPS with OpenWrt as OS

Currently i'm working on a project to log data out of a Siemens PLC. To achieve this i'm using Snap7. Snap7 (http://snap7.sourceforge.net/) is a communication library.
I've managed to get it work on my linux desktop but when i try to cross-compile the snap7 library i get some errors
The error is generated when linking all of the object files.
g++ -shared -fPIC -o ../bin/mips-openwrt-linux-g++/libsnap7.so #"filelist.txt" -L. -lpthread -lrt -O3
/usr/bin/ld: ../temp/mips-openwrt-linux/sys_snap_msgsock.o: Relocations in generic ELF (EM: 8)
./temp/mips-openwrt-linux/sys_snap_msgsock.o: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status
make: *** [../bin/mips-openwrt-linux-g++/libsnap7.so] Error 1
If i'm correct i think it's using the wrong linker, it should use the linker of the toolchain located at: openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/
I've also tried to compile the software with mips-openwrt-linux-g++.
Now another error is given:
mips-openwrt-linux-g++ -shared -fPIC -o ../bin/mips-openwrt-linux-g++/libsnap7.so #"filelist.txt" -L. -lpthread -lrt -O3
openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: ../temp/mips-openwrt-linux/sys_snap_msgsock.o: relocation R_MIPS_26 against `close' can not be used when making a shared object; recompile with -fPIC
../temp/mips-openwrt-linux/sys_snap_msgsock.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [../bin/mips-openwrt-linux-g++/libsnap7.so] Error 1
I hope someone is familiar with this error and can help me out.
Thanks in advance.
edit1:
There are some pre-compiled binaries. In the makefiles i changed the CC to my g++ directory. There is no LD flag so i cannot set my linker over there.
Can you cross compile and run a "hello world" program?
What is the output of file ../temp/mips-openwrt-linux/sys_snap_msgsock.o?

ld skipping incompatible library when g++ compiling with either -m32 or -m64

I'm on 64-bit Ubuntu and I'm trying to build with "libasmlibrary.so" with Eclipse. However, it kept telling me that the library is incompatible, either with "-m32" or "-m64". This is what is shown when I don't add either of the two options.
17:25:54 ** Incremental Build of configuration Debug for project ASM_TEST **
make all
Building target: ASM_TEST
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -L/home/leon/asmlibrary/linux -o "ASM_TEST" ./src/demo_fit.o ./src/video_camera.o ./src/vjfacedetect.o -lopencv_core -lasmlibrary -lopencv_highgui -lopencv_imgproc -lopencv_ml -lopencv_video -lopencv_objdetect
/usr/bin/ld: skipping incompatible /home/leon/asmlibrary/linux/libasmlibrary.so when searching for -lasmlibrary
/usr/bin/ld: cannot find -lasmlibrary
collect2: ld returned 1 exit status
make: * [ASM_TEST] Error 1
17:25:54 Build Finished (took 111ms)

Resources