I don't exactly know what I did, but seems like I broke my build system.
$ scons install
scons: Reading SConscript files ...
File "<string>", line 1
I_���.�K
H�4����Ǐ��U)�f���R�f���ў�U)�f���R�f���ў�
^
SyntaxError: invalid syntax
The unprintable characters are intended.
The bad thing is: Even resetting on a "known as working" version does not help, as well as using the options like --debug=stacktrace. My version control system (mercurial) does not show changes in the SCons files and I don't know how to proceed. Any hints how to make mercurial print the names of the files it's working on to find out what's happening?
My next step would be to make a new clone of the project (which hopefully builds), but I'm curious what's wrong here.
UPDATE
The problem disappeared when I updated to Ubuntu 12.04. "Disappeared" means in this case, that suddenly I've been able to execute the scons --clean command after which I was able to rebuild my project again. Sadly I cannot reproduce the error so that finally I don't know what caused it because it worked for several months and none of my colleagues had such a strange error before.
This is an excerpt of my script:
vars = Variables( "variables.cache" )
vars.Add( "CXX", "use this c++ compiler", "/usr/bin/g++" )
# (other stuff added to vars)
env = Environment( variables = vars ) # <-- this line caused the error
In the trouble fixing this I got the impression that after updating, Python was able to give me a better error message and the message was (trying to remember it) that vars is in some way invalid. So maybe the problem was in variables.cache, I don't know. Maybe I should just have deleted this file (which I did not) to get rid of the error.
Try executing scons with warnings, as follows:
# scons --warn=all
If this doesnt help, you could try a more old-school approach and put some print statements in the SConstruct to see whats happening and when/where the problem occurs.
You could also try cleaning the entire project and removing/renaming the .sconsdb.lite in the root project.
UPDATE:
I recently had a problem because the version of Python was changed from 2.6 to 2.7 and the error handling changed completely. So, try putting a python try/except block around everything (or at least the strategic parts) in your SConstruct and print the exceptions (if any) that are thrown.
If none of these work, try posting the SConstruct here.
Code example from my SConstruct demonstrating how I found my error with a Python try/except block. The BuildError exception gave me a stack trace. There are more Exceptions that you can "catch".
...
try:
SConscript(
os.path.join(moduleDir, 'SConscript'), # sub-directory SConscript to load
variant_dir = '#%s' % os.path.join(env['variantDir'], dir), # path relative to this script where to put built files
exports = ['env'], # which variables to export to sub-directory build
duplicate = 0) # dont duplicate source files in variant_dir
except SCons.Errors.BuildError as be:
print "*** BuildError exception processing module: %s, %s" % (moduleDir, be.__str__())
raise
except:
print "*** Unhandled exception processing module: %s" % moduleDir
raise
Related
There is some code I want to turn into an exe. I have used Pyinstaller and I manage getting an exe that runs. The platform is Win10, Python version 3.6, devs with Spyder.
At some point in the code, the following lines pose an issue with the exe (not in script mode):
from formulas import parser as formulasparser
# code including classes
# in a function:
t = 'x<1' # any string that is a 'formula', here provided for the example
parser_ = formulasparser.Parser()
# the exe works so far, I have traced the code and can read the messages in the windows cmd
func = parser_.ast(t)
# nothing happens and no way to get a trace; there is an issue, and I have no clue which one as there
# is no error message.
So, it seems that the ast function won't work for some reason. Can anyone help me? I need to distribute this application and it does not work because of this right now.
Thanks for your help.
Well, someone seems to have faced a somewhat similar issue on the Pyinstaller mailing list.
So: a hook file is actually needed. I created a directory called pyinstallerhooks with a file called hook-formulas.py inside.
The file itself contains:
from PyInstaller.utils.hooks import collect_all
datas, binaries, hiddenimports = collect_all('formulas')
and this is it.
When calling pyinstaller, use the following command:
pyinstaller --additional-hooks-dir pathtoyourdir -F yoursrcipt.py
Pyinstaller fetches the relevant dependencies for the formulas package and it shoudl work.
So, i've been trying to compile a program using sconstruct, but i'm facing a problem.
I got the following error when trying to compile a program using sconstruct.
D:\RN ENGINE - REV #1\neo>scons
scons: Reading SConscript files ...
File "sys/scons\scons_utils.py", line 19
except OSError, x:
^
SyntaxError: invalid syntax
I have tried to look for the file where the error is occured, which is scons_utils.py, but i didn't manage to find it, and the documentation didn't helped me very well.
Is this a bug on the sconstruct itself, or i did something wrong? Thanks.
If something else is required in order to solve this, i won't hesitate to give it.
scons_utils.py is not a SCons file. So it's likely part of whatever you're trying to build.
Likely you're using python 3.5+ with a newer SCons, and previously you were using python 2.7 and older SCons.
SO the issue you see (once you find the file) is python 2.7 vs python 3.5+.
Try running again with --debug=stacktrace which should hopefully give you the full path to scons_utils.py
Change that line to:
except OSError as x:
I just installed Stack GHCI and Visual Studio Code in my Windows. And I was trying to build and run the first simple Haskell putStrln programme, but with a big compile fail.
In VS Code terminal, I entered:
PS C:\Users\rmili\Documents> stack new TryHaskell
And a new folder "TryHaskell" was created, with the automatically created files "Lib.hs" and "Main.hs"
I tried to build and run the hs files. But I encountered the following errors:
In a new terminal, after I entered PS C:\Users\rmili\Documents\TryHaskell> stack build, this will result in the following error:
Error Messages:
"'C:\Users\rmili\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\bin\ghc-pkg.exe'
exited with an error:
ghc-pkg.exe: hLock: permission denied (Access is denied.)
)"
At the top of Main.hs and Lib.hs, the lines module Main where and module Lib both have curly lines underneath, with error message:
readCreateProcess: stack "exec" "ghc" "--" "-rtsopts=ignore" "-outputdir" "C:\\Users\\rmili\\AppData\\Local\\Temp\\hie-bios-98c9848bfed41b00" "-o" "C:\\Users\\rmili\\AppData\\Local\\hie-bios\\wrapper-4da94d68375fab32d2147da1837e9611.exe" "C:\\Users\\rmili\\AppData\\Local\\hie-bios\\wrapper-4da94d68375fab32d2147da1837e9611.hs" (exit 1): failedcompiler
Peek Problem (Alt+F8)
No quick fixes available
My GHCI directory looks fine, as shown below:
UPDATE: It seemed that antivirus is the problem for me, as whenever I tried to build a new hs file, there will be a pop up from Norton, saying data protector has blocked an action by Haskell server. After I asked Norton to exclude specifically such action, I could successfully compile and run my hs files.
However, the problem is that the curly lines under "module Main where" and "module Lib" remain. How can I remove the curly lines and its associated error messages as shown in point 2) above?
Welcome to Haskell!
Unfortunately, it seems Haskell on Windows has various "permission denied" bugs. (https://gitlab.haskell.org/ghc/ghc/-/issues/2924). I have no direct workaround to suggest, other than make sure all software is up-to-date, try different configurations, and try and build using ghc directly without stack.
Other things to try include making sure you are running as Administrator, and disabling your antivirus.
I have a package with bunch of *.c and *.cpp files, listed inside c-sources field of *.cabal file. I need to include it inside a project with IHaskell and some other packages. Everything works fine, and builds without a problem. stack exec ghci works fine and I can import modules and execute any code. stack ghci though throws some weird errors, like this:
In file included from <command-line>:10:0:
/...blabla.../.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/autogen/cabal_macros.h:157:0:
note: this is the location of the previous definition
#define CURRENT_PACKAGE_KEY "blabla"
^
And stack ghci inside my package complains about symbols exported from its C code. Another weird thing is that symbols depend on the order of exposed-modules in the configuration, so the error goes away if I put my *.hs module on top of others, but if I have two *.hs files importing from the same *.c file, it won't work! stack exec jupyter -- console --kernel haskell starts, but immediately throws unknown symbol error if I try to run some code from my package, always the same though.
I have a docker image based on fpco/stack-build, which just installs jupyter and other necessary stuff. I use lts-3.0 snapshot, if it's somehow relevant.
What is going on?
There have been a lot of improvements made recently to stack ghci, which is still mostly a work in progress. I'd recommend testing out stack master, and if the problem still exists opening a Github issue.
I was installing this program: THERMUS, that, as i know should install fine. I/m installing this program through ubuntu console. But when i run make all i got this message:
make: ***No rule to make target '/main/TTMParticle.h', needed by 'BQConstrainQ.o'. Stop.
I know that it could be caused by the fact that file TTMParticle.h doesn't exist in /main/, but i checked - it's there.
Your environment variable THERMUS is not properly set. The build instructions mention:
3 . Set an environment variable `THERMUS' to point at the top-level
directory containing the THERMUS code
It does not mention that you have to do export THERMUS to make that variable available to other processes, like make, so you might have forgotten that -- or not have set THERMUS at all. Without actually having tried it, I think the fastest way to get rid of this message is to run make as follows:
THERMUS=.. make all
To track down the issue, check out the file functions/makefile where you problem occurs. It mentions:
SEP_CLASSESH = $(THERMUS)/main/TTMParticle.h \
and later contains the dependency
$(FNCSO): $(FNCSS) $(SEP_CLASSESH)
which is the line that causes the actual error, because
FNCSO = BQConstrainQ.o \