Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/fpm_backend.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ subroutine build_package(targets,model,verbose,dry_run)
if (.not.dry_run) call progress%completed_status(j,stat(j))
end if

! Set global flag if this target failed to build
! Set global flag if this target build failed
if (stat(j) /= 0) then
!$omp atomic write
build_failed = .true.
Expand All @@ -153,10 +153,10 @@ subroutine build_package(targets,model,verbose,dry_run)
end do
do j=1,size(stat)
if (stat(j) /= 0) then
write(stderr,'(*(g0:,1x))') '<ERROR> Compilation failed for object "',basename(queue(j)%ptr%output_file),'"'
write(stderr,'(*(g0:,1x))') '<ERROR> compilation failed for object "',basename(queue(j)%ptr%output_file),'"'
end if
end do
call fpm_stop(1,'stopping due to failed compilation')
call fpm_stop(1,'compilation failed')
end if

end do
Expand Down
14 changes: 11 additions & 3 deletions src/fpm_targets.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1377,18 +1377,26 @@ subroutine get_library_dirs(model, targets, shared_lib_dirs)

integer :: i
type(string_t) :: temp


! Start with an empty list
allocate(shared_lib_dirs(0))

do i = 1, size(targets)
associate(target => targets(i)%ptr)
if (all(target%target_type /= [FPM_TARGET_SHARED,FPM_TARGET_ARCHIVE])) cycle
! Only consider shared library targets (.so) since
! only they require runtime lookup via LD_LIBRARY_PATH.
if (.not. any(target%target_type == [FPM_TARGET_SHARED])) cycle
Comment on lines +1381 to +1388
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the unrelated changes so this PR now only modifies src/fpm_backend.F90.

! Always include the output_dir for shared libraries
Comment on lines +1386 to +1389
! Avoid duplicates
if (target%output_dir .in. shared_lib_dirs) cycle
temp = string_t(target%output_dir)
call add_strings(shared_lib_dirs, temp)
end associate
end do


! This fix ensures that the directory where shared libraries are produced
! (target%output_dir) is always included in the list returned, so LD_LIBRARY_PATH
! will contain the correct path for test execution. No interface changes, no filesystem scanning.
Comment on lines +1397 to +1399
end subroutine get_library_dirs

!> Add link directories for all shared libraries in the dependency graph
Expand Down
Loading