Installing software from source on Linux and filename expansion - linux

installing from source some software on Ubuntu, with some shell script, I end up with the following error..
vagrant#precise64:~/EventStore-oss-v3.5.0$ bash -x ./scripts/build-js1/build-js1-linux.sh werror=no
...
+ make x64.release werror=no
make[1]: Entering directory `/home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out'
+ popd
+ local outputDir=/home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/../../src/libs/x64/ubuntu-12.04
+ [[ -d /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/../../src/libs/x64/ubuntu-12.04 ]]
+ pushd /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/../../src/EventStore.Projections.v8Integration/
+ local outputObj=/home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/../../src/libs/x64/ubuntu-12.04/libjs1.so
+ g++ -I '/home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/include *.cpp' -o /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/../../src/libs/x64/ubuntu-12.04/libjs1.so -fPIC -shared -std=c++0x -lstdc++ -Wl,--start-group '/home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/tools/gyp/libv8_{base.x64,nosnapshot.x64}.a' '/home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/third_party/icu/libicu{i18n,uc,data}.a' -Wl,--end-group -lrt -lpthread
g++: error: /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/tools/gyp/libv8_{base.x64,nosnapshot.x64}.a: No such file or directory
g++: error: /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/third_party/icu/libicu{i18n,uc,data}.a: No such file or directory
vagrant#precise64:~/EventStore-oss-v3.5.0$
Although if I try to see if those files exists, they do :
vagrant#precise64:~/EventStore-oss-v3.5.0$ ls -la /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/tools/gyp/libv8_{base.x64,nosnapshot.x64}.a
-rw-rw-r-- 1 vagrant vagrant 1162178 Mar 1 13:24 /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/tools/gyp/libv8_base.x64.a
-rw-rw-r-- 1 vagrant vagrant 3580 Mar 1 13:25 /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/tools/gyp/libv8_nosnapshot.x64.a
and
vagrant#precise64:~/EventStore-oss-v3.5.0$ ls -la /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/third_party/icu/libicu{i18n,uc,data}.a
-rw-rw-r-- 1 vagrant vagrant 338 Mar 1 13:29 /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/third_party/icu/libicudata.a
-rw-rw-r-- 1 vagrant vagrant 314000 Mar 1 13:27 /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/third_party/icu/libicui18n.a
-rw-rw-r-- 1 vagrant vagrant 147746 Mar 1 13:29 /home/vagrant/EventStore-oss-v3.5.0/scripts/build-js1/v8/out/x64.release/obj.target/third_party/icu/libicuuc.a
Is there anything obvious linux principle I am missing ... ?
Could filename expansion be interpreted differently when used in a script and when used on the command line ?

Related

/bin/cp: cannot open 'libmxml.so' for reading: Too many levels of symbolic links

I was running a make to produce a cross-compiled Linux kernel, with --target=mips-buildroot-linux-uclibc, --host=mips-linux, CC= mipsel-buildroot-linux-gnu-gcc, --build=x86_64-linux-gnu.
The build environment is Ubuntu 20.04.
I encountered the following error:
Makefile:147: target 'install-libmxml.so.1.4' does not exist
/usr/bin/install -c -d /home/minipc/econet/lib_install
/bin/rm -f libmxml.so
/bin/ln -s /home/minipc/econet/apps/public/mxml-2.4/libmxml.so.1.4 libmxml.so
/bin/rm -f libmxml.so.1
/bin/ln -s /home/minipc/econet/apps/public/mxml-2.4/libmxml.so.1.4 libmxml.so.1
/bin/rm -f /home/minipc/econet/lib_install/libmxml.so*
/bin/cp -rf libmxml.so* /home/minipc/econet/lib_install
/bin/cp: cannot open 'libmxml.so' for reading: Too many levels of symbolic links
make[1]: *** [Makefile:153: install-libmxml.so.1.4] Error 1
The Makefile snippet code is:
146 install-libmxml.so.1.4:
147 $(INSTALL_DIR) $(LIB_INSTALL_DIR)
148 $(RM) libmxml.so
149 $(LN) $(shell pwd)/libmxml.so.1.4 libmxml.so
150 $(RM) libmxml.so.1
151 $(LN) $(shell pwd)/libmxml.so.1.4 libmxml.so.1
152 $(RM) $(LIB_INSTALL_DIR)/libmxml.so*
153 $(CP) libmxml.so* $(LIB_INSTALL_DIR)
And I checked that symbolic link libmxml.so and libmxml.so.1 have been correctly created.
lrwxrwxrwx 1 minipc minipc 55 Aug 13 22:35 libmxml.so -> /home/minipc/econet/apps/public/mxml-2.4/libmxml.so.1.4*
lrwxrwxrwx 1 minipc minipc 55 Aug 13 22:35 libmxml.so.1 -> /home/minipc/econet/apps/public/mxml-2.4/libmxml.so.1.4*
-rwxrwxr-x 1 minipc minipc 30084 Aug 13 22:35 libmxml.so.1.4*
And I tried the following in the direcotry /home/minipc/econet/apps/public/mxml-2.4
$ /bin/cp -rf libmxml.so* /home/minipc/econet/lib_install
It created the desired result with no any warning or error reported.
So I wonder why it reported error in Make process?
It was caused by this recipe:
$(CP) libmxml.so* $(LIB_INSTALL_DIR)
It maybe that coping two symbolic links to the same file to the same directory simultaneously lead to error. I found a workaround:
154 $(CP) libmxml.so.1.4 $(LIB_INSTALL_DIR)
155 $(LN) $(LIB_INSTALL_DIR)/libmxml.so.1.4 $(LIB_INSTALL_DIR)/libmxml.so
156 $(LN) $(LIB_INSTALL_DIR)/libmxml.so.1.4 $(LIB_INSTALL_DIR)/libmxml.so.1
First, copy the real file to the dir, then create 2 symbolic links in the dir one by one.
That's it. No errors reported any more.

Cannot open shared object file libpng12.so.0

I am trying to run Quartus 13.0 in the following machine:
parrot 4.18.0-parrot10-amd64 #1 SMP Debian 4.18.10-1parrot10 (2018-10-06) x86_64 GNU/Linux.
I have finished installing Quartus 13.0 and when I try to execute it I get this error:
quartus: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
I have read all the related questions in stack overflow and other websites but no one worked for me.
When looking for that file, I found it. I have tried to do a hard link but it doesn't work either. Search results:
┌─[pepbd#parrot]─[~]
└──╼ $ls -ld $(locate -r libpng.*\.so.*)
lrwxrwxrwx 1 root root 19 nov 19 17:09 /usr/lib/x86_64-linux-gnu/libpng16.so.16 -> libpng16.so.16.34.0
-rw-r--r-- 1 root root 210864 jul 10 13:17 /usr/lib/x86_64-linux-gnu/libpng16.so.16.34.0
-rw-r--r-- 1 root root 18272 oct 14 21:59 /usr/lib/x86_64-linux-gnu/vlc/plugins/codec/libpng_plugin.so
I had the same problem with Quartus Prime 18 on Ubuntu. This worked for me (run as sudo):
wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
&& dpkg -i /tmp/libpng12.deb \
&& rm /tmp/libpng12.deb

newlib build failed in directory: arm-none-eabi/libgloss/arm

In the process of building a set of ARM tools. I have used these steps many times before. I have tried the same configure/make in the "newlib-2.5.0.20170922" and "newlib-2.5.0.20170922" directories. Still get the error. I also tried my steps as super-user. No change. In the past building Newlib has always been a problem. Can somebody assist?
tar -xf newlib-2.5.0.20170922.tar.gz
cd newlib-2.5.0.20170922.armbuild
../newlib-2.5.0.20170922/configure --target=arm-none-eabi --prefix=/usr/local --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls --disable-werror
make
The build proceeds for quite some time until the following error. I examine the only two directories "cpu_init" and "semihv2m".
$ pwd
/usr/local/src/newlib/newlib-2.5.0.20170922.armbuild/arm-none-eabi/libgloss
$ ls
config.log librdimon.a rdimon-ftruncate.o redboot-syscalls.o
config.status librdpmon.a rdimon-_kill.o semihv2m
cpu-init linux-crt0.o rdimon-libcfunc.o syscalls.o
_exit.o linux-syscalls0.o rdimon-syscalls.o trap.o
ftruncate.o linux-syscalls1.o rdimon-trap.o truncate.o
_kill.o Makefile rdimon-truncate.o
libcfunc.o rdimon-crt0.o rdpmon-crt0.o
libgloss-linux.a rdimon-_exit.o redboot-crt0.o
$ ls -l cpu-init
total 8
-rw-rw-r-- 1 ron ron 3718 Nov 20 06:05 Makefile
-rw-rw-r-- 1 ron ron 536 Nov 20 06:05 rdimon-aem.o
$ ls -l semihv2m
config.log config.status Makefile
$ ls -l semihv2m
total 40
-rw-rw-r-- 1 ron ron 393 Nov 20 06:05 config.log
-rwxrwxr-x 1 ron ron 32936 Nov 20 06:05 config.status
-rw-rw-r-- 1 ron ron 0 Nov 20 06:05 Makefile
$ cat semihv2m/config.log
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by config.status, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ config.status
config.status:805: error: cannot find input file: `cpu-init/Makefile.in'
End of make output:
config.status: error: cannot find input file: `cpu-init/Makefile.in'
sed: can't read Makefile: No such file or directory
make[6]: Entering directory '/usr/local/src/newlib/newlib- 2.5.0.20170922.armbuild/arm-none-eabi/libgloss/arm/semihv2m'
make[6]: *** No rule to make target 'all'. Stop.
make[6]: Leaving directory '/usr/local/src/newlib/newlib-2.5.0.20170922.armbuild/arm-none-eabi/libgloss/arm/semihv2m'
make[5]: *** [../../../../newlib-2.5.0.20170922/libgloss/arm/../multi-build.in:6: multi-do] Error 1
make[5]: Leaving directory '/usr/local/src/newlib/newlib-2.5.0.20170922.armbuild/arm-none-eabi/libgloss/arm'
make[4]: *** [Makefile:214: all-multi] Error 2
make[4]: Leaving directory '/usr/local/src/newlib/newlib-2.5.0.20170922.armbuild/arm-none-eabi/libgloss/arm'
make[3]: *** [Makefile:144: all] Error 2
make[3]: Leaving directory '/usr/local/src/newlib/newlib-2.5.0.20170922.armbuild/arm-none-eabi/libgloss/arm'
make[2]: *** [Makefile:132: stmp-bsp] Error 2
make[2]: Leaving directory '/usr/local/src/newlib/newlib-2.5.0.20170922.armbuild/arm-none-eabi/libgloss'
make[1]: *** [Makefile:9528: all-target-libgloss] Error 2
make[1]: Leaving directory '/usr/local/src/newlib/newlib-2.5.0.20170922.armbuild'
make: *** [Makefile:879: all] Error 2
I ran into the same issue.
It seems to be resolved in the latest version in the git repository.

hard-coded bin path and NixOS

When I try to do a manual source install of some software on NixOS 15.09, I get (sh -x is to get an exec log):
[nix-shell:/tmp/nix-shell-es/EventStore-oss-v3.5.0-src]$ sh -x scripts/build-js1/build-js1-linux.sh werror=no
...
+ CXXFLAGS=-fPIC
+ make x64.release werror=no
PYTHONPATH="/tmp/nix-shell-es/EventStore-oss-v3.5.0-src/scripts/build-js1/v8/tools/generate_shim_headers:" \
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=x64 \
-Dv8_optimized_debug=0 \
-S.x64.release -Dv8_enable_backtrace=1 -Dwerror='' -Darm_fpu=default -Darm_float_abi=default
/bin/sh: build/gyp/gyp: /bin/bash: bad interpreter: No such file or directory
Makefile:389: recipe for target 'out/Makefile.x64.release' failed
make: *** [out/Makefile.x64.release] Error 126
And indeed there is no bash program in /bin/
[nix-shell:/tmp/nix-shell-es/EventStore-oss-v3.5.0-src]$ ls -la /bin/
total 12
drwxr-xr-x 2 root root 4096 Feb 24 12:25 .
drwxr-xr-x 18 root root 4096 Feb 24 12:16 ..
lrwxrwxrwx 1 root root 63 Feb 24 12:25 sh -> /nix/store/l80ddf18bbig2icv6cmgjfws9a2vm3jj-bash-4.3-p42/bin/sh
However when I inspect the script I dont see any mention of it so it must be some subprogram looking for it.
As an aside, I imagine that's probably why the script wisely starts with #!/usr/bin/env bash and not the direct location of bash.
Anyone knows a blessed way to deal with this ?
one has to run patchShebangs ./scripts/build-js1/build-js1-linux.sh on files coming from source when they are not in the store and we want to execute them.

how to install node.js on the router Asus RT-N18U (with ARMv7l processor)

I would like to install node.js on the ASUS RT-N18U with Tomato firmware version 1.28 by Shibby (http://tomato.groov.pl/download/K26ARM/132/tomato-RT-N18U-ARM--132-AIO-64K.zip)
HW configuration
root#unknown:/# cat /proc/cpuinfo
Processor : ARMv7 Processor rev 0 (v7l)
processor : 0
BogoMIPS : 1599.07
Features : swp half thumb fastmult edsp
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc09
CPU revision : 0
Hardware : Northstar Prototype
Revision : 0000
Serial : 0000000000000000
Try 1:
root#unknown:/# cd /opt
root#unknown:/opt# wget node-v4.2.1-linux-armv7l.tar.gz
root#unknown:/opt# tar zxvf node-v4.2.1-linux-armv7l.tar.gz
root#unknown:/opt# cd node-v4.2.1-linux-armv7l/bin
root#unknown:/opt/node-v4.2.1-linux-armv7l/bin# ls -l
-rwxr-xr-x 1 root root 20958710 Sep 23 03:55 node
lrwxrwxrwx 1 root root 38 Sep 24 17:47 npm -> ../lib/node_modules/npm/bin/npm-cli.js
root#unknown:/opt/node-v4.2.1-linux-armv7l/bin# ./node
-sh: ./node: not found
Result:
File "node" in the directory exists, but the system says "not found".
Try 2:
I've downloaded and unpacked the TomatoWare (latest version 1.0.3) and then compiled the latest version node.js
root#unknown:/opt/node-v4.2.1# ./configure --prefix=/opt/node && make && make install
...
root#unknown:/opt/node/bin# ./node -v
v4.2.1
root#unknown:/opt/node/bin# ./node
Illegal instruction
When I've deleted all files of TomatoWare
root#unknown:/opt/node/bin# ./node
-sh: ./node: not found
so the same error as in the first case!
By
root#unknown:/opt# ldd /opt/node/bin/node
node requires some libraries from TomatoWare.
After these files were copied into /opt/lib:
root#unknown:/opt/lib# ls -l
-rwxr--r-- 1 root root 28701 Sep 3 18:51 ld-uClibc.so.0
-rwxr--r-- 1 root root 576031 Sep 3 18:51 libc.so.0
-rwxr--r-- 1 root root 16129 Sep 3 18:51 libdl.so.0
-rwxr--r-- 1 root root 1344500 Sep 3 18:51 libgcc_s.so.1
-rwxr--r-- 1 root root 92168 Sep 3 18:51 libm.so.0
-rwxr--r-- 1 root root 113786 Sep 3 18:51 libpthread.so.0
-rwxr--r-- 1 root root 19328 Sep 3 18:51 librt.so.0
-rwxr--r-- 1 root root 4079041 Sep 3 18:51 libstdc++.so.6
then
root#unknown:/opt/node/bin# ./node
Illegal instruction
Try 3:
I installed Optware-ng (https://www.hqt.ro/how-to-install-new-generation-optware/)
root#unknown:/# cd /opt
root#unknown:/opt# wget -c -O optware-ng-arm-setup.sh
root#unknown:/opt# chmod +x ./optware-ng-arm-setup.sh
root#unknown:/opt# ./optware-ng-arm-setup.sh
root#unknown:/opt# ipkg update
root#unknown:/opt# ipkg install gcc
root#unknown:/opt# ipkg install make
root#unknown:/opt# ipkg install python27
root#unknown:/opt# gcc --version
gcc (GCC) 5.2.0
root#unknown:/opt# wget node-v4.2.1.tar.gz
root#unknown:/opt# tar xzvf node-v4.2.1.tar.gz
root#unknown:/opt# cd node-v4.2.1
root#unknown:/opt/node-v4.2.1# ./configure --prefix=/opt/node
root#unknown:/opt/node-v4.2.1# make
result:
/opt/node-v4.2.1/out/Release/obj.target/deps/gtest/libgtest.a(gtest.o): In function `testing::UnitTest::GetInstance()':
gtest.cc:(.text._ZN7testing8UnitTest11GetInstanceEv+0x78): undefined reference to `atexit'
collect2: error: ld returned 1 exit status
cctest.target.mk:118: recipe for target '/opt/node-v4.2.1/out/Release/cctest' failed
make[1]: *** [/opt/node-v4.2.1/out/Release/cctest] Error 1
make[1]: Leaving directory '/opt/node-v4.2.1/out'
Makefile:45: recipe for target 'node' failed
make: *** [node] Error 2
Try 4:
I installed Debian, and in it nodejs
root#unknown:/# debian enter
root#unknown:/# apt-get update && apt-get upgrade
root#unknown:/# apt-get install nodejs
root#unknown:/# nodejs -v
v4.1.1
root#unknown:/# nodejs
Illegal instruction
Please can you tell me what am I doing wrong?

Resources