|
Post by barryk on Aug 23, 2022 2:05:23 GMT 1
Hi Peter, Yeah, OK, attached. It is designed to run inside OpenEmbedded, host OS is x86_64, target is i686. As I posted about a few days ago, if the target is x86_64, it works. I don't know how you would test it. You would need a cross-compile toolchain I suppose. Makefile.gz (1.39 KB)
|
|
|
Post by Pjot on Aug 23, 2022 6:08:47 GMT 1
Thanks barry, Well, it seems you've been manually poking around in the Makefile after it's been generated There's at least one problem in the Makefile because of those edits. Take a look at this: <.........> 20 21 bacon : 22 @if [ -n "$(LDFLAGS)" ]; then \ 23 $(BSHELL) bacon -n -p -c "$(CC)" -o "$(CFLAGS)" -l "$(LDFLAGS)" -d build bacon.bac 24 else \ 25 $(BSHELL) bacon -n -p -c "$(CC)" -o "$(CFLAGS)" -d build bacon.bac 26 fi; 27 $(STRIP) build/bacon 28 29 <.........>
The error messages says "Makefile: 22", so it occurs at the line starting with the @if. So the problem is that the 'make' utility cannot parse the 'if' construct. If the Makefile uses an '@if' then we have to make sure the lines in the 'if' construct end with a '\' symbol, to group the elements. Therefore, your Makefile should look like this: <.........> 20 21 bacon : 22 @if [ -n "$(LDFLAGS)" ]; then \ 23 $(BSHELL) bacon -n -p -c "$(CC)" -o "$(CFLAGS)" -l "$(LDFLAGS)" -d build bacon.bac \ 24 else \ 25 $(BSHELL) bacon -n -p -c "$(CC)" -o "$(CFLAGS)" -d build bacon.bac \ 26 fi; 27 $(STRIP) build/bacon 28 29 <.........>
Please note the '\' at the end of line 23 and line 25. Can you try again with these changes and let me know the results? Best regards Peter
|
|
|
Post by barryk on Aug 23, 2022 16:05:03 GMT 1
Peter, I'm very sorry, the Makefile I sent you, I had been manually messing with. The correct Makefile is attached, and it has the appropriate "\" line ends. It produces the error, as I documented before: | Converting 'bacon.bac'... done, 10058 lines were processed in 0.391 seconds. | Creating lexical analyzer... done. | make: *** [Makefile:22: bacon] Error 141 Makefile.gz (1.39 KB) And as I stated before, it creates build/bacon.bac.c that looks good, all lines of bacon.bac translated. And yes, there is some editing of the Makefile, as I posted before: basic-converter.proboards.com/post/14596...that introduced the "-n -p" so bacon will not compile. That is to narrow down the error, it occurs after bacon has done a seemingly successful conversion to C. If the Makefile was left in original condition, without the inserted "-n -p" and using bacon.sh, still the same failure.
|
|
|
Post by Pjot on Aug 23, 2022 17:24:01 GMT 1
Hi barry,
Very well, so the error is the same when the '\' symbols are present. I tried your Makefile on my system, and this is what I can see:
$ make rm -f build/* build-cpp/* Converting 'bacon.bac'... done, 10058 lines were processed in 0.243 seconds. Creating lexical analyzer... done. Applying indentation... done. build/bacon make: build/bacon: No such file or directory make: *** [Makefile:23: bacon] Error 127
Interestingly, I do get to the point where the 'indent' utility is invoked ("applying indentation"). But in your output, I do not see this line.
If you look into the generated C code, do you see plain lines with code, no outlining, just text one line after the other? That would mean that the error is caused by both 'bacon.sh' and the binary 'bacon' at the step where the 'indent' utility is invoked.
How does your BaCon version detect 'indent'? Is it using 'command -v' or still using 'which'?
BR Peter
|
|
|
Post by barryk on Aug 24, 2022 1:49:15 GMT 1
|
|
|
Post by barryk on Aug 24, 2022 2:00:34 GMT 1
Have attached build/bacon.bac.c bacon.bac.c.gz (58.28 KB) I added 'indent-native' to the deps in the bacon recipe: DEPENDS = "flex-native bacon-native coreutils-native util-linux-native indent-native" No, still the same error.
|
|
|
Post by barryk on Aug 24, 2022 2:22:08 GMT 1
Looking at bacon.bac.c
I don't think "command -v cpp" is appropriate in a cross-compile environment (line 7969).
Let's see, in the build environment for bacon, recipe-sysroot-native/usr/bin has:
flex indent bacon xgettext
recipe-sysroot-native/usr/bin/i686-poky-linux has files i686-poky-linux-cpp, etc.
OE defines CPP variable:
So I guess bacon should be testing for existence of CPP, then use ${CPP/ */} to get keep the path and drop off the arguments.
|
|
|
Post by barryk on Aug 24, 2022 2:27:49 GMT 1
OK, here are the variables in OE:
export CPP="i686-poky-linux-gcc -E --sysroot=/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot -m32 -march=i686 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security"
export CPPFLAGS=""
|
|
|
Post by barryk on Aug 24, 2022 3:35:55 GMT 1
I had to rush off after the previous post. Sitting in a train right now.
When I get home, will try a little hack, create cpp symlink, so that command -v cpp will return true
|
|
|
Post by Pjot on Aug 24, 2022 5:57:22 GMT 1
Have attached build/bacon.bac.c View AttachmentI added 'indent-native' to the deps in the bacon recipe: DEPENDS = "flex-native bacon-native coreutils-native util-linux-native indent-native" No, still the same error. Barry, from the attached file sourc code file "bacon.bac.c" I can see that "indent" was not executed. The code is the plain line-after-line immediately after it has been generated. Somehow invoking the "indent" utility does not work in your environment. The 'command -v cpp' is only executed when you explicitly have provided the parameter "-j" on the command line (but from the Makefile I can see it is not there, no need to worry about it). Can you confirm "indent" actually is available in the compile path and actually works in your cross compile environment?´ For example, you can run "indent bacon.bac.c" and then verify the output. Also I can see that BaCon 4.5.1 beta has the debugging parameters for "indent" turned on: SYSTEM "indent -bad -bap -bli0 -cli4 -cbi0 -nbc -nbfda -nsc -nprs -bls -blf -lp -ts4 -ppi2 -npsl -i4 -il4 -l140 -nbbo " & tmpfile$
So it also is very likely that your particular "indent" version in your environment chokes on one of these parameters. But in fact, we do not need "indent" at all in your situation. Feel free to comment the line where it is invoked and try again. I will add a bacon parameter to skip "indent" altogether. Best regards Peter
|
|
|
Post by barryk on Aug 24, 2022 9:26:59 GMT 1
Peter, But I only added "indent-native" as a dependency today. Before that indent did not exist in the bacon build environment, so it would not have run.
|
|
|
Post by barryk on Aug 24, 2022 9:52:31 GMT 1
Ah ha, this is interesting! I changed the Makefile back to as it was before, running bacon.sh:
bacon : @if [ -n "$(LDFLAGS)" ]; then \ $(BSHELL) ./bacon.sh -n -p -c "$(CC)" -o "$(CFLAGS)" -l "$(LDFLAGS)" -d build bacon.bac; \ else \ $(BSHELL) ./bacon.sh -n -p -c "$(CC)" -o "$(CFLAGS)" -d build bacon.bac; \ fi; $(STRIP) build/bacon
And left that FORTIFY warning in, so this is the make log:
| Converting 'bacon.bac'... done, 10057 lines were processed in 322 seconds. | Creating lexical analyzer... In file included from /mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/i686-poky-linux/bacon/4.5.0.1-r4/recipe-sysroot/usr/include/bits/libc-header-start.h:33, | from /mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/i686-poky-linux/bacon/4.5.0.1-r4/recipe-sysroot/usr/include/stdio.h:27, | from build/bacon.bac.lex.c:19: | /mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/i686-poky-linux/bacon/4.5.0.1-r4/recipe-sysroot/usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] | 397 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O) | | ^~~~~~~ | done. | ./bacon.sh: line 9214: build/bacon.bac.lex.exe: No such file or directory | WARNING: 'indent' not found on this system! | Generated source code cannot be beautified. | build/bacon | make: build/bacon: No such file or directory | make: *** [Makefile:23: bacon] Error 127 | ERROR: oe_runmake failed
bacon.sh reports build/bacon.bac.lex.exe does not exist, but it does. But, it is a i686 32-bit binary, so cannot be executed on the host system.
|
|
|
Post by barryk on Aug 24, 2022 10:17:50 GMT 1
Yes, picscale is now also failing. Compiling bacon and picscale worked when the target was "nocona" which is x86_64, so host and target architectures are both x86_64.
Looking at the picscale build, it also has build/picscale.bac.lex.exe
That will explain why back in the bacon 2.x and 3.x days, cross-compiling in OE worked?
Does that mean bacon.bac.lex.exe will have to be compiled especially, using host build parameters? In OE, "BUILD_*" variables are for compiling to run on the host system:
export BUILD_AR="ar" export BUILD_AS="as " export BUILD_CC="gcc " export BUILD_CCLD="gcc " export BUILD_CFLAGS="-isystem/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/usr/include -O2 -pipe" export BUILD_CPP="gcc -E" export BUILD_CPPFLAGS="-isystem/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/usr/include" export BUILD_CXX="g++ " export BUILD_CXXFLAGS="-isystem/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/usr/include -O2 -pipe" export BUILD_FC="gfortran " export BUILD_LD="ld " export BUILD_LDFLAGS="-L/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/usr/lib -L/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/lib -Wl,-rpath,/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/usr/lib -Wl,-rpath,/mnt/build/oe-builds/oe-quirky/build-i686/tmp/work/genericx86-poky-linux/core-image-minimal/1.0-r4/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/mnt/build/oe-builds/oe-quirky/build-i686/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2" export BUILD_NM="nm" export BUILD_RANLIB="ranlib" export BUILD_STRIP="strip"
So perhaps bacon needs a cross-compile parameter, and supplying a couple of those variables.
|
|
|
Post by barryk on Aug 24, 2022 13:16:24 GMT 1
I have confirmed, bacon 3.9.3 compiles OK in OE.
As back in 2017, when I was compiling 3.5.4, cannot get autotools to work, so resorted to doing the build manually. So, this is 'bacon_3.9.3.bb' recipe file:
# Recipe created by recipetool # recipetool create -o bacon_3.9.3.bb http://www.basic-converter.org/museum/bacon-3.9.3.tar.gz
HOMEPAGE = "http://basic-converter.org/" SUMMARY = "A BASIC compiler with highlevel GUI."
LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE;md5=8ca82a6ccae989e3ea64c98f9b351f3b"
SRC_URI = "http://www.basic-converter.org/museum/bacon-${PV}.tar.gz"
SRC_URI[md5sum] = "3cd5967225fedc67e552efcb817c40a1" SRC_URI[sha256sum] = "7f907f4ede68704eefd076733f617438c4baba98e9a1e8676ea1a00c4f8476ae"
DEPENDS = ""
do_configure() { true }
do_compile_prepend() { #"which pwd" does not work, as pwd is a bash builtin... sed -i -e 's%which pwd%which head%' bacon.sh }
do_compile() { mkdir -p build # -n convert to C only, -a rebuild libbacon.a, -p preserve temporary files, # -y automatically delete temporary files ... #bash bacon.sh -y -a -d build bacon.bac #...this works for x86_64 target. but for armv7 target may need to do this... bash bacon.sh -n -p -a -d build bacon.bac cd build ${CC} -fPIC -O2 ${CFLAGS} -c bacon.bac.c for aFILE in bacon.base64.c bacon.binary.c bacon.chop.c bacon.chr.c bacon.cmdline.c bacon.concat.c bacon.count.c bacon.curdir.c bacon.datename.c bacon.dec.c bacon.dirname.c bacon.epoch.c bacon.error.c bacon.eval.c bacon.exec.c bacon.extract.c bacon.filelen.c bacon.filetime.c bacon.filetype.c bacon.fill.c bacon.flatten.c bacon.getenviron.c bacon.getkey.c bacon.getpeer.c bacon.getxy.c bacon.hash.c bacon.hex.c bacon.host.c bacon.hostname.c bacon.insert.c bacon.instr.c bacon.instrrev.c bacon.lcase.c bacon.left.c bacon.load.c bacon.makedir.c bacon.malloc.c bacon.memcheck.c bacon.mid.c bacon.minmax.c bacon.os.c bacon.peek.c bacon.regex.c bacon.remove.c bacon.replace.c bacon.reverse.c bacon.right.c bacon.rip.c bacon.screen.c bacon.search.c bacon.sort.c bacon.spc.c bacon.str.c bacon.sum.c bacon.tab.c bacon.tally.c bacon.time.c bacon.timer.c bacon.token.c bacon.ucase.c bacon.utf8.c bacon.version.c bacon.wait.c bacon.walk.c do ${CC} -fPIC -O2 ${CFLAGS} -c ${aFILE} done ${AR} -r libbacon.a bacon.base64.o bacon.binary.o bacon.chop.o bacon.chr.o bacon.cmdline.o bacon.concat.o bacon.count.o bacon.curdir.o bacon.datename.o bacon.dec.o bacon.dirname.o bacon.epoch.o bacon.error.o bacon.eval.o bacon.exec.o bacon.extract.o bacon.filelen.o bacon.filetime.o bacon.filetype.o bacon.fill.o bacon.flatten.o bacon.getenviron.o bacon.getkey.o bacon.getpeer.o bacon.getxy.o bacon.hash.o bacon.hex.o bacon.host.o bacon.hostname.o bacon.insert.o bacon.instr.o bacon.instrrev.o bacon.lcase.o bacon.left.o bacon.load.o bacon.makedir.o bacon.malloc.o bacon.memcheck.o bacon.mid.o bacon.minmax.o bacon.os.o bacon.peek.o bacon.regex.o bacon.remove.o bacon.replace.o bacon.reverse.o bacon.right.o bacon.rip.o bacon.screen.o bacon.search.o bacon.sort.o bacon.spc.o bacon.str.o bacon.sum.o bacon.tab.o bacon.tally.o bacon.time.o bacon.timer.o bacon.token.o bacon.ucase.o bacon.utf8.o bacon.version.o bacon.wait.o bacon.walk.o ${CC} -o bacon bacon.bac.o -L. -lbacon -lm ${LDFLAGS} cd .. }
do_install() { install -d ${D}/usr/bin install -m755 build/bacon ${D}/usr/bin install -m755 bacon.sh ${D}/usr/bin install -d ${D}/usr/lib install -m755 build/libbacon.a ${D}/usr/lib install -d ${D}/usr/share/BaCon install -m644 bacon.bac ${D}/usr/share/BaCon install -d ${D}/usr/share/pixmaps install -m644 icons/BaCon24.png ${D}/usr/share/pixmaps/BaCon.png }
FILES_${PN} += "/usr/share/BaCon"
Actually, I am happy to stay with 3.9.3 in OE, as it is sufficient to compile the utilities that I use in EasyOS, such as picscale.
|
|
|
Post by Pjot on Aug 24, 2022 13:25:26 GMT 1
bacon.sh reports build/bacon.bac.lex.exe does not exist, but it does. But, it is a i686 32-bit binary, so cannot be executed on the host system. Well, in my understanding we can execute a 32bit binary in a 64bit environment. At least, that has always worked for me. Of course, you need to install all depending 32bit libraries as well. Are you missing such dependency? Or is it not the other way around: the 'bacon.bac.lex.exe' file is a 64bit binary which cannot be executed in your 32bit target? Anyway, using flex is optional. It is only there to optimize the resulting binary, but we can live without. If you - temporary - rename your flex utility and try again then BaCon should not bother. BR Peter
|
|