Godot Nix Expression Fails - nix

I've added the following nix expression to my project (verbatem from nixpkgs) and tried to build it, but I get the following error message:
these derivations will be built:
/nix/store/l6l5j1gas74pnzc2pb8w9fv2namxpgki-godot-3.0.6.drv
building '/nix/store/l6l5j1gas74pnzc2pb8w9fv2namxpgki-godot-3.0.6.drv'...
unpacking sources
unpacking source archive /nix/store/mlbp5ibpyq2rd710fl43pwr6a03ysz57-source
source root is source
patching sources
applying patch /nix/store/yk47p909lklbcai94izb5dfqjqqnnxmc-pkg_config_additions.patch
patching file platform/x11/detect.py
applying patch /nix/store/sdr3xp65cibpd06vq4fg5czv2s3m6a3c-dont_clobber_environment.patch
patching file SConstruct
configuring
no configure script, doing nothing
building
no Makefile, doing nothing
installing
cp: missing destination file operand after '/nix/store/mxvinscpfbv3k5j7dvpa83pd4w1p1f4f-godot-3.0.6/bin/godot'
Try 'cp --help' for more information.
builder for '/nix/store/l6l5j1gas74pnzc2pb8w9fv2namxpgki-godot-3.0.6.drv' failed with exit code 1
What could be causing this? Note that when I simply add godot to my nix config (in NixOS using nixos-18.09 channel), it installs and runs just fine. Aren't these the same expressions? If so, why does it work globally and not locally?
NOTE: Here is the part of the nix expression that invokes the cp shell command (related to the error above):
installPhase = ''
mkdir -p "$out/bin"
cp bin/godot.* $out/bin/godot
mkdir "$dev"
cp -r modules/gdnative/include $dev
mkdir -p "$man/share/man/man6"
cp misc/dist/linux/godot.6 "$man/share/man/man6/"
mkdir -p "$out"/share/{applications,icons/hicolor/scalable/apps}
cp misc/dist/linux/godot.desktop "$out/share/applications/"
cp icon.svg "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp icon.png "$out/share/icons/godot.png"
substituteInPlace "$out/share/applications/godot.desktop" \
--replace "Exec=godot" "Exec=$out/bin/godot"
'';

Related

nixos installation issue,'command not found: nix'

