Skip to content

Commit

Permalink
add -fpic flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-rabault committed Feb 12, 2024
1 parent 24d3476 commit 9fe014a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/shared_lib_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ def shared_lib(source, target, env):
if libPath is not None:
# Convert the luos_engine.a archive to a shared library
if (pf.system() == 'Windows'):
env.Execute("gcc -O2 -shared -o $BUILD_DIR/libluos_engine.dll " + libPath)
env.Execute("gcc -shared -fPIC -o $BUILD_DIR/libluos_engine.dll " + libPath)
click.secho("* Luos engine shared library available in " + str(env.subst("$BUILD_DIR")) + "/libluos_engine.dll .", fg="green")
elif (pf.system() == 'Linux'):
env.Execute("gcc -O2 -shared -o $BUILD_DIR/libluos_engine.so " + libPath)
env.Execute("gcc -shared -fPIC -o $BUILD_DIR/libluos_engine.so " + libPath)
click.secho("* Luos engine shared library available in " + str(env.subst("$BUILD_DIR")) + "/libluos_engine.so .", fg="green")
elif (pf.system() == 'Darwin'):
for networklib in networklibs:
env.Execute("gcc -O2 -shared -o $BUILD_DIR/" + os.path.basename(networklib)[0:-10] + "_luos_engine.dylib " + libPath + " " + networklib)

env.Execute("gcc -v -shared -fPIC -o $BUILD_DIR/" + os.path.basename(networklib)[0:-10] + "_luos_engine.dylib " + libPath + " " + networklib)
click.secho("\n")
click.secho("Luos engine shared libraries available in " + str(env.subst("$BUILD_DIR")) + "/ :", underline=True)
for networklib in networklibs:
click.secho("\t* " + os.path.basename(networklib)[0:-10] + "_luos_engine.dylib ", fg="green")

env.AddPostAction("$PROGPATH", shared_lib)
env.Append(LINKFLAGS=["-fPIC"])
env.Append(BUILD_FLAGS=["-fPIC"])

0 comments on commit 9fe014a

Please sign in to comment.