Skip to content

Commit

Permalink
Simplified SConstruct tools and solved compilation issue
Browse files Browse the repository at this point in the history
1. Using the `LINKFLAGS=''` instead of the `parse_flags` argument helped with a
`-lgcc_s not found` error that prevented linking.

2. The simplification was to only use the necessary tools (not the default toolset).
This should hopefully be clearer than the previous iterations.

All the executables compile correctly in the container.

TODO: check that compilation works on Windows.
  • Loading branch information
Amaras committed Nov 27, 2021
1 parent 41498b6 commit 12350c5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ To run the compilation for all implementations in one language, e.g. C, run the
from pathlib import Path
import os

env = Environment(ENV={'PATH': os.environ['PATH']})
env = Environment(ENV={'PATH': os.environ['PATH']},
tools=['gcc', 'gnulink', 'g++'])

env['CC'] = 'gcc'
env['AS'] = 'as'
for tool in ['gcc','gnulink']:
env.Tool(tool)
env['CCFLAGS'] = ''
env['CXXFLAGS'] = '-std=c++17'

Expand Down
2 changes: 1 addition & 1 deletion contents/cooley_tukey/code/asm-x64/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ from pathlib import Path

dirname = Path.cwd().parents[1].stem

env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS=['m'], parse_flags="-Wl,-no-pie")
env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS=['m'], LINKFLAGS='-no-pie')
2 changes: 1 addition & 1 deletion contents/forward_euler_method/code/asm-x64/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ from pathlib import Path

dirname = Path.cwd().parents[1].stem

env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS='m', parse_flags="-Wl,-no-pie")
env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS='m', LINKFLAGS='-no-pie')
2 changes: 1 addition & 1 deletion sconscripts/asm-x64_SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ from pathlib import Path

for file in files_to_compile:
chapter_name = file.parent.parent.parent.stem
env.X64(f'#/build/{language}/{chapter_name}', str(file), parse_flags="-Wl,-no-pie")
env.X64(f'#/build/{language}/{chapter_name}', str(file), LINKFLAGS='-no-pie')

0 comments on commit 12350c5

Please sign in to comment.