I deleted /nix and started a fresh install of nix, however after installing nix install nix (MACBook Pro M1 arm64 BigSur) with sh <(curl -L https://nixos.org/nix/install) I run $ nix but I get the output zsh: command not found: nix , same for nix-shellalso the /nix volume is not created, I also tried the instruction at https://docs.plutus-community.com/docs/setup/MacOS.html still same issue
Open /etc/zshrc and look for the following lines (probably at the end of the file):
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
Copy these lines and delete them from this file.
Open ~/.zshrc and add the above copied lines to the end of this file
Reboot terminal and nix should work now.

Cmake zip folder but remove leading path

I would like to zip folder in my project from CMake. For that I use following code snippet:
ADD_CUSTOM_COMMAND (
TARGET ${PROJECT_NAME}
PRE_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E tar cvf ${ZIP_OUT_DIR}/my_archive.zip --format=zip -- ${FOLDER_TO_ZIP}/another_folder/
)
The problem with this code is that the files after unzipping contain path component (../../my_file.txt in my case). I tried to use tar cvf -C ${FOLDER_TO_ZIP}/another_folder but unfortunatelly CMake doesn't accept this option.
How can I get rid of leading path from zip archive when using CMake ?
The paths are relative to the working directory. So you just need to specify the WORKING_DIRECTORY:
ADD_CUSTOM_COMMAND(
TARGET ${PROJECT_NAME}
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E tar cvf ${ZIP_OUT_DIR}/my_archive.zip --format=zip -- .
WORKING_DIRECTORY ${FOLDER_TO_ZIP}/another_folder
)

Qmake INSTALLS variable - create symbolic link to directory

I am trying to add an INSTALLS rule to my qmake .pro file that will create a symlink in the build directory to the config directory in my project. Here's how I've tried to do it using the 'extra' member:
config.path = $$top_builddir/
config.files = $$rootdir/config
config.extra = ln -sf $$config.files $$config.path
INSTALLS += config
where top_builddir and rootdir are of course the paths to the build directory and root project dir, respectively.
The generated Makefile rule is:
install_config: FORCE
#test -d $(INSTALL_ROOT)/home/greg/Desktop/mg_builds/MPI-Debug || mkdir -p $(INSTALL_ROOT)/home/greg/Desktop/mg_builds/MPI-Debug
ln -sf /home/greg/Desktop/mg/config /home/greg/Desktop/mg_builds/MPI-Debug/
-$(INSTALL_DIR) /home/greg/Desktop/mg/config $(INSTALL_ROOT)/home/greg/Desktop/mg_builds/MPI-Debug/
The extra command has been added but there is also the command to cp the directory too which is causing causing the error:
cp: '/home/greg/Desktop/mg/config' and '/home/greg/Desktop/mg_builds/MPI-Debug/config' are the same file
Makefile:580: recipe for target 'install_config' failed
How can I suppress this or tell qmake to make a symlink rather than a copy?
After a little experimenting I found this works quite nicely. You can leave the .files member empty (i.e. .files =) or just omit it entirely and no copy command will be generated in the Makefile. The target directory can be written directly in the extra command. However, a .path is still required for the rule to be generated.
config.path = $$top_builddir/
config.extra = ln -sf $$rootdir/config $$config.path
INSTALLS += config
Makefile:
install_config: FORCE
#test -d $(INSTALL_ROOT)/home/greg/Desktop/mg_builds/MPI-Debug/ || mkdir -p $(INSTALL_ROOT)/home/greg/Desktop/mg_builds/MPI-Debug/
ln -sf /home/greg/Desktop/mg/config /home/greg/Desktop/mg_builds/MPI-Debug/

Can't compile CUDA samples: ld: library not found for -lgomp clang: error: linker command failed with exit code 1 [duplicate]

I'm trying to get openmp to run in my program on Mavericks, however when I try to compile using the flag -fopenmp I get the following error:
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The command I am running is:
gcc myProgram.cpp -fopenmp -o myProgram
Also, when I run gcc I get Clang warnings which I find to be very strange. And looking into /usr/bin/gcc it does not appear to link to Clang.
Any suggestions on how to fix my Clang errors and get openmp to compile?
The gcc command in the latest Xcode suite is no longer the GCC frontend to LLVM (based on the very old GCC 4.2.1) but rather a symlink to clang. Clang does not (yet) support OpenMP. You have to install separately another version of GCC, e.g. by following this tutorial or by using any of the available software package management systems like MacPorts and Homebrew.
I just recently attacked this problem and have scripted the process of getting everything working based on the official instructions.
The script will download everything into ~/code for easy maintenance and will append the correct environment variables to your ~/.profile file. For advanced users, pick a nice location you want the lib, bin and include installed and move them manually. The script depends on knowing the latest OpenMP runtime from Intel, which can be altered at the top of the script.
The script should work out of the box with vanilla Mavericks, except for one small problem. In the OpenML runtime make script, it does not reliably accept clang when specified and continues with the default GCC. As such, if you don't have GCC installed (which is not normal on out of the box Mavericks), it will fail to build. To fix this, you must comment out two lines (as noted in the script) based on the libomp_20131209_oss.tgz build of OpenMP. Newer builds of OpenML might break this script, so use at your own peril on newer versions.
Simply save this script into a file, run 'chmod +x filename.sh', and run './filename.sh' from terminal. It will take a while to build LLVM and Clang, so be patient.
EDIT: This script will most likely fail on Yosemite and I am having issues using the built clang2 after the update to the dev builds of OSX 10.10.
INTEL_OPENMP_LATEST_BUILD_LINK=https://www.openmprtl.org/sites/default/files/libomp_20131209_oss.tgz
DEST_FOLDER = ~/code
CLANG_INCLUDE=${DEST_FOLDER}/llvm/include
CLANG_BIN=${DEST_FOLDER}/llvm/build/Debug+Asserts/bin
CLANG_LIB=${DEST_FOLDER}/llvm/build/Debug+Asserts/lib
OPENMP_INCLUDE=${DEST_FOLDER}/libomp_oss/exports/common/include
OPENMP_LIB=${DEST_FOLDER}/libomp_oss/exports/mac_32e/lib.thin
mkdir ${DEST_FOLDER}
cd ${DEST_FOLDER}
git clone https://github.com/clang-omp/llvm
git clone https://github.com/clang-omp/compiler-rt llvm/projects/compiler-rt
git clone -b clang-omp https://github.com/clang-omp/clang llvm/tools/clang
cd llvm
mkdir build
cd build
../configure
make
cd Debug+Asserts/bin
mv clang clang2
rm -rf clang++
ln -s clang2 clang2++
echo "LLVM+Clang+OpenMP Include Path : " ${CLANG_INCLUDE}
echo "LLVM+Clang+OpenMP Bin Path : " ${CLANG_BIN}
echo "LLVM+Clang+OpenMP Lib Path : " ${CLANG_LIB}
cd ${DEST_FOLDER}
curl ${INTEL_OPENMP_LATEST_BUILD_LINK} -o libomp_oss_temp.tgz
gunzip -c libomp_oss_temp.tgz | tar xopf -
rm -rf libomp_oss_temp.tgz
cd libomp_oss
echo "You need to do one or two things:"
echo "1.) [Required] Comment out line 433 from libomp_oss/src/makefile.mk"
echo "2.) [Optional] If you do not have GCC installed (not normal on vanilla Mavericks), you must comment out lines 450-451 in libomp_oss/tools/check-tools.pl. Have you done this or want to compile anyway?"
select yn in "Yes" "No"; do
case $yn in
Yes ) make compiler=clang; break;;
No ) exit;;
esac
done
echo "OpenMP Runtime Include Path : " ${OPENMP_INCLUDE}
echo "OpenMP Runtime Lib Path : " ${OPENMP_LIB}
(echo 'export PATH='${CLANG_BIN}':$PATH';
echo 'export C_INCLUDE_PATH='${CLANG_INCLUDE}':'${OPENMP_INCLUDE}':$C_INCLUDE_PATH';
echo 'export CPLUS_INCLUDE_PATH='${CLANG_INCLUDE}':'${OPENMP_INCLUDE}':$CPLUS_INCLUDE_PATH';
echo 'export LIBRARY_PATH='${CLANG_LIB}':'${OPENMP_LIB}':$LIBRARY_PATH';
echo 'export DYLD_LIBRARY_PATH='${CLANG_LIB}':'${OPENMP_LIB}':$DYLD_LIBRARY_PATH}') >> ~/.profile
source ~/.profile
echo "LLVM+Clang+OpenMP is now accessible through [ clang2 ] via terminal and does not conflict with Apple's clang"
If you are running homebrew you can fix this problem by calling:
brew install clang-omp
The compiler will be available under clang-omp++ name
Just worked through this problem. Here's the answer plus how to get it worked with Xcode.
Grab the latest version of openMP runtime library from
https://www.openmprtl.org/download
unzip and compile it by
mkdir build && cd build && cmake .. && make && sudo make install
install it by
sudo cp ./libiomp5.dylib /usr/lib/
sudo cp ./omp.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/
Grab openmp/clang from Git following the instructions on http://clang-omp.github.io/
compile openmp/clang
cd llvm && mkdir build && cd build && ../configure --enable-optimized && make -j
sudo make install
normally it would install clang/clang++ into /usr/local/bin, we need replace the Apple clang with our version
cd /usr/bin
sudo mv clang clang-apple
sudo mv clang++ clang++-apple
sudo ln -s /usr/local/bin/clang ./clang
sudo ln -s /usr/local/bin/clang++ ./clang++
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
sudo mv clang clang-apple
sudo mv clang++ clang++-apple
sudo ln -s /usr/local/bin/clang ./clang
sudo ln -s /usr/local/bin/clang++ ./clang++
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
sudo mv -f * ../../
Create a project in Xcode, using the Hello World code on clang-openmp website for test. After created, add "-fopenmp" to Custom Compiler Flags -> Other C Flags in project settings; add /usr/lib/libiomp5.dylib to the build phases of project (project settings -> Build Phases -> Drag /usr/lib/libiomp5.dylib into Link Binary with Libraries)
It should work. Yosemite + Xcode 6 is tested.
Note: the custom clang is NOT as stable as Apple's. Switch back if you meet strange instruction error after compiled.

Makefile error: "install 'filename' was not found anywhere!"

I am attempting to make a project and have run into this error when trying to issue an install command on a handful of executables. Looks something like this:
(in highest level dir:)
DIRS = \
dir1 \
dir2 \
... \
lastDir \
all clean release:
for x in $(DIRS); do cd $$x; make $#; cd ..; done
Then in dir1, for example:
all: $(PROG)
install $(PROG) ../../bin
and the same for each directory. Log looks like this:
[exec] install my_prog_name ../../bin
[exec] install: my_prog_name was not found anywhere!
[exec] make[1]: Leaving dir1
Neither makefile (in upper or lower directory) has been changed since the last successful build, same with the build file (using ant).
Kind of looks like either a pathing issue or a permissions issue. Permissions on destination directory are 777, though. Issuing the install command manually in dir1 works fine...
Thanks for the help!
Are you running this on Solaris? It seems the Solaris version of the install command is prone to generate this error.
I'm not sure what the root cause is, but you could try using /usr/ucb/install, plain cp or the GNU ginstall.

Resources